mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-20 05:18:08 +00:00
fix(crypto): imporve handling of return value
This commit is contained in:
parent
057b927e99
commit
db3b7563b2
@ -294,10 +294,12 @@ int zkp_bip340_tweak_private_key(const uint8_t *internal_private_key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
secp256k1_keypair keypair = {0};
|
secp256k1_keypair keypair = {0};
|
||||||
|
if (result == 0) {
|
||||||
if (secp256k1_keypair_create(context_writable, &keypair,
|
if (secp256k1_keypair_create(context_writable, &keypair,
|
||||||
internal_private_key) != 1) {
|
internal_private_key) != 1) {
|
||||||
result = -1;
|
result = -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (context_writable) {
|
if (context_writable) {
|
||||||
zkp_context_release_writable();
|
zkp_context_release_writable();
|
||||||
|
@ -71,7 +71,10 @@ int zkp_context_init(void) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
secp256k1_context_writable_randomize(context);
|
if (secp256k1_context_writable_randomize(context) != 0) {
|
||||||
|
zkp_context_destroy();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
atomic_flag_clear(&locked);
|
atomic_flag_clear(&locked);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user