mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-14 03:30:02 +00:00
Merge pull request #6 from hiviah/point_at_infinity
Hashing of secp256k1 pubkey recognizes point at infinity.
This commit is contained in:
commit
3308cc62a6
6
ecdsa.c
6
ecdsa.c
@ -338,10 +338,12 @@ void ecdsa_get_public_key65(const uint8_t *priv_key, uint8_t *pub_key)
|
||||
void ecdsa_get_pubkeyhash(const uint8_t *pub_key, uint8_t *pubkeyhash)
|
||||
{
|
||||
uint8_t h[32];
|
||||
if (pub_key[0] == 0x04) {
|
||||
if (pub_key[0] == 0x04) { // uncompressed format
|
||||
sha256_Raw(pub_key, 65, h);
|
||||
} else if (pub_key[0] == 0x00) { // point at infinity
|
||||
sha256_Raw(pub_key, 1, h);
|
||||
} else {
|
||||
sha256_Raw(pub_key, 33, h);
|
||||
sha256_Raw(pub_key, 33, h); // expecting compressed format
|
||||
}
|
||||
ripemd160(h, 32, pubkeyhash);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user