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.
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.
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.
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.