-
Notifications
You must be signed in to change notification settings - Fork 30k
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
test: openssl 3.4 compatibility #56294
base: main
Are you sure you want to change the base?
Conversation
OpenSSL 3.4 has intentionally broken EVP_DigestFinal for SHAKE128 and SHAKE256 when OSSL_DIGEST_PARAM_XOFLEN is not set because a) the default length used weakened them from their maximum strength and b) a static length does not fully make sense for XOFs (which SHAKE* are). Unfortunately, while crypto.createHash accepts an option argument that can be something like `{ outputLength: 128 }`, crypto.hash doesn't offer a similar API. Therefore there is little choice but to skip the test completely for shake128 and shake256 on openssl >= 3.4. Fixes: nodejs#56159 Refs: openssl/openssl@b911fef Refs: openssl/openssl@ad3f28c
…ilure According to RFC 8446 (TLS 1.3), a PSK binder validation failure should result in decrypt_error rather than illegal_parameter which openssl had been using. Update the tests to match openssl's fix. Refs: openssl/openssl@02b8b7b Refs: https://www.rfc-editor.org/rfc/rfc8446
const digestFromString = crypto.hash(method, input.toString(), outputEncoding); | ||
assert.deepStrictEqual(digestFromString, oldDigest, | ||
`different result from ${method} with encoding ${outputEncoding}`); | ||
if (method !== 'shake128' && method !== 'shake256' || !common.hasOpenSSL(3, 4)) { |
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.
nit: I think it would be more readable to filter them above, with a comment explaining why.
// As of OpenSSL 3.4.0, shake128 and shake256 methods are not supported because…
const methods = crypto.getHashes().filter(
common.hasOpenSSL(3, 4) ?
method => method !== 'shake128' && method !== 'shake256' :
() => true,
);
In any case, we should move the check to outside the inner loop.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #56294 +/- ##
=======================================
Coverage 88.53% 88.54%
=======================================
Files 657 657
Lines 190285 190285
Branches 36535 36536 +1
=======================================
+ Hits 168470 168485 +15
+ Misses 14991 14976 -15
Partials 6824 6824 |
This PR fixes two issues in the testsuite caused by changes in openssl 3.4:
In addition to #56160 , this should fix
the build of nodejs with openssl 3.4 for Ubuntu 25.04 (Plucky).