openssl: Openssl 3.0.5 - How to make default provider not available for fips

I am building an application using the fips module. I am following the migration guide.

My openssl.cnf looks like this

openssl_conf = openssl_init

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

[openssl_init]
providers = provider_sect

[provider_sect]
fips = fips_sect
base = base_sect

[base_sect]
activate = 1

and fipsmodule.cnf

[fips_sect]
activate = 1
install-version = 1
conditional-errors = 1
security-checks = 1
module-mac = 01:FC:36:9C:48:0D:3D:46:B8:52:BC:7A:49:64:EA:91:69:FB:0E:7C:7C:64:B7:C4:FF:C4:82:D9:8B:45:FB:C0
install-mac = 41:9C:38:C2:8F:59:09:43:2C:AA:2F:58:36:2D:D9:04:F9:6C:56:8B:09:E0:18:3A:2E:D6:CC:69:05:04:E1:11
install-status = INSTALL_SELF_TEST_KATS_RUN

When i start my application i use the method OSSL_PROVIDER_available to see which provider are available as for example for fips

   if (OSSL_PROVIDER_available(NULL, "fips") == 1)
   {
      printf("LOADING fips provider.\n");
   }

With this configuration the providers fips, base and default are available. However, i do not wish to have the default provider for my fips implementation so i did what was recommended in the documentation and added the code .

   /* Disallow falling back to the default library context */
   OSSL_PROVIDER* nullp = OSSL_PROVIDER_load(NULL, "null");

With this code i got only the providers fips and base as i think was correct for my fips only application (fips + base)

However is there a way to do this using only the configuration openssl.cnf file. I have try several things such as adding the default provider in the file and remove the activate =1 such as

openssl_conf = openssl_init

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

[openssl_init]
providers = provider_sect

[provider_sect]
fips = fips_sect
base = base_sect
default = default_sect

[base_sect]
activate = 1

[default_sect]
#activate = 1

But this did not work, i still got the providers fips, base and default as available.

I am still confused a little bit if i load the fips provider and the default provider would openssl fallback to the default provider if a cipher is not available in the fips provider ?

I also read in the wiki that the property fips=yes exists… Is this the way to go …

openssl_conf = openssl_init
 
 .include /usr/local/ssl/fipsmodule.cnf
 
 [openssl_init]
 providers = provider_sect
 alg_section = algorithm_sect
 
 [provider_sect]
 fips = fips_sect
 default = default_sect
 
 [default_sect]
 activate = 1
 
 [algorithm_sect]
 default_properties = fips=yes

Best regards

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (12 by maintainers)

Most upvoted comments

Hi, i have added the line

OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);

at the start of my main function and now i can only see the fips and the base providers as expected.

Thank you all very much for your quick answers.

Best regards