Skip to content

Commit

Permalink
Fix: Use buffer without memory allocation (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
alfred2g authored Mar 5, 2024
1 parent 82f64a7 commit 314fc55
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions source/windows/bcrypt_aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,12 @@ static void s_clear_reusable_components(struct aws_symmetric_cipher *cipher) {
}

aws_byte_buf_secure_zero(&cipher_impl->overflow);
aws_byte_buf_secure_zero(&cipher_impl->working_mac_buffer);
/* windows handles this, just go ahead and tell the API it's got a length. */
cipher_impl->working_mac_buffer.len = AWS_AES_256_CIPHER_BLOCK_SIZE;

if (cipher_impl->working_mac_buffer.capacity != 0) {
aws_byte_buf_secure_zero(&cipher_impl->working_mac_buffer);
/* windows handles this, just go ahead and tell the API it's got a length. */
cipher_impl->working_mac_buffer.len = AWS_AES_256_CIPHER_BLOCK_SIZE;
}
}

static int s_reset_cbc_cipher(struct aws_symmetric_cipher *cipher) {
Expand Down

0 comments on commit 314fc55

Please sign in to comment.