Skip to content

Commit 4ffb2a1

Browse files
committed
crypto: runtime-deprecate default shake128/256 output lengths
1 parent c4169cb commit 4ffb2a1

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

doc/api/deprecations.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4065,6 +4065,9 @@ The [`util.types.isNativeError`][] API is deprecated. Please use [`Error.isError
40654065

40664066
<!-- YAML
40674067
changes:
4068+
- version: REPLACEME
4069+
pr-url: https://github.com/nodejs/node/pull/00000
4070+
description: Runtime deprecation.
40684071
- version: v24.4.0
40694072
pr-url: https://github.com/nodejs/node/pull/58942
40704073
description: Documentation-only deprecation with support for `--pending-deprecation`.

lib/internal/crypto/hash.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ const {
3434
lazyDOMException,
3535
normalizeEncoding,
3636
encodingsMap,
37-
isPendingDeprecation,
3837
getDeprecationWarningEmitter,
3938
} = require('internal/util');
4039

@@ -80,7 +79,6 @@ const maybeEmitDeprecationWarning = getDeprecationWarningEmitter(
8079
undefined,
8180
false,
8281
(algorithm) => {
83-
if (!isPendingDeprecation()) return false;
8482
const normalized = normalizeAlgorithm(algorithm);
8583
return normalized === 'shake128' || normalized === 'shake256';
8684
},

src/crypto/crypto_hash.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ void Hash::OneShotDigest(const FunctionCallbackInfo<Value>& args) {
251251
} else if (output_length == 0) {
252252
// This is to handle OpenSSL 3.4's breaking change in SHAKE128/256
253253
// default lengths
254+
// TODO(@panva): remove this behaviour when DEP0198 is End-Of-Life
254255
const char* name = OBJ_nid2sn(EVP_MD_type(md));
255256
if (name != nullptr) {
256257
if (strcmp(name, "SHAKE128") == 0) {
@@ -379,6 +380,9 @@ bool Hash::HashInit(const EVP_MD* md, Maybe<unsigned int> xof_md_len) {
379380
}
380381

381382
md_len_ = mdctx_.getDigestSize();
383+
384+
// This is to handle OpenSSL 3.4's breaking change in SHAKE128/256
385+
// default lengths
382386
// TODO(@panva): remove this behaviour when DEP0198 is End-Of-Life
383387
if (mdctx_.hasXofFlag() && !xof_md_len.IsJust() && md_len_ == 0) {
384388
const char* name = OBJ_nid2sn(EVP_MD_type(md));

test/parallel/test-crypto-default-shake-lengths-oneshot.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Flags: --pending-deprecation
21
'use strict';
32

43
const common = require('../common');

test/parallel/test-crypto-default-shake-lengths.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Flags: --pending-deprecation
21
'use strict';
32

43
const common = require('../common');

0 commit comments

Comments
 (0)