ciphers/chacha20,poly1303: Fix two coverity errors
authorDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Sun, 20 Oct 2019 11:10:38 +0000 (13:10 +0200)
committerDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Sun, 20 Oct 2019 21:58:05 +0000 (23:58 +0200)
CID 14548721454873:  Incorrect expression  (SIZEOF_MISMATCH)

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

providers/implementations/ciphers/cipher_chacha20.c
providers/implementations/ciphers/cipher_chacha20_poly1305.c

index 7cc57e7043d3773e5f3a02cef41c27005640e037..d92fa08d0c291a27056158f075c3f920382c5ce7 100644 (file)
@@ -55,7 +55,7 @@ static void chacha20_freectx(void *vctx)
     PROV_CHACHA20_CTX *ctx = (PROV_CHACHA20_CTX *)vctx;
 
     if (ctx != NULL) {
-        OPENSSL_clear_free(ctx, sizeof(ctx));
+        OPENSSL_clear_free(ctx, sizeof(*ctx));
     }
 }
 
index cc702cb8fcc18a3f2f84d7bffbeed2d983e086f9..b92d8d545eeefff6ae96f589194621e2ba470798 100644 (file)
@@ -66,7 +66,7 @@ static void chacha20_poly1305_freectx(void *vctx)
     PROV_CHACHA20_POLY1305_CTX *ctx = (PROV_CHACHA20_POLY1305_CTX *)vctx;
 
     if (ctx != NULL)
-        OPENSSL_clear_free(ctx, sizeof(ctx));
+        OPENSSL_clear_free(ctx, sizeof(*ctx));
 }
 
 static int chacha20_poly1305_get_params(OSSL_PARAM params[])