From 058c5b81cdbabe8989a194ba5d388f4c230f4af6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Tue, 18 Sep 2018 14:14:50 +0200 Subject: [PATCH] crypto: do not allow multiple calls to setAuthTag Calling setAuthTag multiple times can result in hard to detect bugs since to the user, it is unclear which invocation actually affected OpenSSL. PR-URL: https://github.com/nodejs/node/pull/22931 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ujjwal Sharma --- doc/api/crypto.md | 2 +- src/node_crypto.cc | 7 ++---- test/parallel/test-crypto-authenticated.js | 26 ++++++++++++++++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index b26e9cae04a..ecb0c8186c7 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -445,7 +445,7 @@ is invalid according to [NIST SP 800-38D][] or does not match the value of the `authTagLength` option, `decipher.setAuthTag()` will throw an error. The `decipher.setAuthTag()` method must be called before -[`decipher.final()`][]. +[`decipher.final()`][] and can only be called once. ### decipher.setAutoPadding([autoPadding])