Embedded SDK
Embedded SDK
|
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include "cx.h"
#include "os.h"
Go to the source code of this file.
Functions | |
WARN_UNUSED_RESULT cx_err_t | bip32_derive_with_seed_init_privkey_256 (unsigned int derivation_mode, cx_curve_t curve, const uint32_t *path, size_t path_len, cx_ecfp_256_private_key_t *privkey, uint8_t *chain_code, unsigned char *seed, size_t seed_len) |
Gets the private key from the device seed using the specified bip32 path and seed key. More... | |
WARN_UNUSED_RESULT cx_err_t | bip32_derive_with_seed_get_pubkey_256 (unsigned int derivation_mode, cx_curve_t curve, const uint32_t *path, size_t path_len, uint8_t raw_pubkey[static 65], uint8_t *chain_code, cx_md_t hashID, unsigned char *seed, size_t seed_len) |
Gets the public key from the device seed using the specified bip32 path and seed key. More... | |
WARN_UNUSED_RESULT cx_err_t | bip32_derive_with_seed_ecdsa_sign_hash_256 (unsigned int derivation_mode, cx_curve_t curve, const uint32_t *path, size_t path_len, uint32_t sign_mode, cx_md_t hashID, const uint8_t *hash, size_t hash_len, uint8_t *sig, size_t *sig_len, uint32_t *info, unsigned char *seed, size_t seed_len) |
Sign a hash with ecdsa using the device seed derived from the specified bip32 path and seed key. More... | |
WARN_UNUSED_RESULT cx_err_t | bip32_derive_with_seed_ecdsa_sign_rs_hash_256 (unsigned int derivation_mode, cx_curve_t curve, const uint32_t *path, size_t path_len, uint32_t sign_mode, cx_md_t hashID, const uint8_t *hash, size_t hash_len, uint8_t sig_r[static 32], uint8_t sig_s[static 32], uint32_t *info, unsigned char *seed, size_t seed_len) |
Sign a hash with ecdsa using the device seed derived from the specified bip32 path and seed key. More... | |
WARN_UNUSED_RESULT cx_err_t | bip32_derive_with_seed_eddsa_sign_hash_256 (unsigned int derivation_mode, cx_curve_t curve, const uint32_t *path, size_t path_len, cx_md_t hashID, const uint8_t *hash, size_t hash_len, uint8_t *sig, size_t *sig_len, unsigned char *seed, size_t seed_len) |
Sign a hash with eddsa using the device seed derived from the specified bip32 path and seed key. More... | |
WARN_UNUSED_RESULT cx_err_t bip32_derive_with_seed_ecdsa_sign_hash_256 | ( | unsigned int | derivation_mode, |
cx_curve_t | curve, | ||
const uint32_t * | path, | ||
size_t | path_len, | ||
uint32_t | sign_mode, | ||
cx_md_t | hashID, | ||
const uint8_t * | hash, | ||
size_t | hash_len, | ||
uint8_t * | sig, | ||
size_t * | sig_len, | ||
uint32_t * | info, | ||
unsigned char * | seed, | ||
size_t | seed_len | ||
) |
Sign a hash with ecdsa using the device seed derived from the specified bip32 path and seed key.
[in] | derivation_mode | Derivation mode, one of HDW_NORMAL / HDW_ED25519_SLIP10 / HDW_SLIP21. |
[in] | curve | Curve identifier. |
[in] | path | Bip32 path to use for derivation. |
[in] | path_len | Bip32 path length. |
[in] | hashID | Message digest algorithm identifier. |
[in] | hash | Digest of the message to be signed. The length of hash must be shorter than the group order size. Otherwise it is truncated. |
[in] | hash_len | Length of the digest in octets. |
[out] | sig | Buffer where to store the signature. The signature is encoded in TLV: 30 || L || 02 || Lr || r || 02 || Ls || s |
[in] | sig_len | Length of the signature buffer, updated with signature length. |
[out] | info | Set with CX_ECCINFO_PARITY_ODD if the y-coordinate is odd when computing [k].G. |
[in] | seed | Seed key to use for derivation. |
[in] | seed_len | Seed key length. |
Definition at line 103 of file crypto_helpers.c.
WARN_UNUSED_RESULT cx_err_t bip32_derive_with_seed_ecdsa_sign_rs_hash_256 | ( | unsigned int | derivation_mode, |
cx_curve_t | curve, | ||
const uint32_t * | path, | ||
size_t | path_len, | ||
uint32_t | sign_mode, | ||
cx_md_t | hashID, | ||
const uint8_t * | hash, | ||
size_t | hash_len, | ||
uint8_t | sig_r[static 32], | ||
uint8_t | sig_s[static 32], | ||
uint32_t * | info, | ||
unsigned char * | seed, | ||
size_t | seed_len | ||
) |
Sign a hash with ecdsa using the device seed derived from the specified bip32 path and seed key.
[in] | derivation_mode | Derivation mode, one of HDW_NORMAL / HDW_ED25519_SLIP10 / HDW_SLIP21. |
[in] | curve | Curve identifier. |
[in] | path | Bip32 path to use for derivation. |
[in] | path_len | Bip32 path length. |
[in] | hashID | Message digest algorithm identifier. |
[in] | hash | Digest of the message to be signed. The length of hash must be shorter than the group order size. Otherwise it is truncated. |
[in] | hash_len | Length of the digest in octets. |
[out] | sig_r | Buffer where to store the signature r value. |
[out] | sig_s | Buffer where to store the signature s value. |
[out] | info | Set with CX_ECCINFO_PARITY_ODD if the y-coordinate is odd when computing [k].G. |
[in] | seed | Seed key to use for derivation. |
[in] | seed_len | Seed key length. |
Definition at line 140 of file crypto_helpers.c.
WARN_UNUSED_RESULT cx_err_t bip32_derive_with_seed_eddsa_sign_hash_256 | ( | unsigned int | derivation_mode, |
cx_curve_t | curve, | ||
const uint32_t * | path, | ||
size_t | path_len, | ||
cx_md_t | hashID, | ||
const uint8_t * | hash, | ||
size_t | hash_len, | ||
uint8_t * | sig, | ||
size_t * | sig_len, | ||
unsigned char * | seed, | ||
size_t | seed_len | ||
) |
Sign a hash with eddsa using the device seed derived from the specified bip32 path and seed key.
[in] | derivation_mode | Derivation mode, one of HDW_NORMAL / HDW_ED25519_SLIP10 / HDW_SLIP21. |
[in] | curve | Curve identifier. |
[in] | path | Bip32 path to use for derivation. |
[in] | path_len | Bip32 path length. |
[in] | hashID | Message digest algorithm identifier. |
[in] | hash | Digest of the message to be signed. The length of hash must be shorter than the group order size. Otherwise it is truncated. |
[in] | hash_len | Length of the digest in octets. |
[out] | sig | Buffer where to store the signature. |
[in] | sig_len | Length of the signature buffer, updated with signature length. |
[in] | seed | Seed key to use for derivation. |
[in] | seed_len | Seed key length. |
Definition at line 170 of file crypto_helpers.c.
WARN_UNUSED_RESULT cx_err_t bip32_derive_with_seed_get_pubkey_256 | ( | unsigned int | derivation_mode, |
cx_curve_t | curve, | ||
const uint32_t * | path, | ||
size_t | path_len, | ||
uint8_t | raw_pubkey[static 65], | ||
uint8_t * | chain_code, | ||
cx_md_t | hashID, | ||
unsigned char * | seed, | ||
size_t | seed_len | ||
) |
Gets the public key from the device seed using the specified bip32 path and seed key.
[in] | derivation_mode | Derivation mode, one of HDW_NORMAL / HDW_ED25519_SLIP10 / HDW_SLIP21. |
[in] | curve | Curve identifier. |
[in] | path | Bip32 path to use for derivation. |
[in] | path_len | Bip32 path length. |
[out] | raw_pubkey | Buffer where to store the public key. |
[out] | chain_code | Buffer where to store the chain code. Can be NULL. |
[in] | hashID | Message digest algorithm identifier. |
[in] | seed | Seed key to use for derivation. |
[in] | seed_len | Seed key length. |
Definition at line 63 of file crypto_helpers.c.
WARN_UNUSED_RESULT cx_err_t bip32_derive_with_seed_init_privkey_256 | ( | unsigned int | derivation_mode, |
cx_curve_t | curve, | ||
const uint32_t * | path, | ||
size_t | path_len, | ||
cx_ecfp_256_private_key_t * | privkey, | ||
uint8_t * | chain_code, | ||
unsigned char * | seed, | ||
size_t | seed_len | ||
) |
Gets the private key from the device seed using the specified bip32 path and seed key.
[in] | derivation_mode | Derivation mode, one of HDW_NORMAL / HDW_ED25519_SLIP10 / HDW_SLIP21. |
[in] | curve | Curve identifier. |
[in] | path | Bip32 path to use for derivation. |
[in] | path_len | Bip32 path length. |
[out] | privkey | Generated private key. |
[out] | chain_code | Buffer where to store the chain code. Can be NULL. |
[in] | seed | Seed key to use for derivation. |
[in] | seed_len | Seed key length. |
Definition at line 25 of file crypto_helpers.c.