Skip to content

Commit a5dbbe4

Browse files
committed
doc: warn about short GCM tags visibly
As was pointed out by Félix Charette (@Sideni), the existing runtime deprecation warning may not provide enough visibility of the underlying issue. This commit adds a (not so pretty) warning to the documentation of the relevant API function `setAuthTag()`. The warning will be removed when `DEP0182` will be moved to End-of-Life status, presumably with the next major release. Refs: #52327 Refs: #17523
1 parent 05f8772 commit a5dbbe4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

doc/api/crypto.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,14 @@ for `CCM` mode or before [`decipher.final()`][] for `GCM` and `OCB` modes and
962962
`chacha20-poly1305`.
963963
`decipher.setAuthTag()` can only be called once.
964964

965+
Because the `node:crypto` module was originally designed to closely mirror
966+
OpenSSL's behavior, this function permits short GCM authentication tags unless
967+
an explicit authentication tag length was passed to
968+
[`crypto.createDecipheriv()`][] when the `decipher` object was created. This
969+
behavior is deprecated and subject to change (see [DEP0182][]). <strong class="critical">In the meantime, applications should either set the
970+
`authTagLength` option when calling `createDecipheriv()` or check the actual
971+
authentication tag length before passing it to `setAuthTag()`.</strong>
972+
965973
When passing a string as the authentication tag, please consider
966974
[caveats when using strings as inputs to cryptographic APIs][].
967975

@@ -6508,6 +6516,7 @@ See the [list of SSL OP Flags][] for details.
65086516
[CVE-2021-44532]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44532
65096517
[Caveats]: #support-for-weak-or-compromised-algorithms
65106518
[Crypto constants]: #crypto-constants
6519+
[DEP0182]: deprecations.md#dep0182-short-gcm-authentication-tags-without-explicit-authtaglength
65116520
[FIPS module configuration file]: https://www.openssl.org/docs/man3.0/man5/fips_config.html
65126521
[FIPS provider from OpenSSL 3]: https://www.openssl.org/docs/man3.0/man7/crypto.html#FIPS-provider
65136522
[HTML 5.2]: https://www.w3.org/TR/html52/changes.html#features-removed

0 commit comments

Comments
 (0)