Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenSSL 3.0 hangs on exit with FIPS and badly formatted config file #12496

Closed
tomiii00 opened this issue Jul 20, 2020 · 4 comments
Closed

OpenSSL 3.0 hangs on exit with FIPS and badly formatted config file #12496

tomiii00 opened this issue Jul 20, 2020 · 4 comments
Labels
branch: master Merge to master branch triaged: bug The issue/pr is/fixes a bug triaged: OTC evaluated This issue/pr was triaged by OTC
Milestone

Comments

@tomiii00
Copy link
Contributor

If the FIPS provider is loaded manually and the providers section of the config file contains any lines with name=value where no [value] section exists, OpenSSL hangs on exit().

Section 7.1 of https://wiki.openssl.org/index.php/OpenSSL_3.0 says to put these lines "near the beginning" of the config file:

openssl_conf = openssl_init

.include /usr/local/ssl/fipsmodule.cnf

[openssl_init]
providers = provider_sect

[provider_sect]
fips = fips_sect

If these lines are placed at the very beginning of the config file, the existing default section becomes part of the [provider_sect] section and the existing HOME = . line causes OpenSSL to hang on exit() because there is no [.] section. Likewise, if you were to add foo = bar under [provider_sect] without creating a [bar] section, OpenSSL will hang on exit().

The problem only occurs under certain specific circumstances:

  1. A bad config file exists as described above
  2. The FIPS provider is loaded manually via OSSL_PROVIDER_load()
  3. A digest algorithm is fetched via EVP_get_digestbyname()
  4. The algorithm is actually used (e.g. by EVP_DigestInit_ex())

OR

  1. A bad config file exists as described above
  2. The FIPS provider is loaded manually via OSSL_PROVIDER_load()
  3. A digest algorithm is fetched via EVP_MD_fetch() (whether or not it is actually used later)

OR

  1. A bad config file exists as described above
  2. The FIPS provider is loaded manually via OSSL_PROVIDER_load()
  3. The FIPS provider is not unloaded via OSSL_PROVIDER_unload() prior to exit().

The first two scenarios above cause OpenSSL to hang whether or not the FIPS provider is manually unloaded prior to exit().

@mspncp
Copy link
Contributor

mspncp commented Jul 20, 2020

Note: this issue is a spinoff from thread OpenSSL 3.0 hangs at exit with FIPS provider on openssl-users, continued by [SOLVED] Re: OpenSSL 3.0 hangs at exit with FIPS provider

@mspncp mspncp added branch: master Merge to master branch triaged: bug The issue/pr is/fixes a bug labels Jul 20, 2020
@mspncp mspncp added this to To do in 3.0 New Core + FIPS via automation Jul 20, 2020
@richsalz
Copy link
Contributor

i believe the Wiki docs are outdated, and that https://www.openssl.org/docs/manmaster/man5/config.html and https://www.openssl.org/docs/manmaster/man5/fips_config.html are more accurate. In particular, there is really no reason for the FIPS config part to be "near the beginning" of the file.

@mattcaswell
Copy link
Member

The bit that needs to be near the beginning is:

openssl_conf = openssl_init

The rest probably doesn't

@kroeckx kroeckx added this to the 3.0.0 milestone Oct 7, 2020
@romen romen added the triaged: OTC evaluated This issue/pr was triaged by OTC label Nov 10, 2020
@mattcaswell
Copy link
Member

This issue now seems to be fixed. I was able to reproduce this problem on a checkout from around the time that this issue was raised. However I am unable to do so on latest master. Therefore I'm closing this.

3.0 New Core + FIPS automation moved this from To do to Done Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch: master Merge to master branch triaged: bug The issue/pr is/fixes a bug triaged: OTC evaluated This issue/pr was triaged by OTC
Projects
No open projects
Development

No branches or pull requests

6 participants