aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/modes/aead
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-07-05 20:52:57 -0400
committerJack Lloyd <[email protected]>2019-07-05 20:52:57 -0400
commitd84534c58d1268c3f6d548fc390d0368d8258ff7 (patch)
tree26647c11254b3241003f8b8d84ce93eae80fce77 /src/lib/modes/aead
parentab576a5d34bc1c7a05b821d1dbad4c2d7092afb7 (diff)
Remove another malloc+free per GCM message overhead
Diffstat (limited to 'src/lib/modes/aead')
-rw-r--r--src/lib/modes/aead/gcm/ghash.cpp7
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);
}
}