Skip to content

aead: split new_test! into new_pass_test! and new_fail_test! #1803

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

newpavlov
Copy link
Member

@newpavlov newpavlov commented Mar 21, 2025

This split allows us to skip the pass flags and storing plaintext for failing vectors which gets ignored by run_fail_test.

Unfortunately, this change means that we need to re-generate blb files in downstream crates. (I do not plan to merge this until I generate the new files)

@newpavlov newpavlov requested a review from tarcieri March 21, 2025 16:25
@tarcieri
Copy link
Member

I don’t understand what this PR is supposed to accomplish

@newpavlov
Copy link
Member Author

newpavlov commented Mar 21, 2025

Primarily to remove the redundant plaintext field from test vectors which should fail on decryption and to make the passing tests macro a bit simpler. It also would make it easier to see which implementations have failing test vectors and which do not.

@tarcieri
Copy link
Member

Okay, it would be good to have an open PR to AEADs with all of the test vectors converted prior to merging this, so as not to further add to that repo being out-of-sync with this one

@tarcieri
Copy link
Member

tarcieri commented Mar 30, 2025

If we retain the current test vectors as opposed to the change in this PR, we can add a check that the output buffer does not match the plaintext on decryption failure, which would've caught the bugs in aes-gcm and ascon-aead

@newpavlov
Copy link
Member Author

newpavlov commented Mar 30, 2025

I think after we make the final decision on RustCrypto/AEADs#660, we should test it accordingly as part of the test macros, i.e. on decryption failure output buffer must be equal to ciphertext (or fully zeroized). I plan to implement it in a separate PR.

@tarcieri
Copy link
Member

If you do something other than returning the ciphertext, then we would need to change all of the two-pass implementations which abort early to mutate the buffer instead to make the test pass in that case, which I would consider undesirable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants