Lines Matching refs:NULL

45 static OSSL_LIB_CTX *testctx = NULL;
46 static char *testpropq = NULL;
48 static OSSL_PROVIDER *nullprov = NULL;
49 static OSSL_PROVIDER *deflprov = NULL;
50 static OSSL_PROVIDER *lgcyprov = NULL;
792 EVP_PKEY *pkey = NULL; in load_example_key()
794 OSSL_DECODER_CTX_new_for_pkey(&pkey, "DER", NULL, keytype, 0, in load_example_key()
851 EVP_PKEY *pkey = NULL; in load_example_hmac_key()
859 NULL, key, sizeof(key)); in load_example_hmac_key()
861 return NULL; in load_example_hmac_key()
868 char *fetched_properties = NULL; in test_EVP_set_config_properties()
877 fetched_properties = NULL; in test_EVP_set_config_properties()
888 EVP_MD *md = NULL; in test_EVP_set_default_properties()
890 char *fetched_properties = NULL; in test_EVP_set_default_properties()
895 || !TEST_ptr(md = EVP_MD_fetch(ctx, "sha256", NULL))) in test_EVP_set_default_properties()
898 md = NULL; in test_EVP_set_default_properties()
901 || !TEST_ptr_null(md = EVP_MD_fetch(ctx, "sha256", NULL)) in test_EVP_set_default_properties()
905 md = NULL; in test_EVP_set_default_properties()
912 fetched_properties = NULL; in test_EVP_set_default_properties()
921 fetched_properties = NULL; in test_EVP_set_default_properties()
926 if (!TEST_true(EVP_set_default_properties(ctx, NULL)) in test_EVP_set_default_properties()
927 || !TEST_ptr(md = EVP_MD_fetch(ctx, "sha256", NULL))) in test_EVP_set_default_properties()
940 EVP_PKEY_CTX *pctx = NULL; in make_key_fromdata()
941 EVP_PKEY *tmp_pkey = NULL, *pkey = NULL; in make_key_fromdata()
954 tmp_pkey = NULL; in make_key_fromdata()
975 ret = PEM_write_bio_PrivateKey_ex(bio, pkey, NULL, NULL, 0, NULL, NULL, in test_selection()
976 testctx, NULL); in test_selection()
1000 OSSL_PARAM_BLD *bld = NULL; in test_EVP_PKEY_ffc_priv_pub()
1001 OSSL_PARAM *params = NULL; in test_EVP_PKEY_ffc_priv_pub()
1002 EVP_PKEY *just_params = NULL; in test_EVP_PKEY_ffc_priv_pub()
1003 EVP_PKEY *params_and_priv = NULL; in test_EVP_PKEY_ffc_priv_pub()
1004 EVP_PKEY *params_and_pub = NULL; in test_EVP_PKEY_ffc_priv_pub()
1005 EVP_PKEY *params_and_keypair = NULL; in test_EVP_PKEY_ffc_priv_pub()
1006 BIGNUM *p = NULL, *q = NULL, *g = NULL, *pub = NULL, *priv = NULL; in test_EVP_PKEY_ffc_priv_pub()
1032 params = NULL; in test_EVP_PKEY_ffc_priv_pub()
1033 bld = NULL; in test_EVP_PKEY_ffc_priv_pub()
1053 params = NULL; in test_EVP_PKEY_ffc_priv_pub()
1054 bld = NULL; in test_EVP_PKEY_ffc_priv_pub()
1074 params = NULL; in test_EVP_PKEY_ffc_priv_pub()
1075 bld = NULL; in test_EVP_PKEY_ffc_priv_pub()
1137 OSSL_PARAM_BLD *bld = NULL; in test_EC_priv_pub()
1138 OSSL_PARAM *params = NULL; in test_EC_priv_pub()
1139 EVP_PKEY *just_params = NULL; in test_EC_priv_pub()
1140 EVP_PKEY *params_and_priv = NULL; in test_EC_priv_pub()
1141 EVP_PKEY *params_and_pub = NULL; in test_EC_priv_pub()
1142 EVP_PKEY *params_and_keypair = NULL; in test_EC_priv_pub()
1143 BIGNUM *priv = NULL; in test_EC_priv_pub()
1145 unsigned char *encoded = NULL; in test_EC_priv_pub()
1153 if (!TEST_ptr(priv = BN_bin2bn(ec_priv, sizeof(ec_priv), NULL))) in test_EC_priv_pub()
1168 params = NULL; in test_EC_priv_pub()
1169 bld = NULL; in test_EC_priv_pub()
1189 params = NULL; in test_EC_priv_pub()
1190 bld = NULL; in test_EC_priv_pub()
1217 params = NULL; in test_EC_priv_pub()
1218 bld = NULL; in test_EC_priv_pub()
1260 encoded = NULL; in test_EC_priv_pub()
1263 encoded = NULL; in test_EC_priv_pub()
1277 NULL, 0, &len), 1) in test_EC_priv_pub()
1303 OSSL_PARAM_BLD *bld = NULL; in test_evp_get_ec_pub()
1304 OSSL_PARAM *params = NULL; in test_evp_get_ec_pub()
1305 unsigned char *pad = NULL; in test_evp_get_ec_pub()
1306 EVP_PKEY *keypair = NULL; in test_evp_get_ec_pub()
1307 BIGNUM *priv = NULL; in test_evp_get_ec_pub()
1308 BIGNUM *x = NULL; in test_evp_get_ec_pub()
1309 BIGNUM *y = NULL; in test_evp_get_ec_pub()
1312 if (!TEST_ptr(priv = BN_bin2bn(ec_priv, sizeof(ec_priv), NULL))) in test_evp_get_ec_pub()
1363 BIGNUM *priv = NULL; in test_EC_priv_only_legacy()
1365 EC_KEY *eckey = NULL; in test_EC_priv_only_legacy()
1366 EVP_PKEY *pkey = NULL, *dup_pk = NULL; in test_EC_priv_only_legacy()
1367 EVP_MD_CTX *ctx = NULL; in test_EC_priv_only_legacy()
1370 if (!TEST_ptr(priv = BN_bin2bn(ec_priv, sizeof(ec_priv), NULL))) in test_EC_priv_only_legacy()
1386 eckey = NULL; in test_EC_priv_only_legacy()
1398 if (!TEST_true(EVP_DigestSignInit_ex(ctx, NULL, NULL, testctx, in test_EC_priv_only_legacy()
1399 testpropq, pkey, NULL))) in test_EC_priv_only_legacy()
1402 ctx = NULL; in test_EC_priv_only_legacy()
1404 if (dup_pk != NULL) in test_EC_priv_only_legacy()
1429 OSSL_LIB_CTX *libctx = NULL; in test_evp_get_ec_pub_legacy()
1430 unsigned char *pad = NULL; in test_evp_get_ec_pub_legacy()
1431 EVP_PKEY *pkey = NULL; in test_evp_get_ec_pub_legacy()
1432 EC_KEY *eckey = NULL; in test_evp_get_ec_pub_legacy()
1433 BIGNUM *priv = NULL; in test_evp_get_ec_pub_legacy()
1434 BIGNUM *x = NULL; in test_evp_get_ec_pub_legacy()
1435 BIGNUM *y = NULL; in test_evp_get_ec_pub_legacy()
1442 if (!TEST_ptr(eckey = EC_KEY_new_by_curve_name_ex(libctx, NULL, in test_evp_get_ec_pub_legacy()
1446 if (!TEST_ptr(priv = BN_bin2bn(ec_priv, sizeof(ec_priv), NULL))) in test_evp_get_ec_pub_legacy()
1452 if (!TEST_ptr(x = BN_bin2bn(&ec_pub[1], 32, NULL))) in test_evp_get_ec_pub_legacy()
1455 if (!TEST_ptr(y = BN_bin2bn(&ec_pub[33], 32, NULL))) in test_evp_get_ec_pub_legacy()
1467 eckey = NULL; in test_evp_get_ec_pub_legacy()
1502 EVP_PKEY *pkey = NULL; in test_EVP_PKEY_sign()
1503 unsigned char *sig = NULL; in test_EVP_PKEY_sign()
1505 EVP_PKEY_CTX *ctx = NULL; in test_EVP_PKEY_sign()
1532 ctx = EVP_PKEY_CTX_new_from_pkey(testctx, pkey, NULL); in test_EVP_PKEY_sign()
1535 || !TEST_int_gt(EVP_PKEY_sign(ctx, NULL, &sig_len, tbs, in test_EVP_PKEY_sign()
1563 EVP_PKEY *pkey = NULL; in test_EVP_PKEY_sign_with_app_method()
1564 RSA *rsa = NULL; in test_EVP_PKEY_sign_with_app_method()
1565 RSA_METHOD *rsa_meth = NULL; in test_EVP_PKEY_sign_with_app_method()
1567 DSA *dsa = NULL; in test_EVP_PKEY_sign_with_app_method()
1568 DSA_METHOD *dsa_meth = NULL; in test_EVP_PKEY_sign_with_app_method()
1570 unsigned char *sig = NULL; in test_EVP_PKEY_sign_with_app_method()
1572 EVP_PKEY_CTX *ctx = NULL; in test_EVP_PKEY_sign_with_app_method()
1588 rsa = NULL; /* now owned by the pkey */ in test_EVP_PKEY_sign_with_app_method()
1600 dsa = NULL; /* now owned by the pkey */ in test_EVP_PKEY_sign_with_app_method()
1607 ctx = EVP_PKEY_CTX_new_from_pkey(testctx, pkey, NULL); in test_EVP_PKEY_sign_with_app_method()
1610 || !TEST_int_gt(EVP_PKEY_sign(ctx, NULL, &sig_len, tbs, in test_EVP_PKEY_sign_with_app_method()
1648 EVP_CIPHER_CTX *ctx = NULL; in test_EVP_Enveloped()
1649 EVP_PKEY *keypair = NULL; in test_EVP_Enveloped()
1650 unsigned char *kek = NULL; in test_EVP_Enveloped()
1655 EVP_CIPHER *type = NULL; in test_EVP_Enveloped()
1657 if (nullprov != NULL) in test_EVP_Enveloped()
1720 EVP_PKEY *pkey = NULL; in test_EVP_DigestSignInit()
1721 unsigned char *sig = NULL, *sig2 = NULL; in test_EVP_DigestSignInit()
1723 EVP_MD_CTX *md_ctx = NULL, *md_ctx_verify = NULL; in test_EVP_DigestSignInit()
1724 EVP_MD_CTX *a_md_ctx = NULL, *a_md_ctx_verify = NULL; in test_EVP_DigestSignInit()
1725 BIO *mdbio = NULL, *membio = NULL; in test_EVP_DigestSignInit()
1728 EVP_MD *mdexp = NULL; in test_EVP_DigestSignInit()
1731 if (nullprov != NULL) in test_EVP_DigestSignInit()
1770 md = mdexp = EVP_MD_fetch(NULL, "SHA256", NULL); in test_EVP_DigestSignInit()
1774 if (!TEST_true(EVP_DigestSignInit(md_ctx, NULL, md, NULL, pkey))) in test_EVP_DigestSignInit()
1777 if (reinit && !TEST_true(EVP_DigestSignInit(md_ctx, NULL, NULL, NULL, NULL))) in test_EVP_DigestSignInit()
1790 if (!TEST_true(EVP_DigestSign(md_ctx, NULL, &sig_len, kMsg, in test_EVP_DigestSignInit()
1811 if (!TEST_true(EVP_DigestSignFinal(md_ctx, NULL, &sig_len)) in test_EVP_DigestSignInit()
1833 if (!TEST_true(EVP_DigestVerifyInit(md_ctx_verify, NULL, md, in test_EVP_DigestSignInit()
1834 NULL, pkey))) in test_EVP_DigestSignInit()
1856 if (!TEST_true(EVP_DigestSignFinal(md_ctx, NULL, &sig2_len)) in test_EVP_DigestSignInit()
1883 EVP_PKEY *pkey = NULL; in test_EVP_DigestVerifyInit()
1884 EVP_MD_CTX *md_ctx = NULL; in test_EVP_DigestVerifyInit()
1886 if (nullprov != NULL) in test_EVP_DigestVerifyInit()
1893 if (!TEST_true(EVP_DigestVerifyInit(md_ctx, NULL, EVP_sha256(), NULL, pkey)) in test_EVP_DigestVerifyInit()
1900 if (!TEST_true(EVP_DigestVerifyInit(md_ctx, NULL, NULL, NULL, NULL)) in test_EVP_DigestVerifyInit()
1922 EVP_PKEY *pkey = NULL; in test_siphash_digestsign()
1923 EVP_MD_CTX *mdctx = NULL; in test_siphash_digestsign()
1924 EVP_PKEY_CTX *ctx = NULL; in test_siphash_digestsign()
1928 if (nullprov != NULL) in test_siphash_digestsign()
1933 if (!TEST_ptr(pkey = EVP_PKEY_new_raw_private_key(EVP_PKEY_SIPHASH, NULL, in test_siphash_digestsign()
1940 if (!TEST_true(EVP_DigestSignInit(mdctx, &ctx, NULL, NULL, pkey))) in test_siphash_digestsign()
1944 8, NULL), 1)) in test_siphash_digestsign()
1947 if (!TEST_true(EVP_DigestSignInit(mdctx, NULL, NULL, NULL, NULL))) in test_siphash_digestsign()
1970 EVP_MD_CTX *md_ctx = NULL; in test_EVP_Digest()
1972 EVP_MD *sha256 = NULL; in test_EVP_Digest()
1973 EVP_MD *shake256 = NULL; in test_EVP_Digest()
1982 if (!TEST_true(EVP_DigestInit_ex(md_ctx, sha256, NULL)) in test_EVP_Digest()
1984 || !TEST_true(EVP_DigestFinal(md_ctx, md, NULL)) in test_EVP_Digest()
1986 || !TEST_ptr_eq(EVP_MD_CTX_get0_md(md_ctx), NULL)) in test_EVP_Digest()
1989 if (!TEST_true(EVP_DigestInit_ex(md_ctx, sha256, NULL)) in test_EVP_Digest()
1991 || !TEST_true(EVP_DigestFinal_ex(md_ctx, md, NULL)) in test_EVP_Digest()
1998 || !TEST_true(EVP_DigestInit_ex(md_ctx, NULL, NULL))) in test_EVP_Digest()
2001 if (!TEST_true(EVP_DigestInit_ex(md_ctx, shake256, NULL)) in test_EVP_Digest()
2006 || !TEST_true(EVP_DigestInit_ex(md_ctx, NULL, NULL))) in test_EVP_Digest()
2020 EVP_MD_CTX *md_ctx = NULL; in test_EVP_md_null()
2025 if (nullprov != NULL) in test_EVP_md_null()
2032 if (!TEST_true(EVP_DigestInit_ex(md_ctx, md_null, NULL)) in test_EVP_md_null()
2050 EVP_PKEY *pkey = NULL; in test_d2i_AutoPrivateKey()
2057 if (!TEST_ptr(pkey = d2i_AutoPrivateKey(NULL, &p, input_len)) in test_d2i_AutoPrivateKey()
2131 PKCS8_PRIV_KEY_INFO *p8inf = NULL; in test_EVP_PKCS82PKEY()
2132 EVP_PKEY *pkey = NULL; in test_EVP_PKCS82PKEY()
2134 if (!TEST_ptr(p8inf = d2i_PKCS8_PRIV_KEY_INFO(NULL, &derp, in test_EVP_PKCS82PKEY()
2157 EVP_PKEY *pkey = NULL; in test_EVP_PKCS82PKEY_wrong_tag()
2158 EVP_PKEY *pkey2 = NULL; in test_EVP_PKCS82PKEY_wrong_tag()
2159 BIO *membio = NULL; in test_EVP_PKCS82PKEY_wrong_tag()
2160 char *membuf = NULL; in test_EVP_PKCS82PKEY_wrong_tag()
2161 PKCS8_PRIV_KEY_INFO *p8inf = NULL; in test_EVP_PKCS82PKEY_wrong_tag()
2164 if (testctx != NULL) in test_EVP_PKCS82PKEY_wrong_tag()
2170 || !TEST_int_gt(i2d_PKCS8PrivateKey_bio(membio, pkey, NULL, in test_EVP_PKCS82PKEY_wrong_tag()
2171 NULL, 0, NULL, NULL), in test_EVP_PKCS82PKEY_wrong_tag()
2174 || !TEST_ptr(p8inf = d2i_PKCS8_PRIV_KEY_INFO_bio(membio, NULL)) in test_EVP_PKCS82PKEY_wrong_tag()
2192 EVP_PKEY *pkey = NULL; in test_privatekey_to_pkcs8()
2193 BIO *membio = NULL; in test_privatekey_to_pkcs8()
2194 char *membuf = NULL; in test_privatekey_to_pkcs8()
2200 || !TEST_int_gt(i2d_PKCS8PrivateKey_bio(membio, pkey, NULL, in test_privatekey_to_pkcs8()
2201 NULL, 0, NULL, NULL), in test_privatekey_to_pkcs8()
2211 || !TEST_int_gt(PEM_write_bio_PKCS8PrivateKey(membio, pkey, NULL, in test_privatekey_to_pkcs8()
2212 NULL, 0, NULL, NULL), in test_privatekey_to_pkcs8()
2235 const char *enc_name = NULL; in ec_export_get_encoding_cb()
2258 EVP_PKEY *params = NULL, *key = NULL; in test_EC_keygen_with_enc()
2259 EVP_PKEY_CTX *pctx = NULL, *kctx = NULL; in test_EC_keygen_with_enc()
2266 if (!TEST_ptr(pctx = EVP_PKEY_CTX_new_from_name(testctx, "EC", NULL)) in test_EC_keygen_with_enc()
2275 if (!TEST_ptr(kctx = EVP_PKEY_CTX_new_from_pkey(testctx, params, NULL)) in test_EC_keygen_with_enc()
2321 BIO *bio = NULL; in test_EVP_SM2_verify()
2322 EVP_PKEY *pkey = NULL; in test_EVP_SM2_verify()
2323 EVP_MD_CTX *mctx = NULL; in test_EVP_SM2_verify()
2324 EVP_PKEY_CTX *pctx = NULL; in test_EVP_SM2_verify()
2325 EVP_MD *sm3 = NULL; in test_EVP_SM2_verify()
2328 if (!TEST_true(bio != NULL)) in test_EVP_SM2_verify()
2331 pkey = PEM_read_bio_PUBKEY_ex(bio, NULL, NULL, NULL, testctx, testpropq); in test_EVP_SM2_verify()
2332 if (!TEST_true(pkey != NULL)) in test_EVP_SM2_verify()
2349 if (!TEST_true(EVP_DigestVerifyInit(mctx, NULL, sm3, NULL, pkey))) in test_EVP_SM2_verify()
2374 EVP_PKEY *pkey = NULL; in test_EVP_SM2()
2375 EVP_PKEY *pkeyparams = NULL; in test_EVP_SM2()
2376 EVP_PKEY_CTX *pctx = NULL; in test_EVP_SM2()
2377 EVP_PKEY_CTX *kctx = NULL; in test_EVP_SM2()
2378 EVP_PKEY_CTX *sctx = NULL; in test_EVP_SM2()
2380 unsigned char *sig = NULL; in test_EVP_SM2()
2381 EVP_MD_CTX *md_ctx = NULL; in test_EVP_SM2()
2382 EVP_MD_CTX *md_ctx_verify = NULL; in test_EVP_SM2()
2383 EVP_PKEY_CTX *cctx = NULL; in test_EVP_SM2()
2384 EVP_MD *check_md = NULL; in test_EVP_SM2()
2437 if (!TEST_true(EVP_DigestSignInit(md_ctx, NULL, check_md, NULL, pkey))) in test_EVP_SM2()
2447 if (!TEST_true(EVP_DigestSignFinal(md_ctx, NULL, &sig_len))) in test_EVP_SM2()
2458 if (!TEST_true(EVP_DigestVerifyInit(md_ctx_verify, NULL, check_md, NULL, in test_EVP_SM2()
2476 if (!TEST_true(EVP_DigestVerifyInit(md_ctx_verify, NULL, check_md, NULL, in test_EVP_SM2()
2480 if (!TEST_int_gt(EVP_PKEY_CTX_set1_id(sctx, NULL, 0), 0)) in test_EVP_SM2()
2498 NULL, in test_EVP_SM2()
2503 if (mdnames[i] == NULL) in test_EVP_SM2()
2580 EVP_PKEY_HMAC, "0123456789", NULL
2583 EVP_PKEY_HMAC, "", NULL
2586 EVP_PKEY_POLY1305, "01234567890123456789012345678901", NULL
2590 EVP_PKEY_SIPHASH, "0123456789012345", NULL
2621 if (pub && keys[tst].pub == NULL) in test_set_get_raw_keys_int()
2634 NULL, in test_set_get_raw_keys_int()
2639 NULL, in test_set_get_raw_keys_int()
2652 NULL, in test_set_get_raw_keys_int()
2657 NULL, in test_set_get_raw_keys_int()
2665 || (!pub && !TEST_true(EVP_PKEY_get_raw_private_key(pkey, NULL, &len))) in test_set_get_raw_keys_int()
2666 || (pub && !TEST_true(EVP_PKEY_get_raw_public_key(pkey, NULL, &len))) in test_set_get_raw_keys_int()
2693 return (nullprov != NULL || test_set_get_raw_keys_int(tst, 0, 0)) in test_set_get_raw_keys()
2695 && (nullprov != NULL || test_set_get_raw_keys_int(tst, 1, 0)) in test_set_get_raw_keys()
2721 EVP_PKEY *pkey = NULL; in test_EVP_PKEY_check()
2722 EVP_PKEY_CTX *ctx = NULL; in test_EVP_PKEY_check()
2724 EVP_PKEY_CTX *ctx2 = NULL; in test_EVP_PKEY_check()
2754 ctx2 = EVP_PKEY_CTX_new_id(0xdefaced, NULL); in test_EVP_PKEY_check()
2789 || !TEST_true(EVP_DigestSignInit_ex(mdctx, NULL, NULL, testctx, in get_cmac_val()
2790 testpropq, pkey, NULL)) in get_cmac_val()
2807 EVP_PKEY_CTX *kctx = NULL; in test_CMAC_keygen()
2809 EVP_PKEY *pkey = NULL; in test_CMAC_keygen()
2815 if (nullprov != NULL) in test_CMAC_keygen()
2822 kctx = EVP_PKEY_CTX_new_id(EVP_PKEY_CMAC, NULL); in test_CMAC_keygen()
2844 pkey = EVP_PKEY_new_CMAC_key(NULL, key, sizeof(key), EVP_aes_256_cbc()); in test_CMAC_keygen()
3008 if (!TEST_true(X509_PUBKEY_get0(xp) == NULL)) in test_X509_PUBKEY_inplace()
3021 X509_PUBKEY *xp = NULL, *xq = NULL; in test_X509_PUBKEY_dup()
3038 xq = NULL; in test_X509_PUBKEY_dup()
3047 xp = NULL; in test_X509_PUBKEY_dup()
3048 if (!TEST_true(X509_PUBKEY_get0(xq) == NULL)) in test_X509_PUBKEY_dup()
3063 EVP_MD_CTX *mdctx = NULL; in test_EVP_PKEY_CTX_get_set_params()
3064 EVP_PKEY_CTX *ctx = NULL; in test_EVP_PKEY_CTX_get_set_params()
3129 || !TEST_true(EVP_DigestSignInit_ex(mdctx, NULL, "SHA1", testctx, testpropq, in test_EVP_PKEY_CTX_get_set_params()
3130 pkey, NULL))) in test_EVP_PKEY_CTX_get_set_params()
3165 OSSL_PARAM_BLD *bld = NULL; in test_DSA_get_set_params()
3166 OSSL_PARAM *params = NULL; in test_DSA_get_set_params()
3167 BIGNUM *p = NULL, *q = NULL, *g = NULL, *pub = NULL, *priv = NULL; in test_DSA_get_set_params()
3168 EVP_PKEY_CTX *pctx = NULL; in test_DSA_get_set_params()
3169 EVP_PKEY *pkey = NULL; in test_DSA_get_set_params()
3176 if (!TEST_ptr(pctx = EVP_PKEY_CTX_new_from_name(testctx, "DSA", NULL)) in test_DSA_get_set_params()
3232 OSSL_PARAM_BLD *bld = NULL; in test_RSA_get_set_params()
3233 OSSL_PARAM *params = NULL; in test_RSA_get_set_params()
3234 BIGNUM *n = NULL, *e = NULL, *d = NULL; in test_RSA_get_set_params()
3235 EVP_PKEY_CTX *pctx = NULL; in test_RSA_get_set_params()
3236 EVP_PKEY *pkey = NULL; in test_RSA_get_set_params()
3243 if (!TEST_ptr(pctx = EVP_PKEY_CTX_new_from_name(testctx, "RSA", NULL)) in test_RSA_get_set_params()
3281 EVP_PKEY *key = NULL; in test_RSA_OAEP_set_get_params()
3282 EVP_PKEY_CTX *key_ctx = NULL; in test_RSA_OAEP_set_get_params()
3284 if (nullprov != NULL) in test_RSA_OAEP_set_get_params()
3337 EVP_PKEY *key = NULL; in test_RSA_OAEP_set_null_label()
3338 EVP_PKEY_CTX *key_ctx = NULL; in test_RSA_OAEP_set_null_label()
3341 || !TEST_ptr(key_ctx = EVP_PKEY_CTX_new_from_pkey(testctx, key, NULL)) in test_RSA_OAEP_set_null_label()
3351 if (!TEST_true(EVP_PKEY_CTX_set0_rsa_oaep_label(key_ctx, NULL, 0))) in test_RSA_OAEP_set_null_label()
3367 BIGNUM *p = NULL; in test_RSA_legacy()
3368 BIGNUM *q = NULL; in test_RSA_legacy()
3369 BIGNUM *n = NULL; in test_RSA_legacy()
3370 BIGNUM *e = NULL; in test_RSA_legacy()
3371 BIGNUM *d = NULL; in test_RSA_legacy()
3373 EVP_MD_CTX *ctx = NULL; in test_RSA_legacy()
3374 EVP_PKEY *pkey = NULL; in test_RSA_legacy()
3375 RSA *rsa = NULL; in test_RSA_legacy()
3377 if (nullprov != NULL) in test_RSA_legacy()
3394 p = NULL; in test_RSA_legacy()
3395 q = NULL; in test_RSA_legacy()
3399 n = NULL; in test_RSA_legacy()
3400 e = NULL; in test_RSA_legacy()
3401 d = NULL; in test_RSA_legacy()
3406 rsa = NULL; in test_RSA_legacy()
3408 if (!TEST_true(EVP_DigestSignInit(ctx, NULL, md, NULL, pkey))) in test_RSA_legacy()
3430 EVP_CIPHER_CTX* ctx = NULL; in test_decrypt_null_chunks()
3431 EVP_CIPHER *cipher = NULL; in test_decrypt_null_chunks()
3450 || !TEST_true(EVP_EncryptInit_ex(ctx, cipher, NULL, in test_decrypt_null_chunks()
3455 || !TEST_true(EVP_EncryptUpdate(ctx, ciphertext + ctlen, &tmp, NULL, in test_decrypt_null_chunks()
3468 if (!TEST_true(EVP_DecryptInit_ex(ctx, cipher, NULL, key, iv)) in test_decrypt_null_chunks()
3475 || !TEST_true(EVP_DecryptUpdate(ctx, plaintext + ptlen, &tmp, NULL, in test_decrypt_null_chunks()
3508 DH *x942dh = NULL, *noqdh = NULL; in test_EVP_PKEY_set1_DH()
3509 EVP_PKEY *pkey1 = NULL, *pkey2 = NULL; in test_EVP_PKEY_set1_DH()
3511 BIGNUM *p, *g = NULL; in test_EVP_PKEY_set1_DH()
3512 BIGNUM *pubkey = NULL; in test_EVP_PKEY_set1_DH()
3523 || !TEST_true(DH_set0_pqg(noqdh, p, NULL, g)) in test_EVP_PKEY_set1_DH()
3524 || !TEST_true(DH_set0_key(noqdh, pubkey, NULL)) in test_EVP_PKEY_set1_DH()
3528 p = g = NULL; in test_EVP_PKEY_set1_DH()
3537 || !TEST_true(DH_set0_key(x942dh, pubkey, NULL))) in test_EVP_PKEY_set1_DH()
3539 pubkey = NULL; in test_EVP_PKEY_set1_DH()
3584 EVP_PKEY_CTX *ctx = NULL; in test_keygen_with_empty_template()
3585 EVP_PKEY *pkey = NULL; in test_keygen_with_empty_template()
3586 EVP_PKEY *tkey = NULL; in test_keygen_with_empty_template()
3589 if (nullprov != NULL) in test_keygen_with_empty_template()
3595 if (!TEST_ptr(ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL))) in test_keygen_with_empty_template()
3602 || !TEST_ptr(ctx = EVP_PKEY_CTX_new(tkey, NULL))) in test_keygen_with_empty_template()
3630 OSSL_PROVIDER *tmpnullprov = NULL; in test_pkey_ctx_fail_without_provider()
3631 EVP_PKEY_CTX *pctx = NULL; in test_pkey_ctx_fail_without_provider()
3632 const char *keytype = NULL; in test_pkey_ctx_fail_without_provider()
3702 ctx = EVP_RAND_CTX_new(rand, NULL); in test_rand_agglomeration()
3713 && TEST_true(EVP_RAND_generate(ctx, out, sizeof(out), 0, 1, NULL, 0)) in test_rand_agglomeration()
3727 EVP_CIPHER_CTX *ctx = NULL; in test_evp_iv_aes()
3768 const EVP_CIPHER *type = NULL; in test_evp_iv_aes()
3771 if (nullprov != NULL && idx < 6) in test_evp_iv_aes()
3779 type = (type != NULL) ? type : in test_evp_iv_aes()
3789 type = (type != NULL) ? type : in test_evp_iv_aes()
3799 type = (type != NULL) ? type : in test_evp_iv_aes()
3809 type = (type != NULL) ? type : in test_evp_iv_aes()
3818 type = (type != NULL) ? type : in test_evp_iv_aes()
3832 type = (type != NULL) ? type : in test_evp_iv_aes()
3844 || !TEST_true(EVP_EncryptInit_ex(ctx, type, NULL, key, init_iv)) in test_evp_iv_aes()
3861 if (!TEST_true(EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, NULL)) in test_evp_iv_aes()
3884 EVP_CIPHER_CTX *ctx = NULL; in test_evp_iv_des()
3919 EVP_CIPHER *type = NULL; in test_evp_iv_des()
3921 if (lgcyprov == NULL && idx < 3) in test_evp_iv_des()
3961 || !TEST_true(EVP_EncryptInit_ex(ctx, type, NULL, key, init_iv)) in test_evp_iv_des()
3977 if (!TEST_true(EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, NULL)) in test_evp_iv_des()
3999 EVP_CIPHER *cipher = NULL; in test_evp_bf_default_keylen()
4001 if (lgcyprov == NULL) in test_evp_bf_default_keylen()
4033 EVP_PKEY *pkey = NULL; in test_ecpub()
4034 EVP_PKEY_CTX *ctx = NULL; in test_ecpub()
4037 EVP_PKEY *pkey2 = NULL; in test_ecpub()
4038 EC_KEY *ec = NULL; in test_ecpub()
4041 if (nullprov != NULL) in test_ecpub()
4046 ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_EC, NULL); in test_ecpub()
4052 len = i2d_PublicKey(pkey, NULL); in test_ecpub()
4071 ec = NULL; in test_ecpub()
4095 EVP_PKEY_CTX *ctx = NULL; in test_EVP_rsa_pss_with_keygen_bits()
4096 EVP_PKEY *pkey = NULL; in test_EVP_rsa_pss_with_keygen_bits()
4116 EVP_PKEY *pkey = NULL; in test_EVP_rsa_pss_set_saltlen()
4117 EVP_PKEY_CTX *pkey_ctx = NULL; in test_EVP_rsa_pss_set_saltlen()
4118 EVP_MD *sha256 = NULL; in test_EVP_rsa_pss_set_saltlen()
4119 EVP_MD_CTX *sha256_ctx = NULL; in test_EVP_rsa_pss_set_saltlen()
4124 && TEST_ptr(sha256 = EVP_MD_fetch(testctx, "sha256", NULL)) in test_EVP_rsa_pss_set_saltlen()
4126 && TEST_true(EVP_DigestSignInit(sha256_ctx, &pkey_ctx, sha256, NULL, pkey)) in test_EVP_rsa_pss_set_saltlen()
4142 EVP_PKEY *pkey = NULL; in test_EVP_rsa_invalid_key()
4157 EVP_CIPHER *aes128 = EVP_CIPHER_fetch(ctx, "AES-128-CBC", NULL); in md_names()
4173 EVP_MD *sha256 = NULL; in test_names_do_all()
4179 sha256 = EVP_MD_fetch(ctx, "SHA2-256", NULL); in test_names_do_all()
4219 cfbCiphertext, NULL, 0, sizeof(cfbPlaintext), sizeof(cfbCiphertext),
4230 cfbCiphertext, NULL, 0, sizeof(cfbPlaintext), sizeof(cfbCiphertext),
4241 cfbPlaintext, NULL, 0, sizeof(cfbCiphertext), sizeof(cfbPlaintext),
4252 cfbPlaintext, NULL, 0, sizeof(cfbCiphertext), sizeof(cfbPlaintext),
4267 cfbCiphertext_partial, NULL, 0, sizeof(cfbPlaintext_partial),
4272 cfbPlaintext_partial, NULL, 0, sizeof(cfbCiphertext_partial),
4277 ofbCiphertext_partial, NULL, 0, sizeof(cfbPlaintext_partial),
4282 cfbPlaintext_partial, NULL, 0, sizeof(ofbCiphertext_partial),
4292 if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, t->ivlen, NULL), 0)) in evp_init_seq_set_iv()
4295 if (!TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, NULL, t->iv, -1))) in evp_init_seq_set_iv()
4314 EVP_CIPHER_CTX *ctx = NULL; in test_evp_init_seq()
4315 EVP_CIPHER *type = NULL; in test_evp_init_seq()
4317 char *errmsg = NULL; in test_evp_init_seq()
4320 if (ctx == NULL) { in test_evp_init_seq()
4328 if (!TEST_true(EVP_CipherInit_ex(ctx, type, NULL, NULL, NULL, t->initenc))) { in test_evp_init_seq()
4336 if (t->keyfirst && !TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, t->key, NULL, -1))) { in test_evp_init_seq()
4344 if (t->keyfirst == 0 && !TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, t->key, NULL, -1))) { in test_evp_init_seq()
4348 if (!TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, t->finalenc))) { in test_evp_init_seq()
4356 if (t->finalenc == 0 && t->tag != NULL) { in test_evp_init_seq()
4372 if (t->finalenc != 0 && t->tag != NULL) { in test_evp_init_seq()
4384 if (errmsg != NULL) in test_evp_init_seq()
4402 EVP_CIPHER_CTX *ctx = NULL; in test_evp_reinit_seq()
4403 EVP_CIPHER *type = NULL; in test_evp_reinit_seq()
4408 || !TEST_true(EVP_CipherInit_ex2(ctx, type, t->key, t->iv, t->initenc, NULL)) in test_evp_reinit_seq()
4415 || !TEST_true(EVP_CipherInit_ex2(ctx, NULL, NULL, NULL, -1, NULL)) in test_evp_reinit_seq()
4458 EVP_CIPHER_CTX *ctx = NULL; in test_evp_reset()
4459 EVP_CIPHER *type = NULL; in test_evp_reset()
4460 char *errmsg = NULL; in test_evp_reset()
4470 if (!TEST_true(EVP_CipherInit_ex(ctx, type, NULL, kCFBDefaultKey, iCFBIV, t->enc))) { in test_evp_reset()
4490 if (!TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, -1))) { in test_evp_reset()
4508 if (errmsg != NULL) in test_evp_reset()
4569 EVP_CIPHER_CTX *ctx = NULL; in test_evp_updated_iv()
4570 EVP_CIPHER *type = NULL; in test_evp_updated_iv()
4573 char *errmsg = NULL; in test_evp_updated_iv()
4579 if ((type = EVP_CIPHER_fetch(testctx, t->cipher, testpropq)) == NULL) { in test_evp_updated_iv()
4584 if (!TEST_true(EVP_CipherInit_ex(ctx, type, NULL, kCFBDefaultKey, iCFBIV, t->enc))) { in test_evp_updated_iv()
4616 if (errmsg != NULL) in test_evp_updated_iv()
4656 EVP_CIPHER_CTX *ctx = NULL; in test_gcm_reinit()
4657 EVP_CIPHER *type = NULL; in test_gcm_reinit()
4659 char *errmsg = NULL; in test_gcm_reinit()
4669 if (!TEST_true(EVP_CipherInit_ex(ctx, type, NULL, NULL, NULL, 1))) { in test_gcm_reinit()
4673 if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, t->ivlen1, NULL), 0)) { in test_gcm_reinit()
4677 if (!TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, kGCMResetKey, t->iv1, 1))) { in test_gcm_reinit()
4681 if (!TEST_true(EVP_CipherUpdate(ctx, NULL, &outlen3, gcmAAD, sizeof(gcmAAD)))) { in test_gcm_reinit()
4708 if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, t->ivlen2, NULL), 0)) { in test_gcm_reinit()
4712 if (!TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, NULL, t->iv2, -1))) { in test_gcm_reinit()
4716 if (!TEST_true(EVP_CipherUpdate(ctx, NULL, &outlen3, gcmAAD, sizeof(gcmAAD)))) { in test_gcm_reinit()
4743 if (errmsg != NULL) in test_gcm_reinit()
4768 EVP_CIPHER_CTX *ctx = NULL; in test_ivlen_change()
4769 EVP_CIPHER *ciph = NULL; in test_ivlen_change()
4780 if (!TEST_true(EVP_CipherInit_ex(ctx, ciph, NULL, kGCMDefaultKey, iv, 1))) in test_ivlen_change()
4823 NULL
4836 EVP_CIPHER_CTX *ctx = NULL; in test_keylen_change()
4837 EVP_CIPHER *ciph = NULL; in test_keylen_change()
4841 if (lgcyprov == NULL) in test_keylen_change()
4851 if (!TEST_true(EVP_CipherInit_ex(ctx, ciph, NULL, key, NULL, 1))) in test_keylen_change()
4879 static EVP_PKEY_METHOD *custom_pmeth = NULL;
4880 static const EVP_PKEY_METHOD *orig_pmeth = NULL;
4907 EVP_PKEY_meth_get_sign(orig_pmeth, NULL, &psign); in custom_pmeth_sign()
4927 EVP_PKEY_meth_get_derive(orig_pmeth, NULL, &pderive); in custom_pmeth_derive()
4945 EVP_PKEY_meth_get_ctrl(orig_pmeth, &pctrl, NULL); in custom_pmeth_ctrl()
4957 EVP_PKEY_CTX *pctx = NULL; in test_custom_pmeth()
4958 EVP_MD_CTX *ctx = NULL; in test_custom_pmeth()
4959 EVP_PKEY *pkey = NULL; in test_custom_pmeth()
4963 unsigned char *res = NULL; in test_custom_pmeth()
4971 if (testctx != NULL) in test_custom_pmeth()
5002 md = NULL; in test_custom_pmeth()
5069 EVP_PKEY_meth_set_derive(custom_pmeth, NULL, custom_pmeth_derive); in test_custom_pmeth()
5071 EVP_PKEY_meth_set_sign(custom_pmeth, NULL, custom_pmeth_sign); in test_custom_pmeth()
5078 EVP_PKEY_meth_set_ctrl(custom_pmeth, custom_pmeth_ctrl, NULL); in test_custom_pmeth()
5083 pctx = EVP_PKEY_CTX_new(pkey, NULL); in test_custom_pmeth()
5087 EVP_PKEY_CTRL_MY_COMMAND, 0, NULL), in test_custom_pmeth()
5091 || !TEST_int_ge(EVP_PKEY_derive(pctx, NULL, &reslen), 1) in test_custom_pmeth()
5101 || !TEST_true(EVP_DigestSignInit(ctx, &pctx, md, NULL, pkey)) in test_custom_pmeth()
5103 EVP_PKEY_CTRL_MY_COMMAND, 0, NULL), in test_custom_pmeth()
5127 custom_pmeth = NULL; in test_custom_pmeth()
5160 if (p == NULL) in custom_md_init()
5171 if (p == NULL) in custom_md_cleanup()
5181 ASN1_OBJECT *o = NULL; in test_custom_md_meth()
5182 EVP_MD_CTX *mdctx = NULL; in test_custom_md_meth()
5183 EVP_MD *tmp = NULL; in test_custom_md_meth()
5194 if (testctx != NULL) in test_custom_md_meth()
5219 || !TEST_true(EVP_DigestInit_ex(mdctx, tmp, NULL)) in test_custom_md_meth()
5220 || !TEST_true(EVP_DigestInit_ex(mdctx, EVP_sha256(), NULL)) in test_custom_md_meth()
5259 if (p == NULL) in custom_ciph_init()
5270 if (p == NULL) in custom_ciph_cleanup()
5280 EVP_CIPHER_CTX *ciphctx = NULL; in test_custom_ciph_meth()
5281 EVP_CIPHER *tmp = NULL; in test_custom_ciph_meth()
5289 if (testctx != NULL) in test_custom_ciph_meth()
5315 || !TEST_true(EVP_CipherInit_ex(ciphctx, tmp, NULL, NULL, NULL, 1)) in test_custom_ciph_meth()
5316 || !TEST_true(EVP_CipherInit_ex(ciphctx, EVP_aes_128_cbc(), NULL, in test_custom_ciph_meth()
5317 NULL, NULL, 1)) in test_custom_ciph_meth()
5335 EVP_PKEY *pkey = NULL; in test_signatures_with_engine()
5348 EVP_MD_CTX *ctx = NULL; in test_signatures_with_engine()
5349 unsigned char *mac = NULL; in test_signatures_with_engine()
5395 ret = EVP_DigestSignInit(ctx, NULL, tst == 2 ? NULL : EVP_sha256(), NULL, in test_signatures_with_engine()
5402 || !TEST_true(EVP_DigestSignFinal(ctx, NULL, &maclen))) in test_signatures_with_engine()
5437 EVP_CIPHER_CTX *ctx = NULL, *ctx2 = NULL; in test_cipher_with_engine()
5492 NULL, &ecxkeydata, 1); in test_ecx_short_keys()
5517 { NULL } in test_get_options()
5526 EVP_PKEY *pkey = NULL; in test_ecx_not_private_key()
5530 EVP_MD_CTX *ctx = NULL; in test_ecx_not_private_key()
5531 unsigned char *mac = NULL; in test_ecx_not_private_key()
5543 if (keys[tst].pub == NULL) in test_ecx_not_private_key()
5550 NULL, pubkey, pubkeylen); in test_ecx_not_private_key()
5557 if (EVP_DigestSignInit(ctx, NULL, NULL, NULL, pkey) != 1) in test_ecx_not_private_key()
5560 if (EVP_DigestSign(ctx, NULL, &maclen, msg, sizeof(msg)) != 1) in test_ecx_not_private_key()
5591 OSSL_PROVIDER *fake_rsa = NULL; in test_sign_continuation()
5593 EVP_PKEY *pkey = NULL; in test_sign_continuation()
5594 EVP_PKEY_CTX *pctx = NULL; in test_sign_continuation()
5595 EVP_MD_CTX *mctx = NULL; in test_sign_continuation()
5612 || !TEST_true(EVP_PKEY_fromdata(pctx, &pkey, EVP_PKEY_KEYPAIR, NULL)) in test_sign_continuation()
5618 || !TEST_true(EVP_DigestSignInit_ex(mctx, NULL, NULL, testctx, in test_sign_continuation()
5619 NULL, pkey, NULL)) in test_sign_continuation()
5630 || !TEST_true(EVP_DigestSignInit_ex(mctx, NULL, NULL, testctx, in test_sign_continuation()
5631 NULL, pkey, nodup_params)) in test_sign_continuation()
5657 EVP_CIPHER *cipher = NULL; in aes_gcm_encrypt()
5673 || (gcm_aad != NULL in aes_gcm_encrypt()
5674 && !TEST_true(EVP_EncryptUpdate(ctx, NULL, &outlen, in aes_gcm_encrypt()
5706 EVP_CIPHER *cipher = NULL; in aes_gcm_decrypt()
5713 if ((ctx = EVP_CIPHER_CTX_new()) == NULL) in aes_gcm_decrypt()
5716 if ((cipher = EVP_CIPHER_fetch(testctx, "AES-256-GCM", "")) == NULL) in aes_gcm_decrypt()
5723 || (gcm_aad != NULL in aes_gcm_decrypt()
5724 && !TEST_true(EVP_DecryptUpdate(ctx, NULL, &outlen, in aes_gcm_decrypt()
5781 gcm_pt, sizeof(gcm_pt), NULL, 0, in test_aes_gcm_ivlen_change_cve_2023_5363()
5784 gcm_pt, sizeof(gcm_pt), NULL, 0, in test_aes_gcm_ivlen_change_cve_2023_5363()
5795 EVP_CIPHER *cipher = NULL; in rc4_encrypt()
5809 if (!TEST_true(EVP_EncryptInit_ex2(ctx, cipher, rc4_key, NULL, params)) in rc4_encrypt()
5832 EVP_CIPHER *cipher = NULL; in rc4_decrypt()
5839 if ((ctx = EVP_CIPHER_CTX_new()) == NULL) in rc4_decrypt()
5842 if ((cipher = EVP_CIPHER_fetch(testctx, "RC4", "")) == NULL) in rc4_decrypt()
5848 if (!TEST_true(EVP_DecryptInit_ex2(ctx, cipher, rc4_key, NULL, params)) in rc4_decrypt()
5885 if (lgcyprov == NULL) in test_aes_rc4_keylen_change_cve_2023_5363()
5916 char *config_file = NULL; in setup_tests()
5936 nullprov = OSSL_PROVIDER_load(NULL, "null"); in setup_tests()
5944 if (!test_get_libctx(&testctx, &nullprov, config_file, NULL, NULL)) in setup_tests()
5954 if (config_file != NULL) { in setup_tests()
6073 if (testctx == NULL) { in setup_tests()