Skip to content

Commit

Permalink
Fix incorrect key scrubbing
Browse files Browse the repository at this point in the history
  • Loading branch information
achamayou committed Nov 3, 2023
1 parent 7aed19e commit f6b07de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/js/crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ namespace ccf::js
std::vector<uint8_t> wrapped_key =
crypto::ckm_aes_key_wrap_pad(privateKey, {key, key + key_size});

OPENSSL_cleanse(&privateKey, sizeof(privateKey));
OPENSSL_cleanse(privateKey.data(), privateKey.size());

return JS_NewArrayBufferCopy(
ctx, wrapped_key.data(), wrapped_key.size());
Expand Down Expand Up @@ -738,7 +738,7 @@ namespace ccf::js
std::vector<uint8_t> unwrapped_key =
crypto::ckm_aes_key_unwrap_pad(privateKey, {key, key + key_size});

OPENSSL_cleanse(&privateKey, sizeof(privateKey));
OPENSSL_cleanse(privateKey.data(), privateKey.size());

return JS_NewArrayBufferCopy(
ctx, unwrapped_key.data(), unwrapped_key.size());
Expand Down

0 comments on commit f6b07de

Please sign in to comment.