Closed nyrf closed 1 year ago
This crate implements a deterministic version of SM2DSA based on RFC6979, similar to the deterministic implementation of ECDSA in the ecdsa
crate.
The security of both ECDSA and SM2DSA relies on the generation of the k
scalar used to compute a signature being unique per message and uniformly random with no bias. If there is a bias, lattice attacks can be used to recover the private key.
ECDSA has failed many times in practice in high profile applications because of bad selection of k
, which is what RFC6979 aims to prevent by using HMAC-DRBG as an unbiased pseudorandom number generator. SM2DSA will fail the same way if k
is not chosen in a uniformly random manner.
There are still some reasons to incorporate additional randomness though, like fault attacks. RFC6979 supports supplying additional randomness as an input to its pseudorandom number generator, and the ecdsa
crate provides a RandomizedSigner
implementation which uses this randomness. This crate could as well.
This crate implements a deterministic version of SM2DSA based on RFC6979, similar to the deterministic implementation of ECDSA in the
ecdsa
crate.The security of both ECDSA and SM2DSA relies on the generation of the
k
scalar used to compute a signature being unique per message and uniformly random with no bias. If there is a bias, lattice attacks can be used to recover the private key.ECDSA has failed many times in practice in high profile applications because of bad selection of
k
, which is what RFC6979 aims to prevent by using HMAC-DRBG as an unbiased pseudorandom number generator. SM2DSA will fail the same way ifk
is not chosen in a uniformly random manner.There are still some reasons to incorporate additional randomness though, like fault attacks. RFC6979 supports supplying additional randomness as an input to its pseudorandom number generator, and the
ecdsa
crate provides aRandomizedSigner
implementation which uses this randomness. This crate could as well.
Thank you. I see. Then, thanks for your great work.
when i used others crates, it got different result every time.