From bacbcdcf0ad600dcc7204ed2809af93354106a6d Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Wed, 30 Sep 2026 13:50:19 +0200 Subject: [PATCH] crypto: skip secret key mutex allocation Secret key bytes are immutable after KeyObjectData construction. AES, ChaCha20-Poly1305, MAC, and KDF jobs read those bytes without acquiring KeyObjectData::mutex(), and secret-key export and equality do the same. Do not allocate a shared mutex that none of these operations uses. Asymmetric key mutex initialization remains eager so copies continue to share the same lock while asymmetric acquisitions remain. Signed-off-by: Filip Skokan Assisted-by: Codex PR-URL: https://github.com/nodejs/node/pull/66413 Reviewed-By: James M Snell --- src/crypto/crypto_keys.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/crypto/crypto_keys.cc b/src/crypto/crypto_keys.cc index 580f9ac009d..da56f4a4e26 100644 --- a/src/crypto/crypto_keys.cc +++ b/src/crypto/crypto_keys.cc @@ -1053,7 +1053,6 @@ KeyObjectData::KeyObjectData(std::nullptr_t) KeyObjectData::KeyObjectData(ByteSource symmetric_key) : key_type_(KeyType::kKeyTypeSecret), - mutex_(std::make_shared()), data_(std::make_shared(std::move(symmetric_key))) {} KeyObjectData::KeyObjectData(KeyType type, EVPKeyPointer&& pkey)