Lines Matching refs:pkey
79 static int ssl_set_pkey(CERT *cert, EVP_PKEY *pkey) { in ssl_set_pkey() argument
80 if (!ssl_is_key_type_supported(pkey->type)) { in ssl_set_pkey()
88 !ssl_cert_check_private_key(cert, pkey)) { in ssl_set_pkey()
93 EVP_PKEY_up_ref(pkey); in ssl_set_pkey()
94 cert->privatekey = pkey; in ssl_set_pkey()
142 static int pkey_supports_algorithm(const SSL *ssl, EVP_PKEY *pkey, in pkey_supports_algorithm() argument
146 EVP_PKEY_id(pkey) != alg->pkey_type) { in pkey_supports_algorithm()
160 EC_KEY_get0_group(EVP_PKEY_get0_EC_KEY(pkey))) != alg->curve)) { in pkey_supports_algorithm()
168 static int setup_ctx(SSL *ssl, EVP_MD_CTX *ctx, EVP_PKEY *pkey, uint16_t sigalg, in setup_ctx() argument
170 if (!pkey_supports_algorithm(ssl, pkey, sigalg)) { in setup_ctx()
179 if (!EVP_DigestVerifyInit(ctx, &pctx, digest, NULL, pkey)) { in setup_ctx()
182 } else if (!EVP_DigestSignInit(ctx, &pctx, digest, NULL, pkey)) { in setup_ctx()
225 uint16_t sigalg, EVP_PKEY *pkey, in ssl_public_key_verify() argument
228 return setup_ctx(ssl, ctx.get(), pkey, sigalg, 1 /* verify */) && in ssl_public_key_verify()
302 UniquePtr<EVP_PKEY> pkey(EVP_PKEY_new()); in SSL_use_RSAPrivateKey() local
303 if (!pkey || in SSL_use_RSAPrivateKey()
304 !EVP_PKEY_set1_RSA(pkey.get(), rsa)) { in SSL_use_RSAPrivateKey()
309 return ssl_set_pkey(ssl->cert, pkey.get()); in SSL_use_RSAPrivateKey()
322 int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey) { in SSL_use_PrivateKey() argument
323 if (pkey == NULL) { in SSL_use_PrivateKey()
328 return ssl_set_pkey(ssl->cert, pkey); in SSL_use_PrivateKey()
339 UniquePtr<EVP_PKEY> pkey(d2i_PrivateKey(type, NULL, &p, (long)der_len)); in SSL_use_PrivateKey_ASN1() local
340 if (!pkey || p != der + der_len) { in SSL_use_PrivateKey_ASN1()
345 return SSL_use_PrivateKey(ssl, pkey.get()); in SSL_use_PrivateKey_ASN1()
354 UniquePtr<EVP_PKEY> pkey(EVP_PKEY_new()); in SSL_CTX_use_RSAPrivateKey() local
355 if (!pkey || in SSL_CTX_use_RSAPrivateKey()
356 !EVP_PKEY_set1_RSA(pkey.get(), rsa)) { in SSL_CTX_use_RSAPrivateKey()
361 return ssl_set_pkey(ctx->cert, pkey.get()); in SSL_CTX_use_RSAPrivateKey()
375 int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey) { in SSL_CTX_use_PrivateKey() argument
376 if (pkey == NULL) { in SSL_CTX_use_PrivateKey()
381 return ssl_set_pkey(ctx->cert, pkey); in SSL_CTX_use_PrivateKey()
392 UniquePtr<EVP_PKEY> pkey(d2i_PrivateKey(type, NULL, &p, (long)der_len)); in SSL_CTX_use_PrivateKey_ASN1() local
393 if (!pkey || p != der + der_len) { in SSL_CTX_use_PrivateKey_ASN1()
398 return SSL_CTX_use_PrivateKey(ctx, pkey.get()); in SSL_CTX_use_PrivateKey_ASN1()