if (!test_get_libctx(&libctx, &default_null_provider, &provider, 5, USAGE))
return 0;
- if (!TEST_ptr(server_key = load_pem_key(server_key_f))
+ if (!TEST_ptr(server_key = load_pem_key(server_key_f, libctx))
|| !TEST_ptr(server_cert = load_pem_cert(server_cert_f, libctx))
- || !TEST_ptr(client_key = load_pem_key(client_key_f))
+ || !TEST_ptr(client_key = load_pem_key(client_key_f, libctx))
|| !TEST_ptr(client_cert = load_pem_cert(client_cert_f, libctx))
|| !TEST_int_eq(1, RAND_bytes_ex(libctx, ref, sizeof(ref)))) {
cleanup_tests();
if (!test_get_libctx(&libctx, &default_null_provider, &provider, 3, USAGE))
return 0;
- if (!TEST_ptr(newkey = load_pem_key(newkey_f))
+ if (!TEST_ptr(newkey = load_pem_key(newkey_f, libctx))
|| !TEST_ptr(cert = load_pem_cert(server_cert_f, libctx))
|| !TEST_int_eq(1, RAND_bytes_ex(libctx, ref, sizeof(ref)))) {
cleanup_tests();
if (!test_get_libctx(&libctx, &default_null_provider, &provider, 10, USAGE))
return 0;
- if (!TEST_ptr(loadedkey = load_pem_key(server_key_f))
+ if (!TEST_ptr(loadedkey = load_pem_key(server_key_f, libctx))
|| !TEST_ptr(cert = load_pem_cert(server_cert_f, libctx)))
return 0;
- if (!TEST_ptr(loadedprivkey = load_pem_key(server_f)))
+ if (!TEST_ptr(loadedprivkey = load_pem_key(server_f, libctx)))
return 0;
if (TEST_true(EVP_PKEY_up_ref(loadedprivkey)))
loadedpubkey = loadedprivkey;
DEFINE_STACK_OF(X509)
-EVP_PKEY *load_pem_key(const char *file)
+EVP_PKEY *load_pem_key(const char *file, OPENSSL_CTX *libctx)
{
EVP_PKEY *key = NULL;
BIO *bio = NULL;
if (!TEST_ptr(bio = BIO_new(BIO_s_file())))
return NULL;
if (TEST_int_gt(BIO_read_filename(bio, file), 0))
- (void)TEST_ptr(key = PEM_read_bio_PrivateKey(bio, NULL, NULL, NULL));
+ (void)TEST_ptr(key = PEM_read_bio_PrivateKey_ex(bio, NULL, NULL, NULL,
+ libctx, NULL));
BIO_free(bio);
return key;
# ifndef OPENSSL_NO_CMP
# define CMP_TEST_REFVALUE_LENGTH 15 /* arbitrary value */
-EVP_PKEY *load_pem_key(const char *file);
+EVP_PKEY *load_pem_key(const char *file, OPENSSL_CTX *libctx);
X509 *load_pem_cert(const char *file, OPENSSL_CTX *libctx);
X509_REQ *load_csr(const char *file);
OSSL_CMP_MSG *load_pkimsg(const char *file);