@@ -1212,7 +1212,6 @@ int wolfssl_provider_init(const OSSL_CORE_HANDLE* handle,
12121212 const OSSL_DISPATCH * in , const OSSL_DISPATCH * * out , void * * provCtx )
12131213{
12141214 int ok = 1 ;
1215- OSSL_FUNC_core_get_libctx_fn * c_get_libctx = NULL ;
12161215
12171216#ifdef WOLFPROV_DEBUG
12181217 ok = (wolfProv_Debugging_ON () == 0 );
@@ -1253,9 +1252,6 @@ int wolfssl_provider_init(const OSSL_CORE_HANDLE* handle,
12531252 case OSSL_FUNC_CORE_GET_PARAMS :
12541253 c_get_params = OSSL_FUNC_core_get_params (in );
12551254 break ;
1256- case OSSL_FUNC_CORE_GET_LIBCTX :
1257- c_get_libctx = OSSL_FUNC_core_get_libctx (in );
1258- break ;
12591255 case OSSL_FUNC_BIO_READ_EX :
12601256 c_bio_read_ex = OSSL_FUNC_BIO_read_ex (in );
12611257 break ;
@@ -1283,10 +1279,6 @@ int wolfssl_provider_init(const OSSL_CORE_HANDLE* handle,
12831279 }
12841280 }
12851281
1286- if (c_get_libctx == NULL ) {
1287- ok = 0 ;
1288- }
1289-
12901282 if (ok ) {
12911283 /* Create a new provider context. */
12921284 * provCtx = wolfssl_prov_ctx_new ();
@@ -1295,9 +1287,11 @@ int wolfssl_provider_init(const OSSL_CORE_HANDLE* handle,
12951287 }
12961288 }
12971289 if (ok ) {
1298- /* Store the library context in provider context. */
1290+ /* Using the OSSL_FUNC_core_get_libctx can yield you an
1291+ * uninitialized libctx in certain init flows. Instead create
1292+ * a new child libctx. The child libctx being NULL is allowed. */
12991293 wolfssl_prov_ctx_set0_lib_ctx (* provCtx ,
1300- ( OSSL_LIB_CTX * ) c_get_libctx ( handle ));
1294+ OSSL_LIB_CTX_new_child ( handle , in ));
13011295 /* Cache the handle in provider context. */
13021296 wolfssl_prov_ctx_set0_handle (* provCtx , handle );
13031297
0 commit comments