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

crypto/aes: add generic bitsliced implementation #69025

Open
rolandshoemaker opened this issue Aug 22, 2024 · 1 comment
Open

crypto/aes: add generic bitsliced implementation #69025

rolandshoemaker opened this issue Aug 22, 2024 · 1 comment
Assignees
Labels
NeedsFix The path to resolution is known, but the work has not been done.

Comments

@rolandshoemaker
Copy link
Member

rolandshoemaker commented Aug 22, 2024

The generic pure-Go AES implementation, used when a platform lacks AES-NI hardware support, operates in variable-time. This is a (very) long running issue (see #19413, #16821, #13795, #4299, etc) which is noted in the crypto/aes package documentation.

While documented explicitly in crypto/aes, it may not be obvious to consumers of crypto/tls. In Go 1.16, we deprioritized AES ciphers on systems that lacked hardware support, but despite this there are still scenarios where users who lack AES-NI may end up negotiating AES based ciphers, resulting in usage of a variable-time implementation.

It is probably time to throw out the variable-time generic implementation, and finally add a bitsliced version. This would mean that all of our AES implementations would be constant-time, regardless of the platform. Since this was last considered there have been a slew of reasonable bitsliced implementations developed in the community, so there is a lot of prior art to consult on the best way to go about this.

We'll also need to add a constant-time GHASH implementation for AES-GCM to be constant-time. BearSSL has a novel approach to this, which spreads the bits out to avoid the need for separate carrying: https://www.bearssl.org/constanttime.html#ghash-for-gcm.

We expect bitslicing will result in reduced performance over the current generic implementation, but it seems like that is a reasonable trade-off for having full constant-time platform coverage.

cc @golang/security @FiloSottile

@rolandshoemaker rolandshoemaker added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 22, 2024
@rolandshoemaker rolandshoemaker self-assigned this Aug 22, 2024
@gabyhelp
Copy link

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants