-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix Testing Ascon-128 encryption FAIL | File: D:\LibAscon-master\tst\test_aead128_dec.c:343 | Test case: test_decrypt_offline | Ctr: 1024 #1
Comments
Hi @BreezyEvening. Thanks for submitting the bug report. With a quick check I'm unable to reproduce this. All testcases are passing on my side and so are on the CI pipeline on the master branch on 3 OS types. The develop branch is currently experimental (and I have little time to work on it). A few questions before I can start digging deeper:
With this info I might know enough to start debugging. I cannot promise anything, I am short on time at the moment. |
When I execute test_encrypt_offline in test_aead128_enc.c,the 1024th test case fails every time(test case is in aead128.txt, _Count = 1024). While this process read testcase.ciphertext from aead128.txt into structure vecs_aead_t::ciphertext, the function fscan_variable_hexbytes(in vectors.c) will overwrite the next field(vecs_aead_t::key) causing this error. original source code:
} after my fix, this test case(_Count = 1024) is OK. static vecs_err_t fscan_variable_hexbytes(FILE* const handle,
} |
Hi @BreezyEvening. Thanks for the additional info. I'm still unable to reproduce the bug. On my side the encryption works as expected with and without your fix. I'll need some more time to find out what is going on. Can you please also provide the following?
|
When I execute offline testing cases of
test_encrypt_offline
in thetest_aead128_encryption
, the 1024th test case fails every time. I discovered that once the length of the_CT
field is greater than 46, this problem will occur. I located this problem and foundvecs_aead_next
in thetest_encrypt_offline
, after executingfscan_ciphertext
, the first two bytes oftestcase.key
will be overwritten to 0, causing the key to be modified, resulting in an error in the generated ciphertext. This issue is due tovecs_aead_t
. The length of the ciphertext field in the structurevecs_aead_t
is 48. Once it overflows, it will overwrite the next field (key
), causing this error.To address this issue from the root cause, this modification method is to fix
fsca_variable_hexbytes
, so the bytes are modified by not immediately filling the read ciphertext into bytes afterfscanf
, but by first caching the read 1-byte ciphertext and ensuring that the last byte of the ciphertext is read before writing the data to bytes.Source original is:
Source after fix is:
The text was updated successfully, but these errors were encountered: