crypto: fix crash in CCM mode without data · nodejs/node@dfe3f95 · GitHub
Skip to content

Commit dfe3f95

Browse files
committed
crypto: fix crash in CCM mode without data
Fixes: #38035 PR-URL: #38102 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 8930eba commit dfe3f95

3 files changed

Lines changed: 26 additions & 4 deletions

File tree

doc/api/crypto.md

Lines changed: 1 addition & 1 deletion

src/crypto/crypto_cipher.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -844,9 +844,9 @@ bool CipherBase::Final(AllocatedBuffer* out) {
844844
CHECK(mode == EVP_CIPH_GCM_MODE);
845845
auth_tag_len_ = sizeof(auth_tag_);
846846
}
847-
CHECK_EQ(1, EVP_CIPHER_CTX_ctrl(ctx_.get(), EVP_CTRL_AEAD_GET_TAG,
848-
auth_tag_len_,
849-
reinterpret_cast<unsigned char*>(auth_tag_)));
847+
ok = (1 == EVP_CIPHER_CTX_ctrl(ctx_.get(), EVP_CTRL_AEAD_GET_TAG,
848+
auth_tag_len_,
849+
reinterpret_cast<unsigned char*>(auth_tag_)));
850850
}
851851
}
852852

test/parallel/test-crypto-authenticated.js

Lines changed: 22 additions & 0 deletions

0 commit comments

Comments
 (0)