mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
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 <panva.ip@gmail.com> Assisted-by: Codex PR-URL: https://github.com/nodejs/node/pull/66413 Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
aa8d6b9384
commit
bacbcdcf0a
1 file changed
-1
@@ -1053,7 +1053,6 @@ KeyObjectData::KeyObjectData(std::nullptr_t)
|
||||
|
||||
KeyObjectData::KeyObjectData(ByteSource symmetric_key)
|
||||
: key_type_(KeyType::kKeyTypeSecret),
|
||||
mutex_(std::make_shared<Mutex>()),
|
||||
data_(std::make_shared<Data>(std::move(symmetric_key))) {}
|
||||
|
||||
KeyObjectData::KeyObjectData(KeyType type, EVPKeyPointer&& pkey)
|
||||
|
||||
Reference in new issue
Block a user