mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +00:00
trezor.crypto: fix sha3-{256,512} argument handling
This commit is contained in:
parent
7efef68e97
commit
d11bbde2e1
@ -60,7 +60,7 @@ STATIC mp_obj_t mod_trezorcrypto_Sha3_256_digest(size_t n_args, const mp_obj_t *
|
||||
uint8_t out[SHA3_256_DIGEST_LENGTH];
|
||||
SHA3_CTX ctx;
|
||||
memcpy(&ctx, &(o->ctx), sizeof(SHA3_CTX));
|
||||
if (n_args >= 1 && args[1] == mp_const_true) {
|
||||
if (n_args > 1 && args[1] == mp_const_true) {
|
||||
keccak_Final(&ctx, out);
|
||||
} else {
|
||||
sha3_Final(&ctx, out);
|
||||
|
@ -60,7 +60,7 @@ STATIC mp_obj_t mod_trezorcrypto_Sha3_512_digest(size_t n_args, const mp_obj_t *
|
||||
uint8_t out[SHA3_512_DIGEST_LENGTH];
|
||||
SHA3_CTX ctx;
|
||||
memcpy(&ctx, &(o->ctx), sizeof(SHA3_CTX));
|
||||
if (n_args >= 1 && args[1] == mp_const_true) {
|
||||
if (n_args > 1 && args[1] == mp_const_true) {
|
||||
keccak_Final(&ctx, out);
|
||||
} else {
|
||||
sha3_Final(&ctx, out);
|
||||
|
Loading…
Reference in New Issue
Block a user