Lines Matching refs:pkey
792 EVP_PKEY *pkey = NULL; in load_example_key() local
794 OSSL_DECODER_CTX_new_for_pkey(&pkey, "DER", NULL, keytype, 0, in load_example_key()
800 return pkey; in load_example_key()
851 EVP_PKEY *pkey = NULL; in load_example_hmac_key() local
858 pkey = EVP_PKEY_new_raw_private_key_ex(testctx, "HMAC", in load_example_hmac_key()
860 if (!TEST_ptr(pkey)) in load_example_hmac_key()
863 return pkey; in load_example_hmac_key()
941 EVP_PKEY *tmp_pkey = NULL, *pkey = NULL; in make_key_fromdata() local
953 pkey = tmp_pkey; in make_key_fromdata()
958 return pkey; in make_key_fromdata()
961 static int test_selection(EVP_PKEY *pkey, int selection) in test_selection() argument
967 ret = PEM_write_bio_PUBKEY(bio, pkey); in test_selection()
975 ret = PEM_write_bio_PrivateKey_ex(bio, pkey, NULL, NULL, 0, NULL, NULL, in test_selection()
1366 EVP_PKEY *pkey = NULL, *dup_pk = NULL; in test_EC_priv_only_legacy() local
1380 pkey = EVP_PKEY_new(); in test_EC_priv_only_legacy()
1381 if (!TEST_ptr(pkey)) in test_EC_priv_only_legacy()
1384 if (!TEST_true(EVP_PKEY_assign_EC_KEY(pkey, eckey))) in test_EC_priv_only_legacy()
1399 testpropq, pkey, NULL))) in test_EC_priv_only_legacy()
1407 if (!TEST_ptr(dup_pk = EVP_PKEY_dup(pkey))) in test_EC_priv_only_legacy()
1410 ret = TEST_int_eq(EVP_PKEY_eq(pkey, dup_pk), -2); in test_EC_priv_only_legacy()
1411 EVP_PKEY_free(pkey); in test_EC_priv_only_legacy()
1412 pkey = dup_pk; in test_EC_priv_only_legacy()
1420 EVP_PKEY_free(pkey); in test_EC_priv_only_legacy()
1431 EVP_PKEY *pkey = NULL; in test_evp_get_ec_pub_legacy() local
1461 if (!TEST_ptr(pkey = EVP_PKEY_new())) in test_evp_get_ec_pub_legacy()
1465 if (!TEST_true(EVP_PKEY_assign_EC_KEY(pkey, eckey))) in test_evp_get_ec_pub_legacy()
1469 if (!TEST_true(EVP_PKEY_get_bn_param(pkey, OSSL_PKEY_PARAM_EC_PUB_X, &x)) in test_evp_get_ec_pub_legacy()
1470 || !TEST_true(EVP_PKEY_get_bn_param(pkey, OSSL_PKEY_PARAM_EC_PUB_Y, &y))) in test_evp_get_ec_pub_legacy()
1487 EVP_PKEY_free(pkey); in test_evp_get_ec_pub_legacy()
1502 EVP_PKEY *pkey = NULL; in test_EVP_PKEY_sign() local
1512 if (!TEST_ptr(pkey = load_example_rsa_key())) in test_EVP_PKEY_sign()
1516 if (!TEST_ptr(pkey = load_example_dsa_key())) in test_EVP_PKEY_sign()
1524 if (!TEST_ptr(pkey = load_example_ec_key())) in test_EVP_PKEY_sign()
1532 ctx = EVP_PKEY_CTX_new_from_pkey(testctx, pkey, NULL); in test_EVP_PKEY_sign()
1555 EVP_PKEY_free(pkey); in test_EVP_PKEY_sign()
1563 EVP_PKEY *pkey = NULL; in test_EVP_PKEY_sign_with_app_method() local
1579 if (!TEST_ptr(pkey = load_example_rsa_key())) in test_EVP_PKEY_sign_with_app_method()
1584 if (!TEST_ptr(rsa = EVP_PKEY_get1_RSA(pkey)) in test_EVP_PKEY_sign_with_app_method()
1586 || !TEST_int_gt(EVP_PKEY_assign_RSA(pkey, rsa), 0)) in test_EVP_PKEY_sign_with_app_method()
1591 if (!TEST_ptr(pkey = load_example_dsa_key())) in test_EVP_PKEY_sign_with_app_method()
1596 if (!TEST_ptr(dsa = EVP_PKEY_get1_DSA(pkey)) in test_EVP_PKEY_sign_with_app_method()
1598 || !TEST_int_gt(EVP_PKEY_assign_DSA(pkey, dsa), 0)) 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()
1630 EVP_PKEY_free(pkey); in test_EVP_PKEY_sign_with_app_method()
1720 EVP_PKEY *pkey = NULL; in test_EVP_DigestSignInit() local
1754 if (!TEST_ptr(pkey = load_example_rsa_key())) in test_EVP_DigestSignInit()
1758 if (!TEST_ptr(pkey = load_example_dsa_key())) in test_EVP_DigestSignInit()
1765 if (!TEST_ptr(pkey = load_example_hmac_key())) in test_EVP_DigestSignInit()
1774 if (!TEST_true(EVP_DigestSignInit(md_ctx, NULL, md, NULL, pkey))) in test_EVP_DigestSignInit()
1834 NULL, pkey))) in test_EVP_DigestSignInit()
1872 EVP_PKEY_free(pkey); in test_EVP_DigestSignInit()
1883 EVP_PKEY *pkey = NULL; in test_EVP_DigestVerifyInit() local
1890 || !TEST_ptr(pkey = load_example_rsa_key())) in test_EVP_DigestVerifyInit()
1893 if (!TEST_true(EVP_DigestVerifyInit(md_ctx, NULL, EVP_sha256(), NULL, pkey)) in test_EVP_DigestVerifyInit()
1909 EVP_PKEY_free(pkey); in test_EVP_DigestVerifyInit()
1922 EVP_PKEY *pkey = NULL; in test_siphash_digestsign() local
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()
1958 EVP_PKEY_free(pkey); in test_siphash_digestsign()
2050 EVP_PKEY *pkey = NULL; in test_d2i_AutoPrivateKey() local
2057 if (!TEST_ptr(pkey = d2i_AutoPrivateKey(NULL, &p, input_len)) in test_d2i_AutoPrivateKey()
2059 || !TEST_int_eq(EVP_PKEY_get_id(pkey), expected_id)) in test_d2i_AutoPrivateKey()
2065 EVP_PKEY_free(pkey); in test_d2i_AutoPrivateKey()
2115 EVP_PKEY *pkey; in test_invalide_ec_char2_pub_range_decode() local
2117 pkey = load_example_key("EC", ec_der_pub_keys[id].der, in test_invalide_ec_char2_pub_range_decode()
2120 ret = (ec_der_pub_keys[id].valid && TEST_ptr(pkey)) in test_invalide_ec_char2_pub_range_decode()
2121 || TEST_ptr_null(pkey); in test_invalide_ec_char2_pub_range_decode()
2122 EVP_PKEY_free(pkey); in test_invalide_ec_char2_pub_range_decode()
2132 EVP_PKEY *pkey = NULL; in test_EVP_PKCS82PKEY() local
2142 if (!TEST_ptr_null(pkey = EVP_PKCS82PKEY(p8inf))) in test_EVP_PKCS82PKEY()
2149 EVP_PKEY_free(pkey); in test_EVP_PKCS82PKEY()
2157 EVP_PKEY *pkey = NULL; in test_EVP_PKCS82PKEY_wrong_tag() local
2169 || !TEST_ptr(pkey = load_example_rsa_key()) in test_EVP_PKCS82PKEY_wrong_tag()
2170 || !TEST_int_gt(i2d_PKCS8PrivateKey_bio(membio, pkey, NULL, in test_EVP_PKCS82PKEY_wrong_tag()
2182 EVP_PKEY_free(pkey); in test_EVP_PKCS82PKEY_wrong_tag()
2192 EVP_PKEY *pkey = NULL; in test_privatekey_to_pkcs8() local
2199 || !TEST_ptr(pkey = load_example_rsa_key()) in test_privatekey_to_pkcs8()
2200 || !TEST_int_gt(i2d_PKCS8PrivateKey_bio(membio, pkey, NULL, in test_privatekey_to_pkcs8()
2211 || !TEST_int_gt(PEM_write_bio_PKCS8PrivateKey(membio, pkey, NULL, in test_privatekey_to_pkcs8()
2218 EVP_PKEY_free(pkey); in test_privatekey_to_pkcs8()
2322 EVP_PKEY *pkey = NULL; in test_EVP_SM2_verify() local
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()
2335 if (!TEST_true(EVP_PKEY_is_a(pkey, "SM2"))) in test_EVP_SM2_verify()
2341 if (!TEST_ptr(pctx = EVP_PKEY_CTX_new_from_pkey(testctx, pkey, testpropq))) in test_EVP_SM2_verify()
2349 if (!TEST_true(EVP_DigestVerifyInit(mctx, NULL, sm3, NULL, pkey))) in test_EVP_SM2_verify()
2364 EVP_PKEY_free(pkey); in test_EVP_SM2_verify()
2374 EVP_PKEY *pkey = NULL; in test_EVP_SM2() local
2419 if (!TEST_true(EVP_PKEY_keygen(kctx, &pkey))) in test_EVP_SM2()
2428 if (!TEST_ptr(sctx = EVP_PKEY_CTX_new_from_pkey(testctx, pkey, testpropq))) in test_EVP_SM2()
2437 if (!TEST_true(EVP_DigestSignInit(md_ctx, NULL, check_md, NULL, pkey))) in test_EVP_SM2()
2459 pkey))) in test_EVP_SM2()
2477 pkey))) in test_EVP_SM2()
2511 pkey, testpropq))) in test_EVP_SM2()
2563 EVP_PKEY_free(pkey); in test_EVP_SM2()
2618 EVP_PKEY *pkey; in test_set_get_raw_keys_int() local
2631 pkey = EVP_PKEY_new_raw_public_key_ex( in test_set_get_raw_keys_int()
2638 pkey = EVP_PKEY_new_raw_public_key(keys[tst].type, in test_set_get_raw_keys_int()
2650 pkey = EVP_PKEY_new_raw_private_key_ex( in test_set_get_raw_keys_int()
2656 pkey = EVP_PKEY_new_raw_private_key(keys[tst].type, in test_set_get_raw_keys_int()
2663 if (!TEST_ptr(pkey) in test_set_get_raw_keys_int()
2664 || !TEST_int_eq(EVP_PKEY_eq(pkey, pkey), 1) 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()
2674 if ((!pub && !TEST_false(EVP_PKEY_get_raw_private_key(pkey, buf, in test_set_get_raw_keys_int()
2676 || (pub && !TEST_false(EVP_PKEY_get_raw_public_key(pkey, buf, in test_set_get_raw_keys_int()
2680 if ((!pub && !TEST_true(EVP_PKEY_get_raw_private_key(pkey, buf, &len))) in test_set_get_raw_keys_int()
2681 || (pub && !TEST_true(EVP_PKEY_get_raw_public_key(pkey, buf, &len))) in test_set_get_raw_keys_int()
2687 EVP_PKEY_free(pkey); in test_set_get_raw_keys_int()
2700 static int pkey_custom_check(EVP_PKEY *pkey) in pkey_custom_check() argument
2705 static int pkey_custom_pub_check(EVP_PKEY *pkey) in pkey_custom_pub_check() argument
2710 static int pkey_custom_param_check(EVP_PKEY *pkey) in pkey_custom_param_check() argument
2721 EVP_PKEY *pkey = NULL; in test_EVP_PKEY_check() local
2735 if (!TEST_ptr(pkey = load_example_key(ak->keytype, input, input_len))) in test_EVP_PKEY_check()
2738 && !TEST_int_eq(EVP_PKEY_get_id(pkey), expected_id)) in test_EVP_PKEY_check()
2741 if (!TEST_ptr(ctx = EVP_PKEY_CTX_new_from_pkey(testctx, pkey, testpropq))) in test_EVP_PKEY_check()
2756 EVP_PKEY_up_ref(pkey); in test_EVP_PKEY_check()
2757 ctx2->pkey = pkey; in test_EVP_PKEY_check()
2776 EVP_PKEY_free(pkey); in test_EVP_PKEY_check()
2781 static int get_cmac_val(EVP_PKEY *pkey, unsigned char *mac) in get_cmac_val() argument
2790 testpropq, pkey, NULL)) in get_cmac_val()
2809 EVP_PKEY *pkey = NULL; in test_CMAC_keygen() local
2832 || !TEST_int_gt(EVP_PKEY_keygen(kctx, &pkey), 0) in test_CMAC_keygen()
2833 || !TEST_ptr(pkey) in test_CMAC_keygen()
2834 || !TEST_true(get_cmac_val(pkey, mac))) in test_CMAC_keygen()
2838 EVP_PKEY_free(pkey); in test_CMAC_keygen()
2844 pkey = EVP_PKEY_new_CMAC_key(NULL, key, sizeof(key), EVP_aes_256_cbc()); in test_CMAC_keygen()
2845 if (!TEST_ptr(pkey) in test_CMAC_keygen()
2846 || !TEST_true(get_cmac_val(pkey, mac2)) in test_CMAC_keygen()
2854 EVP_PKEY_free(pkey); in test_CMAC_keygen()
3061 static int test_EVP_PKEY_CTX_get_set_params(EVP_PKEY *pkey) in test_EVP_PKEY_CTX_get_set_params() argument
3073 ctx = EVP_PKEY_CTX_new_from_pkey(testctx, pkey, testpropq); in test_EVP_PKEY_CTX_get_set_params()
3130 pkey, NULL))) in test_EVP_PKEY_CTX_get_set_params()
3169 EVP_PKEY *pkey = NULL; in test_DSA_get_set_params() local
3196 || !TEST_int_gt(EVP_PKEY_fromdata(pctx, &pkey, EVP_PKEY_KEYPAIR, in test_DSA_get_set_params()
3200 if (!TEST_ptr(pkey)) in test_DSA_get_set_params()
3203 ret = test_EVP_PKEY_CTX_get_set_params(pkey); in test_DSA_get_set_params()
3206 EVP_PKEY_free(pkey); in test_DSA_get_set_params()
3236 EVP_PKEY *pkey = NULL; in test_RSA_get_set_params() local
3257 || !TEST_int_gt(EVP_PKEY_fromdata(pctx, &pkey, EVP_PKEY_KEYPAIR, in test_RSA_get_set_params()
3261 if (!TEST_ptr(pkey)) in test_RSA_get_set_params()
3264 ret = test_EVP_PKEY_CTX_get_set_params(pkey); in test_RSA_get_set_params()
3267 EVP_PKEY_free(pkey); in test_RSA_get_set_params()
3374 EVP_PKEY *pkey = NULL; in test_RSA_legacy() local
3388 || !TEST_ptr(pkey = EVP_PKEY_new()) in test_RSA_legacy()
3403 if (!TEST_true(EVP_PKEY_assign_RSA(pkey, rsa))) in test_RSA_legacy()
3408 if (!TEST_true(EVP_DigestSignInit(ctx, NULL, md, NULL, pkey))) in test_RSA_legacy()
3416 EVP_PKEY_free(pkey); in test_RSA_legacy()
3585 EVP_PKEY *pkey = NULL; in test_keygen_with_empty_template() local
3608 || !TEST_int_gt(EVP_PKEY_keygen(ctx, &pkey), 0)) in test_keygen_with_empty_template()
3614 EVP_PKEY_free(pkey); in test_keygen_with_empty_template()
4033 EVP_PKEY *pkey = NULL; in test_ecpub() local
4050 || !TEST_true(EVP_PKEY_keygen(ctx, &pkey))) in test_ecpub()
4052 len = i2d_PublicKey(pkey, NULL); in test_ecpub()
4058 len = i2d_PublicKey(pkey, &p); in test_ecpub()
4075 if (!TEST_int_eq(EVP_PKEY_eq(pkey, pkey2), 1)) in test_ecpub()
4083 EVP_PKEY_free(pkey); in test_ecpub()
4096 EVP_PKEY *pkey = NULL; in test_EVP_rsa_pss_with_keygen_bits() local
4105 && TEST_true(EVP_PKEY_keygen(ctx, &pkey)); in test_EVP_rsa_pss_with_keygen_bits()
4108 EVP_PKEY_free(pkey); in test_EVP_rsa_pss_with_keygen_bits()
4116 EVP_PKEY *pkey = NULL; in test_EVP_rsa_pss_set_saltlen() local
4123 ret = TEST_ptr(pkey = load_example_rsa_key()) 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()
4133 EVP_PKEY_free(pkey); in test_EVP_rsa_pss_set_saltlen()
4142 EVP_PKEY *pkey = NULL; in test_EVP_rsa_invalid_key() local
4144 pkey = load_example_key("RSA", kInvalidRSAKeyDER, sizeof(kInvalidRSAKeyDER)); in test_EVP_rsa_invalid_key()
4146 ret = !TEST_ptr(pkey); in test_EVP_rsa_invalid_key()
4147 EVP_PKEY_free(pkey); in test_EVP_rsa_invalid_key()
4959 EVP_PKEY *pkey = NULL; in test_custom_pmeth() local
4978 pkey = load_example_rsa_key(); in test_custom_pmeth()
4984 pkey = load_example_dsa_key(); in test_custom_pmeth()
4993 pkey = load_example_ec_key(); in test_custom_pmeth()
5003 pkey = load_example_ed25519_key(); in test_custom_pmeth()
5013 pkey = load_example_dh_key(); in test_custom_pmeth()
5023 pkey = load_example_x25519_key(); in test_custom_pmeth()
5033 if (!TEST_ptr(pkey)) in test_custom_pmeth()
5037 if (!TEST_true(evp_pkey_is_provided(pkey))) in test_custom_pmeth()
5040 EVP_PKEY *tmp = pkey; in test_custom_pmeth()
5043 pkey = EVP_PKEY_new(); in test_custom_pmeth()
5044 if (!TEST_ptr(pkey)) { in test_custom_pmeth()
5045 pkey = tmp; in test_custom_pmeth()
5048 if (!TEST_true(evp_pkey_copy_downgraded(&pkey, tmp))) { in test_custom_pmeth()
5053 if (!TEST_true(evp_pkey_is_legacy(pkey))) in test_custom_pmeth()
5058 || !TEST_ptr(pkey)) in test_custom_pmeth()
5083 pctx = EVP_PKEY_CTX_new(pkey, NULL); in test_custom_pmeth()
5090 || !TEST_int_ge(EVP_PKEY_derive_set_peer(pctx, pkey), 1) in test_custom_pmeth()
5097 reslen = EVP_PKEY_size(pkey); in test_custom_pmeth()
5101 || !TEST_true(EVP_DigestSignInit(ctx, &pctx, md, NULL, pkey)) in test_custom_pmeth()
5124 EVP_PKEY_free(pkey); in test_custom_pmeth()
5335 EVP_PKEY *pkey = NULL; in test_signatures_with_engine() local
5374 pkey = EVP_PKEY_new_CMAC_key(e, cmackey, sizeof(cmackey), in test_signatures_with_engine()
5378 pkey = EVP_PKEY_new_CMAC_key(e, badcmackey, sizeof(badcmackey), in test_signatures_with_engine()
5382 pkey = EVP_PKEY_new_raw_private_key(EVP_PKEY_ED25519, e, ed25519key, in test_signatures_with_engine()
5389 if (!TEST_ptr(pkey)) in test_signatures_with_engine()
5396 pkey); in test_signatures_with_engine()
5420 EVP_PKEY_free(pkey); in test_signatures_with_engine()
5488 EVP_PKEY *pkey; in test_ecx_short_keys() local
5491 pkey = EVP_PKEY_new_raw_private_key_ex(testctx, OBJ_nid2sn(ecxnids[tst]), in test_ecx_short_keys()
5493 if (!TEST_ptr_null(pkey)) { in test_ecx_short_keys()
5494 EVP_PKEY_free(pkey); in test_ecx_short_keys()
5526 EVP_PKEY *pkey = NULL; in test_ecx_not_private_key() local
5549 pkey = EVP_PKEY_new_raw_public_key_ex(testctx, OBJ_nid2sn(keys[tst].type), in test_ecx_not_private_key()
5551 if (!TEST_ptr(pkey)) in test_ecx_not_private_key()
5557 if (EVP_DigestSignInit(ctx, NULL, NULL, NULL, pkey) != 1) in test_ecx_not_private_key()
5583 EVP_PKEY_free(pkey); in test_ecx_not_private_key()
5593 EVP_PKEY *pkey = NULL; in test_sign_continuation() local
5612 || !TEST_true(EVP_PKEY_fromdata(pctx, &pkey, EVP_PKEY_KEYPAIR, NULL)) in test_sign_continuation()
5613 || !TEST_ptr(pkey)) in test_sign_continuation()
5619 NULL, pkey, NULL)) in test_sign_continuation()
5631 NULL, pkey, nodup_params)) in test_sign_continuation()
5642 EVP_PKEY_free(pkey); in test_sign_continuation()