mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-14 03:30:02 +00:00
small cleanup
This commit is contained in:
parent
e19f7cd2e5
commit
1691d5cc8c
5
ecdsa.c
5
ecdsa.c
@ -326,7 +326,7 @@ void ecdsa_get_address(const uint8_t *pub_key, char version, char *addr)
|
|||||||
for (i = 0; i < l / 2; i++) {
|
for (i = 0; i < l / 2; i++) {
|
||||||
s = addr[i];
|
s = addr[i];
|
||||||
addr[i] = addr[l - 1 - i];
|
addr[i] = addr[l - 1 - i];
|
||||||
addr[l - 1 - i] = s;;
|
addr[l - 1 - i] = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,7 +343,6 @@ int ecdsa_verify(const uint8_t *pub_key, const uint8_t *sig, const uint8_t *msg,
|
|||||||
uint8_t hash[32];
|
uint8_t hash[32];
|
||||||
curve_point pub, res;
|
curve_point pub, res;
|
||||||
bignum256 r, s, z;
|
bignum256 r, s, z;
|
||||||
int res_is_zero = 0;
|
|
||||||
// compute hash function of message
|
// compute hash function of message
|
||||||
SHA256_Raw(msg, msg_len, hash);
|
SHA256_Raw(msg, msg_len, hash);
|
||||||
// if double hash is required uncomment the following line:
|
// if double hash is required uncomment the following line:
|
||||||
@ -386,7 +385,7 @@ int ecdsa_verify(const uint8_t *pub_key, const uint8_t *sig, const uint8_t *msg,
|
|||||||
if (bn_is_zero(&z)) {
|
if (bn_is_zero(&z)) {
|
||||||
// our message hashes to zero
|
// our message hashes to zero
|
||||||
// I don't expect this to happen any time soon
|
// I don't expect this to happen any time soon
|
||||||
res_is_zero = 1;
|
return 3;
|
||||||
} else {
|
} else {
|
||||||
scalar_multiply(&z, &res);
|
scalar_multiply(&z, &res);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user