-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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: expose OPENSSL_IS_BORINGSSL constant #38928
base: main
Are you sure you want to change the base?
crypto: expose OPENSSL_IS_BORINGSSL constant #38928
Conversation
Should this be documented in https://nodejs.org/api/crypto.html#crypto_crypto_constants_1? |
Yes, but to be fair, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be the only definition of OPENSSL_IS_BORINGSSL
, at least on the master branch:
#define OPENSSL_IS_BORINGSSL
#define OPENSSL_VERSION_NUMBER 0x1010107f
#define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
If that's the definition that would be picked up here, OPENSSL_IS_BORINGSSL
is not a constant but rather a feature test macro, and this change would lead to compilation errors when using BoringSSL. (Or is there a different definition of OPENSSL_IS_BORINGSSL
somewhere?)
It might make sense to simply assign true
to the constant if the macro is defined, and to leave it undefined otherwise. (But then it doesn't really reflect the macro, so we might as well use a different name.)
@tniessen what do you think you'd prefer? |
@codebytere Maybe I am missing something and this does work in Electron? I don't have an Electron setup locally so I can't test that. But if I am right and this doesn't work, the simplest solution is probably to just assign the value |
FWIW #27862 and the changes we've had to make to tests re. key sizes and algorithms to account for FIPS/OpenSSL 3.0 leads me to question if there's a better way to decide algorithm test support in our tests. |
@tniessen yes this works for Electron as-is! |
@codebytere What value does This definition assigns no value to |
@tniessen sorry for late reply but your link above is correct - it's not assigned a value. The compiler will look for the |
@codebytere That's my understanding as well. But if Say we pass this snippet to // Definition in BoringSSL:
#define OPENSSL_IS_BORINGSSL
// This PR:
#ifdef OPENSSL_IS_BORINGSSL
NODE_DEFINE_CONSTANT(target, OPENSSL_IS_BORINGSSL);
#endif After preprocessing, because NODE_DEFINE_CONSTANT(target, );
Lines 607 to 623 in 13b569c
Still, within the macro, I tried compiling node with this patch and an additional
|
This PR has multiple approvals and you said it works in Electron as is, so I really don't want to block it. I'd just like to understand how this works since we don't currently test building against BoringSSL within Node.js :) |
This PR exposes a constant
OPENSSL_IS_BORINGSSL
, which could then be used from JS like:and will then allow Electron to control algorithm test support more granularly and also open the door to better adapting Node.js' own crypto tests to fail less for us.