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

pull/25/head
Pavol Rusnak 6 years ago
parent 7efef68e97
commit d11bbde2e1
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -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…
Cancel
Save