-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
The CTR test does not test decryption #78
Comments
Hi @amosnier - When I uploaded the CTR-mode test code, I was pondering how long before someone would comment on that :D The intuitive thing would be to decrypt the cipher text and check for equivalence with the plain text. However, in the NIST test-vectors from 800-38A the test-vectors are equal for encryption and decryption. Same input and output to test both encryption and decryption. I have done a lot more testing than what is in The test-code is meant to be a quick way for users to verify against the NIST vectors. Thanks again for pointing this out :) |
Hi @kokke , Thanks for your answer. I realize that you are right when checking again SP 800-38A. The test strings are inverted between Encrypt and Decrypt, but so are the field names "Cyphertext" and "Plaintext". :-) Not so intuitive. Anyway, thanks again. Best regards, Alain Mosnier |
Hi @amosnier - yeah that surprised me as well when I implemented the test code :) |
Hi,
In the CTR test (test.c), the
test_xcrypt_ctr()
function is invoked twice, once for encryption, once for decryption. However, the only difference between both invocations is the printed string, not the transformed data. Both invocations transform thein
buffer and verify that the result is equal to theout
buffer. Instead, the second invocation should transform (decrypt) theout
buffer, and verify that the result is equal to thein
buffer.The change in code to achieve that is trivial, and fortunately, that test too passes on my old 16-bit DSP. :-)
Thanks again for sharing.
Best regards,
Alain Mosnier
The text was updated successfully, but these errors were encountered: