odin-lang / Odin

Odin Programming Language
https://odin-lang.org
BSD 3-Clause "New" or "Revised" License
6.6k stars 576 forks source link

core/crypto: Test against test vectors from wycheproof #3382

Open Yawning opened 5 months ago

Yawning commented 5 months ago

While core/crypto has test cases lifted from various sources, there is always room for improvement, and testing the various primitives against the test vectors from the wycheproof collection would be nice to have, especially to catch the extremely subtle implementation errors, and edge-cases that are possible in the harder to implement primitives (ECC, RSA, etc).

I was/will probably do this at some point, but my bandwidth is limited, and this would be a good first project for someone.

If someone wants to tackle this before I get to it, please ask me questions about it if any arise.

Yawning commented 5 months ago

I'm slowly working on this in a private repo.

Unfortunately BLAKE2, MD5, Keccak, and TupleHash don't have wycheproof artifacts, but I'm largely interested in this for ECC, AES, RSA.

Yawning commented 5 months ago

This covers everything currently in core/crypto that has corresponding wycheproof test cases:

Notes:

Yawning commented 5 months ago

The corpus of test vectors is rather large, and I wrote this as a stand-alone executable rather than using core:testing (which can be changed), so this could be ran from a CI workflow so that people aren't forced to checkout the test vector repo.

The compiler also intermittently segfaulted when building the binary, but short of "it happened, but when I re-ran the build" I don't have futher information.