openssl: Fips self test is being triggered multiple times..
The fipsprov.c entry point OSSL_provider_init calls SELF_TEST_post() which then does a EVP_fetch (it will do more once the KATS are added) … As the provider has not yet activated the fetch causes some fallback setup to be called which then calls OSSL_provider_init() a second time…
The dummy_evp_call() will be suffering from the same issues…
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 46 (46 by maintainers)
Commits related to this issue
- Make sure we only run the self tests once Fixes #9909 — committed to mattcaswell/openssl by mattcaswell 5 years ago
Possibly we can go for the “.ini”/“.fini” solution but fallback to the run-the-tests-on-every-load solution for any platforms where this is not possible (or just using an unknown compiler where we don’t know how to do it).
IMO, the solution to this issue is as follows:
OPENSSL_CTX *ctx = OPENSSL_CTX_new(“/path/to/default/config/file”);
Or possibly as some additional calls after the OPENSSL_CTX has been constructed.
The above solution assumes all interesting platforms can support .ini and .fini sections. Is this the case? Possible alternatives could be:
The config file is not the problem. If you only use the default context then the FIPS Provider will only be loaded once. The problem is loading a default context and an explicit context. That loads the provider twice - once for each context. That is exactly the intended behaviour. The issue we have to resolve is ensuring that that the self test only happens once per physical DSO load (as opposed to provider load). A DSO gets loaded into memory once - but the provider inside it can be loaded multiple times (depending on how many contexts you are using).