mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-16 03:18:09 +00:00
invert pby when normalizing S during signing
This commit is contained in:
parent
89a7d7797b
commit
795579cbac
3
ecdsa.c
3
ecdsa.c
@ -364,6 +364,9 @@ int ecdsa_sign_digest(const uint8_t *priv_key, const uint8_t *digest, uint8_t *s
|
|||||||
// if S > order/2 => S = -S
|
// if S > order/2 => S = -S
|
||||||
if (bn_is_less(&order256k1_half, &k)) {
|
if (bn_is_less(&order256k1_half, &k)) {
|
||||||
bn_substract_noprime(&order256k1, &k, &k);
|
bn_substract_noprime(&order256k1, &k, &k);
|
||||||
|
if (pby) {
|
||||||
|
*pby = !*pby;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we are done, R.x and k is the result signature
|
// we are done, R.x and k is the result signature
|
||||||
|
Loading…
Reference in New Issue
Block a user