Properly zero cipher_data for ChaCha20-Poly1305 on cleanup
authorKazuki Yamaguchi <k@rhe.jp>
Thu, 26 Jan 2017 04:01:30 +0000 (13:01 +0900)
committerRich Salz <rsalz@openssl.org>
Thu, 16 Feb 2017 01:00:34 +0000 (20:00 -0500)
Fix a typo. Probably this has not been found because EVP_CIPHER_CTX is
smaller than EVP_CHACHA_AEAD_CTX and heap overflow does not occur.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2294)

crypto/evp/e_chacha20_poly1305.c

index 46bc2cb..7fd4f8d 100644 (file)
@@ -316,7 +316,7 @@ static int chacha20_poly1305_cleanup(EVP_CIPHER_CTX *ctx)
 {
     EVP_CHACHA_AEAD_CTX *actx = aead_data(ctx);
     if (actx)
-        OPENSSL_cleanse(ctx->cipher_data, sizeof(*ctx) + Poly1305_ctx_size());
+        OPENSSL_cleanse(ctx->cipher_data, sizeof(*actx) + Poly1305_ctx_size());
     return 1;
 }