Skip to content

Commit 4584a10

Browse files
committed
crypto: move DEP0182 to runtime deprecation
This introduces a runtime deprecation for using GCM authentication tags that are shorter than the cipher's block size, unless the user specified the authTagLength option. This behavior has been doc-only deprecated since 8f61b65. Refs: nodejs#52327 Refs: nodejs#52345
1 parent c1bbc5d commit 4584a10

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

doc/api/crypto.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -3078,10 +3078,9 @@ and initialization vector (`iv`).
30783078
The `options` argument controls stream behavior and is optional except when a
30793079
cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the
30803080
`authTagLength` option is required and specifies the length of the
3081-
authentication tag in bytes, see [CCM mode][]. In GCM mode, the `authTagLength`
3082-
option is not required but can be used to restrict accepted authentication tags
3083-
to those with the specified length.
3084-
For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
3081+
authentication tag in bytes, see [CCM mode][].
3082+
For AES-GCM and `chacha20-poly1305`, the `authTagLength` option defaults to 16
3083+
bytes and must be set to a different value if a different length is used.
30853084

30863085
The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
30873086
recent OpenSSL releases, `openssl list -cipher-algorithms` will

doc/api/deprecations.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -3623,15 +3623,18 @@ Please use the [`crypto.createHmac()`][] method to create Hmac instances.
36233623

36243624
<!-- YAML
36253625
changes:
3626+
- version: REPLACEME
3627+
pr-url: https://github.com/nodejs/node/pull/52551
3628+
description: Runtime deprecation.
36263629
- version: REPLACEME
36273630
pr-url: https://github.com/nodejs/node/pull/52345
36283631
description: Documentation-only deprecation.
36293632
-->
36303633

3631-
Type: Documentation-only (supports [`--pending-deprecation`][])
3634+
Type: Runtime
36323635

36333636
Applications that intend to use authentication tags that are shorter than the
3634-
default authentication tag length should set the `authTagLength` option of the
3637+
default authentication tag length must set the `authTagLength` option of the
36353638
[`crypto.createDecipheriv()`][] function to the appropriate length.
36363639

36373640
For ciphers in GCM mode, the [`decipher.setAuthTag()`][] function accepts

src/crypto/crypto_cipher.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,7 @@ void CipherBase::SetAuthTag(const FunctionCallbackInfo<Value>& args) {
698698
}
699699

700700
if (mode == EVP_CIPH_GCM_MODE && cipher->auth_tag_len_ == kNoAuthTagLength &&
701-
tag_len != 16 && env->options()->pending_deprecation &&
702-
env->EmitProcessEnvWarning()) {
701+
tag_len != 16 && env->EmitProcessEnvWarning()) {
703702
if (ProcessEmitDeprecationWarning(
704703
env,
705704
"Using AES-GCM authentication tags of less than 128 bits without "

test/parallel/test-crypto-gcm-implicit-short-tag.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Flags: --pending-deprecation
21
'use strict';
32
const common = require('../common');
43
if (!common.hasCrypto)

0 commit comments

Comments
 (0)