mirror of
https://github.com/openssl/openssl.git
synced 2025-01-18 13:44:20 +08:00
fips: set the library context and handle later
They need to be set once the provider will definitely be loading. If they are set earlier, a double free results on a failure. Fixes #15452 Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15492)
This commit is contained in:
parent
f839361e3e
commit
43dbe3b72d
@ -663,8 +663,6 @@ int OSSL_provider_init_int(const OSSL_CORE_HANDLE *handle,
|
|||||||
OSSL_LIB_CTX_free(libctx);
|
OSSL_LIB_CTX_free(libctx);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
ossl_prov_ctx_set0_libctx(*provctx, libctx);
|
|
||||||
ossl_prov_ctx_set0_handle(*provctx, handle);
|
|
||||||
|
|
||||||
if ((fgbl = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_FIPS_PROV_INDEX,
|
if ((fgbl = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_FIPS_PROV_INDEX,
|
||||||
&fips_prov_ossl_ctx_method)) == NULL)
|
&fips_prov_ossl_ctx_method)) == NULL)
|
||||||
@ -707,6 +705,9 @@ int OSSL_provider_init_int(const OSSL_CORE_HANDLE *handle,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ossl_prov_ctx_set0_libctx(*provctx, libctx);
|
||||||
|
ossl_prov_ctx_set0_handle(*provctx, handle);
|
||||||
|
|
||||||
*out = fips_dispatch_table;
|
*out = fips_dispatch_table;
|
||||||
return 1;
|
return 1;
|
||||||
err:
|
err:
|
||||||
|
Loading…
Reference in New Issue
Block a user