GaloisInc / cryptol-specs

A central repository for specifications of cryptographic algorithms in Cryptol
BSD 3-Clause "New" or "Revised" License
35 stars 7 forks source link

Remove duplicated versions of ECDSA and ECs #113

Closed marsella closed 2 months ago

marsella commented 3 months ago

At time of writing there are 4 implementations of the NIST prime field elliptic curves and 3 implementations of ECDSA. This is redundant and we should remove the ones that don't meet our gold standards.

Right now the closest to gold standard are the versions added in #99 and #96. We should carefully review the other versions to see if there are useful things contained in them. If possible, we should port those things to the standard versions. If not, document what we want to keep in this issue.

marsella commented 3 months ago

Primitive/Asymmetric/Signature/ECDSA/ECDSA.cry + friends The Z-type ECDSA implementation has two things that are not included in the new version:

I'm pretty sure everything else, including tests, properties, implementations, etc. are ported to the PFEC implementation. It's not used anywhere else in the repo.

marsella commented 3 months ago

Common/EC/EC_P384.cry The one-file standalone version of EC actually has some ECDSA tucked in there as well. Most of the EC operations are undefined. It uses Integers to represent field elements and scalar values. The only thing I didn't recognize were the mont_R family of functions but they don't look very complicated so if we figure out what they are I think we can rewrite them.

There is a bit of naming overlap with Signature/ecdsa.cry. This is not used anywhere else in the repo.

marsella commented 3 months ago

These are all used among each other and in Primitive/Asymmetric/Signature/ecdsa.cry. I did not find any other uses in this repo.

marsella commented 3 months ago

Primitive/Asymmetric/Signature/ecdsa.cry This is the usual ECDSA implementation, plus the test vectors from MATH-2008, plus a version of signing that looks like some Java implementation.

I think the only part that's not duplicated in PFEC is the Java imperative version. I don't know what the actual Java library is, though, and there isn't an equivalence property between the reference and the imperative version.

kiniry commented 3 months ago

The pointers I just gave you to Joe Hendrix's prior work will point you to exactly which version of BouncyCastle he formally verified, @marsella.

marsella commented 3 months ago

Thanks Joe. Collecting some notes here: