-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
boringcrypto: SHA functions do not use FIPS compliant openssl APIs #66520
Comments
CC @golang/security |
Go+BoringCrypto doesn't use the OpenSSL 3.0 FIPS module. Is this the case for BoringCrypto as well? |
I forgot to mention I am using the go-toolset on Redhat, but the boringcrypto code that calls into openssl is the same, and if openssl is running in FIPS mode (Redhat The redhat tool |
Also when I ran my go code that did:
like this:
Which shows it is using the FIPS module in openssl |
Ah, you are using Red Hat's fork that uses OpenSSL's module. I'm afraid we don't have the bandwidth upstream to handle issues of the downstream forks. |
@FiloSottile OK np, so the boringcrypto code in this repo does not call into openssl the same way Redhat's does? Looking at the code it seemed like an issue in the base boringcrypto so I was trying to cut out the middle man and get straight to the source as the code in this repo for the openssl C API calls for SHA are the same as in the Redhat fork. |
BoringCrypto APIs diverged a bit from OpenSSL 3.0, and the FIPS module design is very different, so I'm asking whether "SHA1_Init/SHA1_Update/SHA1_Final don't call into the FIPS engine" is true of BoringCrypto. If not, this is a downstream fork issue. |
Thanks for the explanation. I will do a bit more digging using standard go and |
boringssl only defines SHA1_Init under crypto/fipsmodule/sha |
Aaaah. My apologies and thank you both so much for your time. I see now where the standard boringcrypto/ssl and Redhat's version diverge. I was thrown as the function name |
Go version
go1.20.12
Output of
go env
in your module/workspace:What did you do?
The functions in sha.go are all using the deprecated low level API calls in openssl. These do not go via the fips provider and so are not FIPS compliant. See:
go/src/crypto/internal/boring/sha.go
Line 16 in 25aa45a
We should be doing something like:
This uses the high level EVP_ API and will be FIPS compliant. On the page (https://www.openssl.org/docs/manmaster/man7/fips_module.html):
Also see https://github.com/openssl/openssl/blob/a4cbffcd8998180b98bb9f7ce6065ed37d079d8b/doc/man7/ossl-guide-migration.pod#L1105 where openssl say not to use functions such as
SHA1_Init
etc and instead use EVP. Apparently there are some convinience functions as well..or the quick one-shot L<EVP_Q_digest(3)>
Note this bug is a follow-on from #66513 where I have removed the references about md5 that muddied the waters in the original bug report.
What did you see happen?
All covered in initial section
What did you expect to see?
All covered in initial section
The text was updated successfully, but these errors were encountered: