diff options
author | Pauli <ppzgs1@gmail.com> | 2021-03-02 13:41:24 +0100 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2021-03-11 23:27:11 +0100 |
commit | af6171b35aa4d066f6834c4fb917372b81d92489 (patch) | |
tree | 73e8b3bcc988005f601e1bfa63503ebcd91b8441 /test | |
parent | ssl: support params arguments to init functions (diff) | |
download | openssl-af6171b35aa4d066f6834c4fb917372b81d92489.tar.xz openssl-af6171b35aa4d066f6834c4fb917372b81d92489.zip |
test: support params arguments to init functions
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14383)
Diffstat (limited to 'test')
-rw-r--r-- | test/acvp_test.c | 6 | ||||
-rw-r--r-- | test/algorithmid_test.c | 2 | ||||
-rw-r--r-- | test/evp_extra_test.c | 2 | ||||
-rw-r--r-- | test/evp_libctx_test.c | 16 | ||||
-rw-r--r-- | test/evp_test.c | 6 | ||||
-rw-r--r-- | test/tls-provider.c | 7 |
6 files changed, 20 insertions, 19 deletions
diff --git a/test/acvp_test.c b/test/acvp_test.c index dab75a8a13..02ef638ddd 100644 --- a/test/acvp_test.c +++ b/test/acvp_test.c @@ -97,7 +97,7 @@ static int sig_gen(EVP_PKEY *pkey, OSSL_PARAM *params, const char *digest_name, if (!TEST_ptr(sig = OPENSSL_malloc(sz)) || !TEST_ptr(md_ctx = EVP_MD_CTX_new()) || !TEST_int_eq(EVP_DigestSignInit_ex(md_ctx, NULL, digest_name, libctx, - NULL, pkey), 1) + NULL, pkey, NULL), 1) || !TEST_int_gt(EVP_DigestSign(md_ctx, sig, &sig_len, msg, msg_len), 0)) goto err; *sig_out = sig; @@ -306,7 +306,7 @@ static int ecdsa_sigver_test(int id) ret = TEST_int_gt((sig_len = i2d_ECDSA_SIG(sign, &sig)), 0) && TEST_ptr(md_ctx = EVP_MD_CTX_new()) && TEST_true(EVP_DigestVerifyInit_ex(md_ctx, NULL, tst->digest_alg, - libctx, NULL, pkey) + libctx, NULL, pkey, NULL) && TEST_int_eq(EVP_DigestVerify(md_ctx, sig, sig_len, tst->msg, tst->msg_len), tst->pass)); err: @@ -1249,7 +1249,7 @@ static int rsa_sigver_test(int id) || !TEST_ptr(md_ctx = EVP_MD_CTX_new()) || !TEST_true(EVP_DigestVerifyInit_ex(md_ctx, &pkey_ctx, tst->digest_alg, libctx, NULL, - pkey) + pkey, NULL) || !TEST_true(EVP_PKEY_CTX_set_params(pkey_ctx, params)) || !TEST_int_eq(EVP_DigestVerify(md_ctx, tst->sig, tst->sig_len, tst->msg, tst->msg_len), tst->pass))) diff --git a/test/algorithmid_test.c b/test/algorithmid_test.c index b1b579b40d..ae7a49f54b 100644 --- a/test/algorithmid_test.c +++ b/test/algorithmid_test.c @@ -162,7 +162,7 @@ static int test_x509_sig_aid(X509 *eecert, const char *ee_filename, if (!TEST_ptr(mdctx = EVP_MD_CTX_new()) || !TEST_true(EVP_DigestVerifyInit_ex(mdctx, &pctx, OBJ_nid2sn(dig_nid), - NULL, NULL, pkey))) { + NULL, NULL, pkey, NULL))) { TEST_info("Couldn't initialize a DigestVerify operation with " "pkey type %s and hash type %s", OBJ_nid2sn(pkey_nid), OBJ_nid2sn(dig_nid)); diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c index 62840d0d19..acba9819e6 100644 --- a/test/evp_extra_test.c +++ b/test/evp_extra_test.c @@ -1888,7 +1888,7 @@ static int test_EVP_PKEY_CTX_get_set_params(EVP_PKEY *pkey) mdctx = EVP_MD_CTX_new(); if (!TEST_ptr(mdctx) || !TEST_true(EVP_DigestSignInit_ex(mdctx, NULL, "SHA1", NULL, NULL, - pkey))) + pkey, NULL))) goto err; /* diff --git a/test/evp_libctx_test.c b/test/evp_libctx_test.c index bd0ddb7371..f5d652ebc0 100644 --- a/test/evp_libctx_test.c +++ b/test/evp_libctx_test.c @@ -506,7 +506,7 @@ static int kem_rsa_gen_recover(void) ret = TEST_true(rsa_keygen(2048, &pub, &priv)) && TEST_ptr(sctx = EVP_PKEY_CTX_new_from_pkey(libctx, pub, NULL)) - && TEST_int_eq(EVP_PKEY_encapsulate_init(sctx), 1) + && TEST_int_eq(EVP_PKEY_encapsulate_init(sctx, NULL), 1) && TEST_int_eq(EVP_PKEY_CTX_set_kem_op(sctx, "RSASVE"), 1) && TEST_int_eq(EVP_PKEY_encapsulate(sctx, NULL, &ctlen, NULL, &secretlen), 1) @@ -515,7 +515,7 @@ static int kem_rsa_gen_recover(void) && TEST_int_eq(EVP_PKEY_encapsulate(sctx, ct, &ctlen, secret, &secretlen), 1) && TEST_ptr(rctx = EVP_PKEY_CTX_new_from_pkey(libctx, priv, NULL)) - && TEST_int_eq(EVP_PKEY_decapsulate_init(rctx), 1) + && TEST_int_eq(EVP_PKEY_decapsulate_init(rctx, NULL), 1) && TEST_int_eq(EVP_PKEY_CTX_set_kem_op(rctx, "RSASVE"), 1) && TEST_int_eq(EVP_PKEY_decapsulate(rctx, NULL, &unwraplen, ct, ctlen), 1) @@ -545,21 +545,21 @@ static int kem_rsa_params(void) /* Test setting kem op before the init fails */ && TEST_int_eq(EVP_PKEY_CTX_set_kem_op(pubctx, "RSASVE"), -2) /* Test NULL ctx passed */ - && TEST_int_eq(EVP_PKEY_encapsulate_init(NULL), 0) + && TEST_int_eq(EVP_PKEY_encapsulate_init(NULL, NULL), 0) && TEST_int_eq(EVP_PKEY_encapsulate(NULL, NULL, NULL, NULL, NULL), 0) - && TEST_int_eq(EVP_PKEY_decapsulate_init(NULL), 0) + && TEST_int_eq(EVP_PKEY_decapsulate_init(NULL, NULL), 0) && TEST_int_eq(EVP_PKEY_decapsulate(NULL, NULL, NULL, NULL, 0), 0) /* Test Invalid operation */ && TEST_int_eq(EVP_PKEY_encapsulate(pubctx, NULL, NULL, NULL, NULL), -1) && TEST_int_eq(EVP_PKEY_decapsulate(privctx, NULL, NULL, NULL, 0), 0) /* Wrong key component - no secret should be returned on failure */ - && TEST_int_eq(EVP_PKEY_decapsulate_init(pubctx), 1) + && TEST_int_eq(EVP_PKEY_decapsulate_init(pubctx, NULL), 1) && TEST_int_eq(EVP_PKEY_CTX_set_kem_op(pubctx, "RSASVE"), 1) && TEST_int_eq(EVP_PKEY_decapsulate(pubctx, secret, &secretlen, ct, sizeof(ct)), 0) && TEST_uchar_eq(secret[0], 0) /* Test encapsulate fails if the mode is not set */ - && TEST_int_eq(EVP_PKEY_encapsulate_init(pubctx), 1) + && TEST_int_eq(EVP_PKEY_encapsulate_init(pubctx, NULL), 1) && TEST_int_eq(EVP_PKEY_encapsulate(pubctx, ct, &ctlen, secret, &secretlen), -2) /* Test setting a bad kem ops fail */ && TEST_int_eq(EVP_PKEY_CTX_set_kem_op(pubctx, "RSA"), 0) @@ -583,7 +583,7 @@ static int kem_rsa_params(void) /* Test that lengths are optional if ct is not NULL */ && TEST_int_eq(EVP_PKEY_encapsulate(pubctx, ct, NULL, secret, NULL), 1) /* Pass if secret or secret length are not NULL */ - && TEST_int_eq(EVP_PKEY_decapsulate_init(privctx), 1) + && TEST_int_eq(EVP_PKEY_decapsulate_init(privctx, NULL), 1) && TEST_int_eq(EVP_PKEY_CTX_set_kem_op(privctx, "RSASVE"), 1) && TEST_int_eq(EVP_PKEY_decapsulate(privctx, secret, NULL, ct, sizeof(ct)), 1) && TEST_int_eq(EVP_PKEY_decapsulate(privctx, NULL, &secretlen, ct, sizeof(ct)), 1) @@ -633,7 +633,7 @@ static int kem_invalid_keytype(void) if (!TEST_ptr(sctx = EVP_PKEY_CTX_new_from_pkey(libctx, key, NULL))) goto done; - if (!TEST_int_eq(EVP_PKEY_encapsulate_init(sctx), -2)) + if (!TEST_int_eq(EVP_PKEY_encapsulate_init(sctx, NULL), -2)) goto done; ret = 1; diff --git a/test/evp_test.c b/test/evp_test.c index d781ecadce..bd32ad5c7b 100644 --- a/test/evp_test.c +++ b/test/evp_test.c @@ -1199,7 +1199,7 @@ static int mac_test_run_pkey(EVP_TEST *t) t->err = "INTERNAL_ERROR"; goto err; } - if (!EVP_DigestSignInit_ex(mctx, &pctx, mdname, libctx, NULL, key)) { + if (!EVP_DigestSignInit_ex(mctx, &pctx, mdname, libctx, NULL, key, NULL)) { t->err = "DIGESTSIGNINIT_ERROR"; goto err; } @@ -2898,12 +2898,12 @@ static int digestsigver_test_parse(EVP_TEST *t, } if (mdata->is_verify) { if (!EVP_DigestVerifyInit_ex(mdata->ctx, &mdata->pctx, name, libctx, - NULL, pkey)) + NULL, pkey, NULL)) t->err = "DIGESTVERIFYINIT_ERROR"; return 1; } if (!EVP_DigestSignInit_ex(mdata->ctx, &mdata->pctx, name, libctx, NULL, - pkey)) + pkey, NULL)) t->err = "DIGESTSIGNINIT_ERROR"; return 1; } diff --git a/test/tls-provider.c b/test/tls-provider.c index 20598041e0..1085273a32 100644 --- a/test/tls-provider.c +++ b/test/tls-provider.c @@ -202,7 +202,8 @@ static void *xor_newctx(void *provctx) return pxorctx; } -static int xor_init(void *vpxorctx, void *vkey) +static int xor_init(void *vpxorctx, void *vkey, + ossl_unused const OSSL_PARAM params[]) { PROV_XOR_CTX *pxorctx = (PROV_XOR_CTX *)vpxorctx; @@ -331,7 +332,7 @@ static int xor_encapsulate(void *vpxorctx, /* 3. Derive ss via KEX */ derivectx = xor_newctx(pxorctx->provctx); if (derivectx == NULL - || !xor_init(derivectx, ourkey) + || !xor_init(derivectx, ourkey, NULL) || !xor_set_peer(derivectx, pxorctx->key) || !xor_derive(derivectx, ss, sslen, XOR_KEY_SIZE)) goto end; @@ -378,7 +379,7 @@ static int xor_decapsulate(void *vpxorctx, /* Derive ss via KEX */ derivectx = xor_newctx(pxorctx->provctx); if (derivectx == NULL - || !xor_init(derivectx, pxorctx->key) + || !xor_init(derivectx, pxorctx->key, NULL) || !xor_set_peer(derivectx, peerkey) || !xor_derive(derivectx, ss, sslen, XOR_KEY_SIZE)) goto end; |