-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Wycheproof ECDSA p256 test vectors #313
Conversation
Currently only works in |
That |
I removed the |
Thanks! How do the inter-repo/inter-crate dependencies work, BTW? Does there need to be a new release of |
You can add the following to this repo's [patch.crates-io]
ecdsa = { git = "https://github.com/RustCrypto/signatures.git" } |
Looks like it's passing now 🎉 |
Codecov Report
@@ Coverage Diff @@
## master #313 +/- ##
=======================================
Coverage 58.60% 58.60%
=======================================
Files 35 35
Lines 3860 3860
=======================================
Hits 2262 2262
Misses 1598 1598
Continue to review full report at Codecov.
|
a69b33f
to
b250cb9
Compare
Unfortunately I can either cut some prerelease crates or you can temporarily comment out the |
I don't think there's any rush – I can just pause this until the next time there's an |
Cool, we'll hopefully have one out after RustCrypto/traits#392 and RustCrypto/traits#478 |
@daviddrysdale for unrelated reasons I cut another release of the If you rebase and remove the git-based dependencies, I think it might work? |
b250cb9
to
cee8b9e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet, looks like the tests are passing.
@daviddrysdale let me know if there are any other changes you want to make, or otherwise I'd say this is ready to merge
Thanks, I think this is ready. |
Thank you! |
@daviddrysdale how do I use the conversion tool to generate a |
I tweaked RustCrypto/utils#280 to use curve names (rather than just
should work. However, when I add a test to |
It may be that there are test vectors that aren't low-S normalized. |
@tarcieri |
The |
It could be a bit hard to discover, no? Also I couldn't find any mention of the normalization requirement in the docs (at least on the verification methods). This behavior may be quite surprising for users not familiar with malleability. Even worse, it may result in rejection of signatures valid in some areas (e.g. DSA for electronic document management). |
It should probably be mentioned in the documentation. However, it doesn't really come up in practice, because secp256k1 is used almost exclusively for cryptocurrency applications and low-S normalization is ubiquitous in those applications. |
Ah, so this behavior is defined on the elliptic curve crate level? (I thought |
It's really a property of the secp256k1 ecosystem specifically in relation to signatures being consensus critical and therefore needing to be non-malleable. Pretty much every other library that specializes in ECDSA/secp256k1 has adopted the same rules for this reason. It would be odd for an ECDSA/secp256k1 library to do anything else, IMO (e.g. OpenSSL does not enforce these rules, and for that reason practically nothing uses OpenSSL in cryptocurrency applications anymore). |
There are a few other applications for other signature algorithms where it might be interesting to have a sort of separate set of "consensus critical validation" rules, such as the ZIP-215 rules for Ed25519 verification. But really it doesn't make sense for an ECDSA/secp256k1 library to make it more difficult to discover how to perform non-malleable verification, IMO. I'd worry about it subtly introducing malleability bugs if a user has to go out of their way to discover them. |
Exactly. IIUC with current approach users can introduce malleability bugs by using curves which are less traditional for consensus critical applications. And having different curves behave differently in this regard, only makes the matter worse. By having two separate methods, they would at least learn about malleability and think a bit about which variant do they need in their application. |
That's something that really needs to get spec'd and added to the verification rules for a particular application, IMO. As it were though, it's a good point: I did think of an application where someone is trying to do this with P-256 and they didn't incorporate such rules. |
Yep, looks that way.
Adding that leads to all cases passing except two – rough code at #384 |
Created from:
https://github.com/google/wycheproof/blob/2196000605e45d91097147c9c71f26b72af58003/testvectors/ecdsa_secp256r1_sha256_test.json