-
Notifications
You must be signed in to change notification settings - Fork 11
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
Test kem interface against KATs #38
Conversation
src/lib.rs
Outdated
|
||
std::thread::Builder::new() | ||
.stack_size(10 * 1024 * 1024) | ||
.spawn(|| { |
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.
concerning the thread stack size increase, I attempted to write a small wrapper function using generics in order to just wrap the three KEM function calls and not the other code, however could not get it to work out, maybe you have some suggestions to fix that:
fn increase_stack_size_wrapper<F: Fn() -> R + Send>(function: F) {
std::thread::Builder::new()
.stack_size(10 * 1024 * 1024)
.spawn(|| {
function
})
.unwrap()
.join()
.unwrap();
}
To provide a bit more context: the problem seems to be with setting the Result
type of the generic function, since it needs to implement Box<dyn error::Error>>
aswell as Send + Sync
🤔
…nor/classic-mceliece into feature/test-kem-interface-vs-KATs
• dependencies are imported often w.r.t. some feature guards • the use of dependency functionality is also feature guarded • these should be the same set of feature guards
The updated version exposes the same API and runs the same set of tests, but the tests have been moved to separate modules. According to semver-checks, no API breakage was found after running: cargo semver-checks --only-explicit-features --baseline-rev main --baseline-features mceliece348864 --current-features mceliece348864 Sadly, we cannot move these tests into the tests/ directory, because the public API does not expose functionality like "fn verify". As such, we cannot use verify from files in tests/. Even if we migrate "fn verify" to tests/, there is still AesState. Since AesState is used in so many place, we can only migrate the tests to tests/ by code duplication (which I do not want to do). Furthermore: • Address TestData with `TestData` after an `use` statement instead of `crate::TestData` to make it easier to move TestData around • a lot of feature guard fixes • KATKEM tests pass for me with "ulimit -s 12048", but if you additionally pass feature="alloc" now, the public key will end up on the heap instead of the stack now. • I ran all tests in all configurations and made sure no performance regressions occur.
All my performance and correctness tests passed now. My final latest commit tries to move out test functionality from Recognize that
|
I found one more cleanup: if there is a module-level feature guard, I remove the corresponding local feature guards. This makes the source code less redundant. No semantic difference are given. |
b293955
to
81cb9fc
Compare
81cb9fc
to
4045c08
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.
Thanks for catching the mceliece8192128f bug. Not sure how it slipped through.
No worries, I'm glad I could find it :) |
…nor/classic-mceliece into feature/test-kem-interface-vs-KATs
this PR aims to close #37
kem
feature inside the already existing functions of creating & verifying request/response files, augmenting theTestcase
struct, without duplicating much code.The consequences are that the test function needs to run with increased stack size & that I had to refactor out the
katkem.rs
functionality intolib.rs
plus change the bash script which calls the test functionsI'm not quite sure if this is a great choice, however I couldn't achieve the desired
kem
testing otherwise since it's functions are private and feature restricted inlib.rs
TODO: update readme md5 hashes, and section about katkem