Add NIST SP 800-90A Rev. 1 DRBGs#6
Conversation
|
Thanks for the PR! Looks like quite a bit of code to look over, even as a subset of that +150 KLOCs. We're in the middle of a large release across the whole project so it might be a bit before I can look this over properly. |
|
The actual code is much smaller. Almost all the LoC are the KAT files for testing against known values. |
|
We certainly do not want to include megabytes of KAT files. Could you convert them to the blobby format? And even after conversion it may be worth to exclude or truncate some tests. |
|
Yeah that's fair, I'll have a go once I've had lunch :) |
|
Because most of the hard work is done by the hash or cipher itself, we could probably just have one or two of each test to ensure rough correctness with the spec and then check things work with various sizes / with various policies as an internal verification? Eg make sure 8 bytes is the same as asking for one u64 etc. |
|
So I wrote a small script which takes the .rsp files and passes them through blobby's encode function, this gives us significantly smaller files. if we also want to reduce the number of test cases per case that we do we can get another choose a number of the 14 tests per case instead. https://gist.github.com/tritoke/c6e90a06b9b78795943ef0548494b0d1 |
ede143f to
d5b4680
Compare
|
I've pushed up the full contents of the KATs in the blobby format now and reworked the tests to use them (apologies for the macro its a pretty hefty but hopefully well commented and readable :) This gives us ~3.7MiB of test vector files, if we took every 14th test case (one from each block of the original KAT files), it takes us down to 396KiB, obviously we could decimate further if you want. Up to you @newpavlov 👍🏻 |
|
One nice benefit is the line count now correctly shows as 2.5k not 150k 😂 |
Co-Authored-By: Giacomo Pope <giacomopope@gmail.com> Co-Authored-By: Sam Leonard <tritoke@protonmail.com>
2bc1756 to
931c194
Compare
|
Thanks for the review @baloo I've addressed all your points now :) |
This PR is a request to upstream our repo: https://github.com/tritoke/nist-drbg-rs here as nist-drbgs.