You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The test_encrypt_ecb_verbose assumes a 128-bit key in test.c. But the overall code is made such that it would take 128, 192, 256 bits. The problem is that phex prints 16, 24, 32 bytes of data, therefore phex will print jibberish (trailing junk bytes) when we define either AES192 or AES256 and run test_encrypt_ecb_verbose(). Worse, the fixing to 128-bit key would also lead to wrong encryption. I think that subroutine should be allowed to run only when AES128 is defined.
The text was updated successfully, but these errors were encountered:
Hi @wirawan0 and thanks for your interest in this project :)
From a quick glance, you're right that phex only works correctly for 128 bit keys and that test_encrypt_ecb_verbose() doesn't work correctly for larger key sizes. The other test-functions do however. test_encrypt_ecb_verbose() should just be parameterized for different key sizes like the other test functions and all would be good (I'll gladly accept a PR ;))
I have done a lot more testing than what is in test.c and indeed encryption and decryption works as advertised even though the test-file doesn't test very thoroughly.
The test-code is meant to be a quick way for users to verify against the NIST vectors described in SP 800-38. It is not meant to convince you of correctness or robustness.
The
test_encrypt_ecb_verbose
assumes a 128-bit key intest.c
. But the overall code is made such that it would take 128, 192, 256 bits. The problem is that phex prints 16, 24, 32 bytes of data, therefore phex will print jibberish (trailing junk bytes) when we define eitherAES192
orAES256
and runtest_encrypt_ecb_verbose()
. Worse, the fixing to 128-bit key would also lead to wrong encryption. I think that subroutine should be allowed to run only whenAES128
is defined.The text was updated successfully, but these errors were encountered: