From 7198bd1a8f44be994106d3dba4bbb3362147b144 Mon Sep 17 00:00:00 2001
From: Pauli <ppzgs1@gmail.com>
Date: Fri, 26 Feb 2021 10:56:17 +1000
Subject: [PATCH] test: update tests to allow for params argument for the
 instantiate call on EVP_RAND_CTXs

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14310)
---
 test/acvp_test.c | 2 +-
 test/drbgtest.c  | 6 +++---
 test/evp_test.c  | 7 +++----
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/test/acvp_test.c b/test/acvp_test.c
index 6d7360b5b6..dab75a8a13 100644
--- a/test/acvp_test.c
+++ b/test/acvp_test.c
@@ -1383,7 +1383,7 @@ static int drbg_test(int id)
      * A NULL personalisation string defaults to the built in so something
      * non-NULL is needed if there is no personalisation string
      */
-    if (!TEST_true(EVP_RAND_instantiate(ctx, 0, 0, (void *)"", 0))
+    if (!TEST_true(EVP_RAND_instantiate(ctx, 0, 0, (void *)"", 0, NULL))
         || !TEST_true(EVP_RAND_generate(ctx, returned_bits, returned_bits_len,
                                         0, 0, NULL, 0))
         || !TEST_true(EVP_RAND_generate(ctx, returned_bits, returned_bits_len,
diff --git a/test/drbgtest.c b/test/drbgtest.c
index 1276f726cc..07f123dce8 100644
--- a/test/drbgtest.c
+++ b/test/drbgtest.c
@@ -828,11 +828,11 @@ static int test_rand_prediction_resistance(void)
     /* Initialise a three long DRBG chain */
     if (!TEST_ptr(x = new_drbg(NULL))
         || !TEST_true(disable_crngt(x))
-        || !TEST_true(EVP_RAND_instantiate(x, 0, 0, NULL, 0))
+        || !TEST_true(EVP_RAND_instantiate(x, 0, 0, NULL, 0, NULL))
         || !TEST_ptr(y = new_drbg(x))
-        || !TEST_true(EVP_RAND_instantiate(y, 0, 0, NULL, 0))
+        || !TEST_true(EVP_RAND_instantiate(y, 0, 0, NULL, 0, NULL))
         || !TEST_ptr(z = new_drbg(y))
-        || !TEST_true(EVP_RAND_instantiate(z, 0, 0, NULL, 0)))
+        || !TEST_true(EVP_RAND_instantiate(z, 0, 0, NULL, 0, NULL)))
         goto err;
 
     /*
diff --git a/test/evp_test.c b/test/evp_test.c
index ef7ddd37fe..8c88f0937c 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -2259,16 +2259,15 @@ static int rand_test_run(EVP_TEST *t)
         *p++ = OSSL_PARAM_construct_octet_string(OSSL_RAND_PARAM_TEST_NONCE,
                                                  z, item->nonce_len);
         *p = OSSL_PARAM_construct_end();
-        if (!TEST_true(EVP_RAND_set_ctx_params(expected->parent, params))
-                || !TEST_true(EVP_RAND_instantiate(expected->parent, strength,
-                                                   0, NULL, 0)))
+        if (!TEST_true(EVP_RAND_instantiate(expected->parent, strength,
+                                            0, NULL, 0, params)))
             goto err;
 
         z = item->pers != NULL ? item->pers : (unsigned char *)"";
         if (!TEST_true(EVP_RAND_instantiate
                            (expected->ctx, strength,
                             expected->prediction_resistance, z,
-                            item->pers_len)))
+                            item->pers_len, NULL)))
             goto err;
 
         if (item->reseed_entropy != NULL) {