1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 06:18:07 +00:00

trezor.crypto: fix sha3-{256,512} argument handling

This commit is contained in:
Pavol Rusnak 2018-01-12 13:50:34 +01:00
parent 7efef68e97
commit d11bbde2e1
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 2 additions and 2 deletions

View File

@ -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);

View File

@ -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);