-
Notifications
You must be signed in to change notification settings - Fork 212
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
aead: tweak dev
module and add DummyAead
tests
#1802
Conversation
It would also be good to have tests for both cases of length mismatches in the input and output buffer (i.e. input smaller than output, output smaller than input), especially since those error cases didn't exist in the old API |
What methods do you mean? |
|
||
let res = match status { | ||
[0] => $crate::dev::run_fail_test(&cipher, nonce, aad, ct), | ||
[1] => $crate::dev::run_pass_test(&cipher, nonce, aad, pt, ct), |
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.
Note that the failing test ignores plaintext. Maybe it's worth to introduce two separate macros for successful and failing tests? In other words, we would store passing and failing vectors in separate files:
aead::new_pass_test!(my_aead_pass, "my_aead_pass", MyAead);
aead::new_fail_test!(my_aead_fail, "my_aead_fail", MyAead);
dev
moduledev
module and add DummyAead
tests
let tag: &Tag<C> = tag.try_into().expect("tag has correct length"); | ||
|
||
// Fill output buffer with "garbage" to test that its data does not get read during encryption | ||
let mut buf: alloc::vec::Vec<u8> = (0..pt.len()).map(|i| i as u8).collect(); |
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.
not every consumer use the aead::new_test
(at least deoxys and ascon-aead does not) this is why the MockBuffer
was made available in #1797
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.
You can leave the ascon test as-is for now. We should migrate them to new_test
either way. The current approach with the huge number of testing functions is slow and unwieldy.
Tests the inout methods and moves test vector code outside of the macro.