RustCrypto / utils

Utility crates used in RustCrypto
450 stars 130 forks source link

Add bitcoin test case from wycheproof #1095

Closed XuJiandong closed 4 months ago

XuJiandong commented 4 months ago

See testvectors_v1/ecdsa_secp256k1_sha256_bitcoin_test.json. Is it necessary to add this to the secp256k1 tests?

From https://github.com/C2SP/wycheproof/issues/119, we know that the test vectors in "testvectors_v1" have a different format than those in "testvectors" and contain the latest version of the test vectors. The new files include the test vectors from the old directory as well as some new ones. Maybe it is a good chance to adopt the new "testvectors_v1"?

tarcieri commented 4 months ago

@XuJiandong we implement those non-malleability rules, so those tests should succeed against k256, yes

XuJiandong commented 4 months ago

Yes, it can pass: https://github.com/XuJiandong/elliptic-curves/commit/0cd279cb576c19f754d91c2774105d454fc5b10d Since it works as expected, I will not submit a PR for it.

bleichenbacher-daniel commented 3 months ago

Just an additional comment.

If you have any library for which Wycheproof does not have good test vectors (e.g., unsuitable formats or missing restriction), then please don't hesitate to ask for them. I am working on the project, just the github page is badly maintained and I don't have access to it. Especially the crypto currency community is adding new primitives and new variants of primitives. Often it makes sense to generate special test cases for these primitives. E.g., for ECDSA with public key recovery it makes sense to add test cases where the recovered public key is a special case. I've also started to write some tests in Rust, which might become helpful at some point.