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

Use more robust constant-flow idioms for padding checking #3472

Closed
mpg opened this issue Jul 1, 2020 · 0 comments · Fixed by #3638
Closed

Use more robust constant-flow idioms for padding checking #3472

mpg opened this issue Jul 1, 2020 · 0 comments · Fixed by #3638

Comments

@mpg
Copy link
Contributor

mpg commented Jul 1, 2020

Decryption/authentication of (D)TLS record encrypted with legacy CBC (that is CBC without EtM) includes checking the validity of the padding without leaking information about it, to avoid the Lucky 13 attack.

Currently this is done with code that looks constant-flow at the C level, but relies on arithmetic operators such as <= and *. Unfortunately, experience shows that some compilers translate even == using branches on some targets, which using only bit operations is usually more robust. A variety of idioms is documented for common operations.

This task is to modify in-place the existing padding checking code in ssl_decrypt_buf() to use only bit operations everywhere.

This may involve defining helper functions. In the development branch, helper function that may be of general use may be shared in a private module (declared in a header under library/). In the LTS branches since there is no such facility, those helper functions can just be static in ssl_tls.c.

Note: this task has a dependency on #3469, as we don't want to modify ssl_decrypt_buf() without negative tests.

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

Successfully merging a pull request may close this issue.

3 participants