diff options
author | Jack Lloyd <[email protected]> | 2019-07-05 20:52:57 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-07-05 20:52:57 -0400 |
commit | d84534c58d1268c3f6d548fc390d0368d8258ff7 (patch) | |
tree | 26647c11254b3241003f8b8d84ce93eae80fce77 /src/lib | |
parent | ab576a5d34bc1c7a05b821d1dbad4c2d7092afb7 (diff) |
Remove another malloc+free per GCM message overhead
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/modes/aead/gcm/ghash.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/modes/aead/gcm/ghash.cpp b/src/lib/modes/aead/gcm/ghash.cpp index 64a9b7221..8b8d3e337 100644 --- a/src/lib/modes/aead/gcm/ghash.cpp +++ b/src/lib/modes/aead/gcm/ghash.cpp @@ -129,9 +129,10 @@ void GHASH::ghash_update(secure_vector<uint8_t>& ghash, if(final_bytes) { - secure_vector<uint8_t> last_block(GCM_BS); - copy_mem(last_block.data(), input + full_blocks * GCM_BS, final_bytes); - gcm_multiply(ghash, last_block.data(), 1); + uint8_t last_block[GCM_BS] = { 0 }; + copy_mem(last_block, input + full_blocks * GCM_BS, final_bytes); + gcm_multiply(ghash, last_block, 1); + secure_scrub_memory(last_block, final_bytes); } } |