-
Notifications
You must be signed in to change notification settings - Fork 93
[WIP] feature(rosenpass): integrate assert_tv and derandomize protocol.rs #604
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
base: main
Are you sure you want to change the base?
Conversation
Fix nix configuration
Remove feature tv Stream-line integration of test-vectors further: Now cargo test --all-features should work Switched to released assert_tv version
I had noticed that the rosenpass CI uses I have fixed this design error by removing the requirement to add a feature as a client of
This let to a more streamlined integration elsewhere as well and many |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #604 +/- ##
=======================================
Coverage ? 88.22%
=======================================
Files ? 102
Lines ? 12734
Branches ? 240
=======================================
Hits ? 11235
Misses ? 1496
Partials ? 3 ☔ View full report in Codecov by Sentry. |
I'm not familiar with |
Here is a WIP solution to integrate the assert_tv crate and derandomize the protocol.rs module.
This PR is mainly meant as a starting point to explore how to make derandomization as non-disruptiv as possible and also not clutter the entire code-base with
#cfg[ ]
macros and feature flags.The way derandomization would work is with the help of 3 macros:
#[test_vec(..)]
: proc macro that wraps a test and sets up a test_vec environment, which is stored and later accessed through thread-local storage, and finilizes it at the end.tv_const!(..)
: macro that defines a constant value in the test vector. When test vectors are initialized, these values are serialized from the observed runtime values. When test vectors are checked, these values are loaded and injected at runtime and replace random variables.tv_output!(..)
: macro that checks a result with the one found in the test vector. When test vectors are initialized, these values are also serialized from the observed runtime values. In contrast, when test vectors are checked, the runtime values are compared with the values loaded from the test vector file. If they don't match it will error.Here is a
test_vec
test: crypto_server_test_vectors.rsYou may run this test with the following command
Test vectors are frozen as files and checked into the repository. For example: crypto_server_test_vector_1.json
You may run this test in
init
mode (by setting an env variable) to overwrite the values stores in this test vector file:Let me know what you think about the proposal, what you like to see improved or changed, or if you have any questions.