]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
evp_test: add a ctx dup operation to the KDF tests
authorPauli <pauli@openssl.org>
Mon, 24 Jan 2022 05:17:25 +0000 (16:17 +1100)
committerPauli <pauli@openssl.org>
Tue, 1 Feb 2022 05:17:16 +0000 (16:17 +1100)
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/17572)

test/evp_test.c

index 34caec2c5d90748fb27e504cab5801fd906c5777..5e106c64f099e3af76514ba0b2cd7ceb7d1c6940 100644 (file)
@@ -2690,6 +2690,7 @@ static int kdf_test_run(EVP_TEST *t)
     KDF_DATA *expected = t->data;
     unsigned char *got = NULL;
     size_t got_len = expected->output_len;
+    EVP_KDF_CTX *ctx;
 
     if (!EVP_KDF_CTX_set_params(expected->ctx, expected->params)) {
         t->err = "KDF_CTRL_ERROR";
@@ -2699,6 +2700,10 @@ static int kdf_test_run(EVP_TEST *t)
         t->err = "INTERNAL_ERROR";
         goto err;
     }
+    if ((ctx = EVP_KDF_CTX_dup(expected->ctx)) != NULL) {
+        EVP_KDF_CTX_free(expected->ctx);
+        expected->ctx = ctx;
+    }
     if (EVP_KDF_derive(expected->ctx, got, got_len, NULL) <= 0) {
         t->err = "KDF_DERIVE_ERROR";
         goto err;