Skip to content

Commit bacbcdc

Browse files
panvanodejs-github-bot
authored andcommitted
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: #66413 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent aa8d6b9 commit bacbcdc

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

‎src/crypto/crypto_keys.cc‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,6 @@ KeyObjectData::KeyObjectData(std::nullptr_t)
10531053

10541054
KeyObjectData::KeyObjectData(ByteSource symmetric_key)
10551055
: key_type_(KeyType::kKeyTypeSecret),
1056-
mutex_(std::make_shared<Mutex>()),
10571056
data_(std::make_shared<Data>(std::move(symmetric_key))) {}
10581057

10591058
KeyObjectData::KeyObjectData(KeyType type, EVPKeyPointer&& pkey)

0 commit comments

Comments
 (0)