crypto: deprecate implicitly shortened GCM tags

This introduces a doc-only deprecation of using GCM authentication tags
that are shorter than the cipher's block size, unless the user specified
the authTagLength option.

Refs: https://github.com/nodejs/node/issues/52327
PR-URL: https://github.com/nodejs/node/pull/52345
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Tobias Nießen authored and GitHub committed 2024-04-10 08:16:33 +00:00
1 parent c82f3c9e80
commit 8f61b658de
6 files changed
+107 -2

No files matched your search

+2 -2
View File
@@ -659,12 +659,12 @@ function _expectWarning(name, expected, code) {
expected = [[expected, code]];
} else if (!Array.isArray(expected)) {
expected = Object.entries(expected).map(([a, b]) => [b, a]);
} else if (!(Array.isArray(expected[0]))) {
} else if (expected.length !== 0 && !Array.isArray(expected[0])) {
expected = [[expected[0], expected[1]]];
}
// Deprecation codes are mandatory, everything else is not.
if (name === 'DeprecationWarning') {
expected.forEach(([_, code]) => assert(code, expected));
expected.forEach(([_, code]) => assert(code, `Missing deprecation code: ${expected}`));
}
return mustCall((warning) => {
const expectedProperties = expected.shift();