openssl: OpenSSL 3.0.1: FIPS provider not available
In migrating my OpenSSL 1.0.2 FIPS app to OpenSSL 3.0.1, I am having difficulty in loading the FIPS module. I am following closely the “Programmatically loading the FIPS module (default library context)” section of the fips module guide doc.
With the following changes, FIPS module failed to load. In fact, OSSL_PROVIDER_available(NULL, "fips") returns 0.
Can someone please review my changes and see what might still be missing?
Config/Installation changes:
enable-fips,--api=1.1.1, and--libdir=libwere added toconfig(latter 2 for app compat)- After build & install,
openssl-3.0.1/providers/fips.so,openssl-3.0.1/providers/fipsmodule.cnfandopenssl-3.0.1/apps/openssl.cnfwere copied from the build VM to the app VM.
App changes:
- Edited the
openssl.cnfto have the settings described in the fips module guide. - Pointed app to the openssl config location:
OPENSSL_config("/opt/uno/etc/openssl.cnf") - Added the following loading code:
const char* default_search_path = "/opt/uno/lib/crypto";
OSSL_PROVIDER_set_default_search_path(NULL, default_search_path);
if (!OSSL_PROVIDER_available(NULL, "fips")) {
SvcLog(LEVEL_ERROR, "FIPS provider not available");
return false;
}
fips = OSSL_PROVIDER_load(NULL, "fips");
if (fips == NULL) {
SvcLog(LEVEL_ERROR,"Failed to load FIPS provider\n");
return false;
}
Key file locations in app:
[root@ven-rhel lib]# ls /opt/uno/lib/crypto/fips.so
/opt/uno/lib/crypto/fips.so
[root@ven-rhel etc]# ls /opt/uno/etc/openssl.cnf /opt/uno/etc/fipsmodule.cnf
/opt/uno/etc/fipsmodule.cnf /opt/uno/etc/openssl.cnf
Selected content from openssl.cnf
openssl_conf = openssl_init
.include fipsmodule.cnf
[openssl_init]
providers = provider_sect
[provider_sect]
fips = fips_sect
base = base_sect
[base_sect]
activate = 1
fipsmodule.cnf content
[root@ven-rhel etc]# cat fipsmodule.cnf
[fips_sect]
# activate = 1
conditional-errors = 1
security-checks = 1
module-mac = 67:48:52:5C:46:50:3C:D9:FD:73:DD:77:C0:51:DB:1C:32:48:8D:73:DA:CF:55:B6:38:C9:40:C1:54:7B:B6:D1
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 29 (15 by maintainers)
You need to somehow load the fipsmodule.cnf file. The easiest way to do that is to properly include it from the default openssl.cnf file.
make installin a build with enable-fips should create the fipsmodule.cnf with the module checksum. Doesn’t it for you?The fipsmodule.cnf can be placed anywhere. The point is that it must be somehow loaded which is not done automatically.
./fipsmodule.cnfis not an absolute path. You need to use absolute path or setOPENSSL_CONF_INCLUDEenvironment variable, otherwise the file is looked up in the current working directory of the process that loads the openssl library.Yeah, we should adjust the sample openssl.cnf to not use the relative path.