Skip to content
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

wrong gcm computation when iv length is big enough in main branch #4884

Closed
openluopworld opened this issue Aug 19, 2021 · 2 comments · Fixed by #5213
Closed

wrong gcm computation when iv length is big enough in main branch #4884

openluopworld opened this issue Aug 19, 2021 · 2 comments · Fixed by #5213
Labels
bug component-crypto Crypto primitives and low-level interfaces help-wanted This issue is not being actively worked on, but PRs welcome.

Comments

@openluopworld
Copy link
Contributor

Summary

In the GCM cipher mode, it may be wrong in the computation of Y0 when the bit length of iv is not smaller than 232.

System information

Mbed TLS version (number or commit id):
Operating system and version:
Configuration (if not default, please attach mbedtls_config.h):
Compiler and options (if you used a pre-built binary, please indicate how you obtained it):
Additional environment information:

Expected behavior

Xi = (Xm+n) ^ (len(A) || len(C)) . H

Since the bit length of C(here is iv) can be upper to 264. So, it may be something like

PUT_UINT32_BE( iv_len * 8, work_buf, 8 )

Actual behavior

PUT_UINT32_BE( iv_len * 8, work_buf, 12 )

Steps to reproduce

Additional information

@paul-elliott-arm paul-elliott-arm self-assigned this Aug 25, 2021
@paul-elliott-arm paul-elliott-arm added Community component-crypto Crypto primitives and low-level interfaces labels Aug 25, 2021
@paul-elliott-arm paul-elliott-arm added the help-wanted This issue is not being actively worked on, but PRs welcome. label Sep 9, 2021
@paul-elliott-arm
Copy link
Member

Hi!

If you would like to submit a PR for this fix, then we would be more than happy to review it.

@paul-elliott-arm paul-elliott-arm removed their assignment Sep 10, 2021
@openluopworld
Copy link
Contributor Author

Please see #4950 and have a review.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component-crypto Crypto primitives and low-level interfaces help-wanted This issue is not being actively worked on, but PRs welcome.
Projects
None yet
3 participants