fix edge condition in generating ecc key from seed
This commit is contained in:
parent
fbadc5bdfa
commit
b6bf4bb389
1 changed files with 3 additions and 2 deletions
|
|
@ -279,8 +279,9 @@ struct ssl_bignum
|
||||||
BN_mod(secexp, secexp, order, ctx);
|
BN_mod(secexp, secexp, order, ctx);
|
||||||
|
|
||||||
fc::sha256 secret;
|
fc::sha256 secret;
|
||||||
assert(BN_num_bytes(secexp) == sizeof(secret));
|
assert(BN_num_bytes(secexp) <= int64_t(sizeof(secret)));
|
||||||
BN_bn2bin(secexp, (unsigned char*)&secret);
|
auto shift = sizeof(secret) - BN_num_bytes(secexp);
|
||||||
|
BN_bn2bin(secexp, ((unsigned char*)&secret)+shift);
|
||||||
return regenerate( secret );
|
return regenerate( secret );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue