24 WARN_UNUSED_RESULT cx_err_t
29 cx_ecfp_256_private_key_t *privkey,
34 cx_err_t error = CX_OK;
39 CX_CHECK(cx_ecdomain_parameters_length(curve, &length));
41 error = CX_EC_INVALID_CURVE;
46 CX_CHECK(os_derive_bip32_with_seed_no_throw(
47 derivation_mode, curve, path, path_len, raw_privkey, chain_code, seed, seed_len));
50 CX_CHECK(cx_ecfp_init_private_key_no_throw(curve, raw_privkey, length, privkey));
53 explicit_bzero(raw_privkey,
sizeof(raw_privkey));
58 explicit_bzero(privkey,
sizeof(cx_ecfp_256_private_key_t));
73 cx_err_t error = CX_OK;
75 cx_ecfp_256_private_key_t privkey;
76 cx_ecfp_256_public_key_t pubkey;
80 derivation_mode, curve, path, path_len, &privkey, chain_code, seed, seed_len));
83 CX_CHECK(cx_ecfp_generate_pair2_no_throw(curve, &pubkey, &privkey,
true, hashID));
86 if (pubkey.W_len != 65) {
87 error = CX_EC_INVALID_CURVE;
90 memmove(raw_pubkey, pubkey.W, pubkey.W_len);
93 explicit_bzero(&privkey,
sizeof(privkey));
98 explicit_bzero(raw_pubkey, 65);
105 const uint32_t *path,
117 cx_err_t error = CX_OK;
118 cx_ecfp_256_private_key_t privkey;
119 size_t buf_len = *sig_len;
123 derivation_mode, curve, path, path_len, &privkey, NULL, seed, seed_len));
126 cx_ecdsa_sign_no_throw(&privkey, sign_mode, hashID, hash, hash_len, sig, sig_len, info));
129 explicit_bzero(&privkey,
sizeof(privkey));
131 if (error != CX_OK) {
134 explicit_bzero(sig, buf_len);
139 WARN_UNUSED_RESULT cx_err_t
142 const uint32_t *path,
154 cx_err_t error = CX_OK;
155 cx_ecfp_256_private_key_t privkey;
159 derivation_mode, curve, path, path_len, &privkey, NULL, seed, seed_len));
161 CX_CHECK(cx_ecdsa_sign_rs_no_throw(
162 &privkey, sign_mode, hashID, hash, hash_len, 32, sig_r, sig_s, info));
165 explicit_bzero(&privkey,
sizeof(privkey));
172 const uint32_t *path,
182 cx_err_t error = CX_OK;
183 cx_ecfp_256_private_key_t privkey;
185 size_t buf_len = *sig_len;
187 if (sig_len == NULL) {
188 error = CX_INVALID_PARAMETER_VALUE;
194 derivation_mode, curve, path, path_len, &privkey, NULL, seed, seed_len));
196 CX_CHECK(cx_eddsa_sign_no_throw(&privkey, hashID, hash, hash_len, sig, *sig_len));
198 CX_CHECK(cx_ecdomain_parameters_length(curve, &size));
202 explicit_bzero(&privkey,
sizeof(privkey));
204 if (error != CX_OK) {
207 explicit_bzero(sig, buf_len);
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.
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.
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.
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.
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.