evp_test: use correct size in memory clear
authorPauli <pauli@openssl.org>
Fri, 25 Jun 2021 13:18:28 +0000 (23:18 +1000)
committerPauli <pauli@openssl.org>
Sun, 27 Jun 2021 06:12:46 +0000 (16:12 +1000)
Fixes #15917

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

test/evp_test.c

index 16b1a50c2d9e035c3ee63d865f2f9a23c2f886da..0009cae4425772251e81b428bceff4de60210280 100644 (file)
@@ -486,7 +486,7 @@ static int digest_test_run(EVP_TEST *t)
             /* This should never fail but we need the returned pointer now */
             && !TEST_ptr(inbuf = sk_EVP_TEST_BUFFER_value(expected->input, 0))
             && !inbuf->count_set) {
-        OPENSSL_cleanse(got, sizeof(got));
+        OPENSSL_cleanse(got, got_len);
         if (!TEST_true(EVP_Q_digest(libctx,
                                     EVP_MD_get0_name(expected->fetched_digest),
                                     NULL, inbuf->buf, inbuf->buflen,
@@ -1543,7 +1543,7 @@ static int mac_test_run_mac(EVP_TEST *t)
 
     /* Test the EVP_Q_mac interface as well */
     if (!xof) {
-        OPENSSL_cleanse(got, sizeof(got));
+        OPENSSL_cleanse(got, got_len);
         if (!TEST_true(EVP_Q_mac(libctx, expected->mac_name, NULL,
                                  expected->alg, params,
                                  expected->key, expected->key_len,