awslabs / aws-c-cal

Aws Crypto Abstraction Layer: Cross-Platform, C99 wrapper for cryptography primitives.
Apache License 2.0
33 stars 36 forks source link

Stop using memset(), use byte-buf helper function instead. #154

Closed graebm closed 12 months ago

graebm commented 12 months ago

Issue: Found a bug when importing a private EC key on Apple. We intended to zero-out the public key data, but accidentally left it filled with uninitialized data. Apple ignored the public key data anyway, so it doesn't really matter, but this cleans things up.

Description of Changes: Replace all uses of memset() in aws-c-cal with aws_byte_buf_write_u8_n() helper function. Only 1 memset() call had the bug, but clean them all up anyway.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.