mirror of
https://github.com/openssl/openssl.git
synced 2025-01-18 13:44:20 +08:00
TEST: Use PEM_read_bio_PUBKEY_ex() and PEM_read_bio_PrivateKey_ex()
test/evp_test.c and test/sslapitest.c are affected. This allows them to decode keys found in stanza files via provider decoder implementations when a library context other than the default should be used. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/12673)
This commit is contained in:
parent
6e5ccd58c8
commit
5f2b7db09b
@ -3342,7 +3342,7 @@ start:
|
||||
}
|
||||
klist = &private_keys;
|
||||
} else if (strcmp(pp->key, "PublicKey") == 0) {
|
||||
pkey = PEM_read_bio_PUBKEY(t->s.key, NULL, 0, NULL);
|
||||
pkey = PEM_read_bio_PUBKEY_ex(t->s.key, NULL, 0, NULL, libctx, NULL);
|
||||
if (pkey == NULL && !key_unsupported()) {
|
||||
EVP_PKEY_free(pkey);
|
||||
TEST_info("Can't read public key %s", pp->value);
|
||||
|
@ -7511,7 +7511,9 @@ static int cert_cb(SSL *s, void *arg)
|
||||
BIO_free(in);
|
||||
if (!TEST_ptr(in = BIO_new(BIO_s_file()))
|
||||
|| !TEST_int_ge(BIO_read_filename(in, ecdsakey), 0)
|
||||
|| !TEST_ptr(pkey = PEM_read_bio_PrivateKey(in, NULL, NULL, NULL)))
|
||||
|| !TEST_ptr(pkey = PEM_read_bio_PrivateKey_ex(in, NULL,
|
||||
NULL, NULL,
|
||||
libctx, NULL)))
|
||||
goto out;
|
||||
rv = SSL_check_chain(s, x509, pkey, chain);
|
||||
/*
|
||||
@ -7656,8 +7658,9 @@ static int client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey)
|
||||
if (!TEST_ptr(xcert = X509_new_with_libctx(libctx, NULL))
|
||||
|| !TEST_ptr(PEM_read_bio_X509(in, &xcert, NULL, NULL))
|
||||
|| !TEST_ptr(priv_in = BIO_new_file(privkey, "r"))
|
||||
|| !TEST_ptr(privpkey = PEM_read_bio_PrivateKey(priv_in, NULL, NULL,
|
||||
NULL)))
|
||||
|| !TEST_ptr(privpkey = PEM_read_bio_PrivateKey_ex(priv_in, NULL,
|
||||
NULL, NULL,
|
||||
libctx, NULL)))
|
||||
goto err;
|
||||
|
||||
*x509 = xcert;
|
||||
|
Loading…
Reference in New Issue
Block a user