FIPS_MODULE(7ossl)

πŸ’… NAME πŸ’…

fips_module β€” OpenSSL fips module guide

✨ SYNOPSIS ✨

See the individual manual pages for details.

πŸŽ€ DESCRIPTION πŸŽ€

Okay bestie, welcome to the fips_module(7ossl) page β€” the OpenSSL FIPS module guide πŸ’–. This guide spills the different ways OpenSSL can be used in conjunction with the FIPS module. Which one is the right move for you depends on your own specific circumstances and what you’re attempting to achieve.

For info related to installing the FIPS module, see https://github.com/openssl/openssl/blob/master/README-FIPS.md.

Heads up: the old functions FIPS_mode() and FIPS_mode_set() are no longer present, so you must remove them from your application if you use them.

Applications written to use the OpenSSL 3.0 FIPS module should not use any legacy APIs or features that avoid the FIPS module. Specifically this includes:

  • Low level cryptographic APIs (use the high level APIs, such as EVP, instead)
  • Engines
  • Any functions that create or modify custom "METHODS" (for example EVP_MD_meth_new(), EVP_CIPHER_meth_new(), EVP_PKEY_meth_new(), RSA_meth_new(), EC_KEY_METHOD_new(), etc.)

All of the above APIs are deprecated in OpenSSL 3.0 β€” so a simple rule is to avoid using all deprecated functions. See ossl-guide-migration(7) for a list of deprecated functions.

🌸 Making all applications use the FIPS module by default 🌸

One simple approach is to cause all applications that are using OpenSSL to only use the FIPS module for cryptographic algorithms by default.

This approach can be done purely via configuration. As long as applications are built and linked against OpenSSL 3.0 and do not override the loading of the default config file or its settings, then they can automatically start using the FIPS module without the need for any further code changes.

To do this the default OpenSSL config file will have to be modified. The location of this config file will depend on the platform, and any options that were given during the build process. You can check the location of the config file by running this command:

$ openssl version -d
OPENSSLDIR: "/usr/local/ssl"
Caution: Many Operating Systems install OpenSSL by default. It is a common error to not have the correct version of OpenSSL in your $PATH. Check that you are running an OpenSSL 3.0 version like this:
$ openssl version -v
OpenSSL 3.0.0-dev xx XXX xxxx (Library: OpenSSL 3.0.0-dev xx XXX xxxx)

The OPENSSLDIR value above gives the directory name for where the default config file is stored. So in this case the default config file will be called /usr/local/ssl/openssl.cnf.

Edit the config file to add the following lines near the beginning:

config_diagnostics = 1
openssl_conf = openssl_init

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

[openssl_init]
providers = provider_sect
alg_section = algorithm_sect

[provider_sect]
fips = fips_sect
base = base_sect

[base_sect]
activate = 1

[algorithm_sect]
default_properties = fips=yes

Obviously the include file location above should match the path and name of the FIPS module config file that you installed earlier. See https://github.com/openssl/openssl/blob/master/README-FIPS.md.

For FIPS usage, it is recommended that the config_diagnostics option is enabled to prevent accidental use of non-FIPS validated algorithms via broken or mistaken configuration. See config(5).

Any applications that use OpenSSL 3.0 and are started after these changes are made will start using only the FIPS module unless those applications take explicit steps to avoid this default behaviour. Note that this configuration also activates the "base" provider. The base provider does not include any cryptographic algorithms (and therefore does not impact the validation status of any cryptographic operations), but does include other supporting algorithms that may be required. It is designed to be used in conjunction with the FIPS module.

This approach has the primary advantage that it is simple, and no code changes are required in applications in order to benefit from the FIPS module. There are some disadvantages to this approach:

  • You may not want all applications to use the FIPS module. It may be the case that some applications should and some should not use the FIPS module.
  • If applications take explicit steps to not load the default config file or set different settings. This method will not work for these cases.
  • The algorithms available in the FIPS module are a subset of the algorithms that are available in the default OpenSSL Provider. If any applications attempt to use any algorithms that are not present, then they will fail.
  • Usage of certain deprecated APIs avoids the use of the FIPS module. If any applications use those APIs then the FIPS module will not be used.

πŸ¦‹ Selectively making applications use the FIPS module by default πŸ¦‹

A variation on the above approach is to do the same thing on an individual application basis. The default OpenSSL config file depends on the compiled in value for OPENSSLDIR as described in the section above. However it is also possible to override the config file to be used via the OPENSSL_CONF environment variable. For example the following, on Unix, will cause the application to be executed with a non-standard config file location:

$ OPENSSL_CONF=/my/nondefault/openssl.cnf myapplication

Using this mechanism you can control which config file is loaded (and hence whether the FIPS module is loaded) on an application by application basis.

This removes the disadvantage listed above that you may not want all applications to use the FIPS module. All the other advantages and disadvantages still apply.

πŸ’œ Programmatically loading the FIPS module (default library context) πŸ’œ

Applications may choose to load the FIPS provider explicitly rather than relying on config to do this. The config file is still necessary in order to hold the FIPS module config data (such as its self test status and integrity data). But in this case we do not automatically activate the FIPS provider via that config file.

To do things this way configure as per β€œMaking all applications use the FIPS module by default” above, but edit the fipsmodule.cnf file to remove or comment out the line which says activate = 1 (note that setting this value to 0 is not sufficient). This means all the required config information will be available to load the FIPS module, but it is not automatically loaded when the application starts. The FIPS provider can then be loaded programmatically like this:

#include <openssl/provider.h>

int main(void)
{
    OSSL_PROVIDER *fips;
    OSSL_PROVIDER *base;

    fips = OSSL_PROVIDER_load(NULL, "fips");
    if (fips == NULL) {
        printf("Failed to load FIPS provider\n");
        exit(EXIT_FAILURE);
    }
    base = OSSL_PROVIDER_load(NULL, "base");
    if (base == NULL) {
        OSSL_PROVIDER_unload(fips);
        printf("Failed to load base provider\n");
        exit(EXIT_FAILURE);
    }

    /* Rest of application */

    OSSL_PROVIDER_unload(base);
    OSSL_PROVIDER_unload(fips);
    exit(EXIT_SUCCESS);
}

Note that this should be one of the first things that you do in your application. If any OpenSSL functions get called that require the use of cryptographic functions before this occurs then, if no provider has yet been loaded, then the default provider will be automatically loaded. If you then later explicitly load the FIPS provider then you will have both the FIPS and the default provider loaded at the same time. It is unspecified which implementation of an algorithm will be used if multiple implementations are available and you have not explicitly specified via a property query (see below) which one should be used.

Also note that in this example we have additionally loaded the "base" provider. This loads a sub-set of algorithms that are also available in the default provider β€” specifically non cryptographic ones which may be used in conjunction with the FIPS provider. For example this contains algorithms for encoding and decoding keys. If you decide not to load the default provider then you will usually want to load the base provider instead.

In this example we are using the "default" library context. OpenSSL functions operate within the scope of a library context. If no library context is explicitly specified then the default library context is used. For further details about library contexts see the OSSL_LIB_CTX(3) man page.

🌈 Loading the FIPS module at the same time as other providers 🌈

It is possible to have the FIPS provider and other providers (such as the default provider) all loaded at the same time into the same library context. You can use a property query string during algorithm fetches to specify which implementation you would like to use.

For example to fetch an implementation of SHA256 which conforms to FIPS standards you can specify the property query "fips=yes" like this:

EVP_MD *sha256;

sha256 = EVP_MD_fetch(NULL, "SHA2-256", "fips=yes");

If no property query is specified, or more than one implementation matches the property query then it is unspecified which implementation of a particular algorithm will be returned.

This example shows an explicit request for an implementation of SHA256 from the default provider:

EVP_MD *sha256;

sha256 = EVP_MD_fetch(NULL, "SHA2-256", "provider=default");

It is also possible to set a default property query string. The following example sets the default property query of "fips=yes" for all fetches within the default library context:

EVP_set_default_properties(NULL, "fips=yes");

If a fetch function has both an explicit property query specified, and a default property query is defined then the two queries are merged together and both apply. The local property query overrides the default properties if the same property name is specified in both.

There are two important built-in properties that you should be aware of:

The "provider" property enables you to specify which provider you want an implementation to be fetched from, e.g. "provider=default" or "provider=fips". All algorithms implemented in a provider have this property set on them. πŸ’…

There's also the fips property, bestie πŸ’… β€” every single FIPS algorithm matches against the property query fips=yes. And plot twist: some non-cryptographic algorithms hanging out in the default and base providers also have fips=yes defined on them. These are the encoder and decoder algorithms, which you can use (for example) to write out a key that was generated in the FIPS provider into a file ✨. The encoders and decoders are not inside the FIPS module itself, but they're allowed to be used alongside the FIPS algorithms. No cap.

You can also set default properties inside a config file, which is lowkey iconic. For example, this config file automatically loads the default and FIPS providers and sets the default property value to fips=yes. Heads up though: this config file does not load the base provider β€” all the supporting algorithms that live in base are also in default, so it's unnecessary in this case 🫢:

config_diagnostics = 1
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

🧚 Programmatically loading the FIPS module (nondefault library context)

So besides using properties to separate FIPS module usage from everything else, you can also do it with library contexts πŸ‘‘. In this example we make two library contexts: one where we assume a config file called openssl-fips.cnf exists that automatically loads and configures the FIPS and base providers, and another library context that just uses the default provider.

OSSL_LIB_CTX *fips_libctx, *nonfips_libctx;
OSSL_PROVIDER *defctxnull = NULL;
EVP_MD *fipssha256 = NULL, *nonfipssha256 = NULL;
int ret = 1;

/*
 * Create two nondefault library contexts. One for fips usage and
 * one for non-fips usage
 */
fips_libctx = OSSL_LIB_CTX_new();
nonfips_libctx = OSSL_LIB_CTX_new();
if (fips_libctx == NULL || nonfips_libctx == NULL)
    goto err;

/* Prevent anything from using the default library context */
defctxnull = OSSL_PROVIDER_load(NULL, "null");

/*
 * Load config file for the FIPS library context. We assume that
 * this config file will automatically activate the FIPS and base
 * providers so we don't need to explicitly load them here.
 */
if (!OSSL_LIB_CTX_load_config(fips_libctx, "openssl-fips.cnf"))
    goto err;

/*
 * Set the default property query on the FIPS library context to
 * ensure that only FIPS algorithms can be used.  There are a few non-FIPS
 * approved algorithms in the FIPS provider for backward compatibility reasons.
 */
if (!EVP_set_default_properties(fips_libctx, "fips=yes"))
    goto err;

/*
 * We don't need to do anything special to load the default
 * provider into nonfips_libctx. This happens automatically if no
 * other providers are loaded.
 * Because we don't call OSSL_LIB_CTX_load_config() explicitly for
 * nonfips_libctx it will just use the default config file.
 */

/* As an example get some digests */

/* Get a FIPS validated digest */
fipssha256 = EVP_MD_fetch(fips_libctx, "SHA2-256", NULL);
if (fipssha256 == NULL)
    goto err;

/* Get a non-FIPS validated digest */
nonfipssha256 = EVP_MD_fetch(nonfips_libctx, "SHA2-256", NULL);
if (nonfipssha256 == NULL)
    goto err;

/* Use the digests */

printf("Success\n");
ret = 0;

err:
EVP_MD_free(fipssha256);
EVP_MD_free(nonfipssha256);
OSSL_LIB_CTX_free(fips_libctx);
OSSL_LIB_CTX_free(nonfips_libctx);
OSSL_PROVIDER_unload(defctxnull);

return ret;

Okay so notice we used the special null provider here, loaded into the default library context πŸŽ€. We could have used the default library context for FIPS usage and just made one extra library context for other stuff β€” or the other way round. But here's the tea: if code hasn't been converted to use library contexts, then the default library context gets used automatically 😭. That could be your own existing apps, and also certain parts of OpenSSL itself β€” not all parts of OpenSSL are library context aware. If that happens, you could "accidentally" use the wrong library context for a particular operation. To be sure this doesn't happen, you can load the null provider into the default library context. Because a provider has been explicitly loaded, the default provider will not automatically load β€” which means code using the default context by accident will fail, since no algorithms will be available πŸ’€.

See "Library Context" in ossl-guide-migration(7) for extra info about the Library Context ✨.


🌸 Using Encoders and Decoders with the FIPS module

Encoders and decoders are how you read and write keys or parameters from or to some external format (like a PEM file, iykyk). If your app generates keys or parameters that then need to be written into PEM or DER format, you'll probably need an encoder for that 🫢. Same deal the other way β€” you need a decoder to read previously saved keys and parameters. In most cases this is invisible to you if you're using APIs that existed in OpenSSL 1.1.1 or earlier, such as i2d_PrivateKey(3). But the appropriate encoder/decoder needs to be available in the library context associated with the key or parameter object πŸ‘‘. The built-in OpenSSL encoders and decoders are implemented in both the default and base providers, and they are not in the FIPS module boundary. However, since they're not cryptographic algorithms themselves, you can still use them alongside the FIPS module β€” which is exactly why these encoders/decoders have the fips=yes property on them πŸ’…. Just make sure either the default or base provider is loaded into the library context in that case.


πŸ¦‹ Using the FIPS module in SSL/TLS

Writing an app that uses libssl together with the FIPS module is literally just like writing a normal libssl app 🌈. If you're using global properties and the default library context to specify usage of FIPS validated algorithms, that'll happen automatically for all cryptographic algorithms in libssl. And if you're using a nondefault library context to load the FIPS provider, you can hand it to libssl with the function SSL_CTX_new_ex(3) ✨. It works as a drop-in replacement for SSL_CTX_new(3) except it gives you the ability to specify the library context to use. You can also use the same function to specify libssl specific properties to use πŸŽ€.

In this first example we make two SSL_CTX objects using two different library contexts:

/*
 * We assume that a nondefault library context with the FIPS
 * provider loaded has been created called fips_libctx.
 */
SSL_CTX *fips_ssl_ctx = SSL_CTX_new_ex(fips_libctx, "fips=yes", TLS_method());
/*
 * We assume that a nondefault library context with the default
 * provider loaded has been created called non_fips_libctx.
 */
SSL_CTX *non_fips_ssl_ctx = SSL_CTX_new_ex(non_fips_libctx, NULL,
                                           TLS_method());

And in this second example we make two SSL_CTX objects using different properties to specify FIPS usage:

/*
 * The "fips=yes" property includes all FIPS approved algorithms
 * as well as encoders from the default provider that are allowed
 * to be used. The NULL below indicates that we are using the
 * default library context.
 */
SSL_CTX *fips_ssl_ctx = SSL_CTX_new_ex(NULL, "fips=yes", TLS_method());
/*
 * The "provider!=fips" property allows algorithms from any
 * provider except the FIPS provider
 */
SSL_CTX *non_fips_ssl_ctx = SSL_CTX_new_ex(NULL, "provider!=fips",
                                           TLS_method());

πŸ’œ Confirming that an algorithm is being provided by the FIPS module

To get from an algorithm instance to the provider that implements it, you gotta follow a whole chain of links πŸ”—. The process is the same for all algorithms β€” here we use a digest as the example.

To go from an EVP_MD_CTX to an EVP_MD, use EVP_MD_CTX_md(3). To go from the EVP_MD to its OSSL_PROVIDER, use EVP_MD_get0_provider(3). To extract the name from the OSSL_PROVIDER, use OSSL_PROVIDER_get0_name(3). Slay, that's the whole chain πŸ’….


⭐ FIPS indicators

FIPS indicators got added to the FIPS provider in OpenSSL 3.4 πŸŽ‰. FIPS 140-3 requires indicators to be used if the FIPS provider allows non approved algorithms. An algorithm is approved if it passes all required checks, such as minimum key size βœ…. By default, an error will occur if any check fails. For backwards compatibility, individual algorithms may override the checks by using either an option in the FIPS configuration (see "FIPS indicator options" in fips_config(5)) or in code using an algorithm context setter. Overriding the check means that the algorithm is not FIPS compliant 😭. OSSL_INDICATOR_set_callback(3) can be called to register a callback to log unapproved algorithms πŸ“. At the end of any algorithm operation the approved status can be queried using an algorithm context getter to retrieve the indicator (e.g. fips-indicator). An example of an algorithm context setter is key-check in "Supported parameters" in EVP_KDF-HKDF(7) 🫢.

Every algorithm implementation advertised with the property fips=yes by the OpenSSL FIPS provider exposes fips-indicator as a gettable context parameter ✨. The getter returns 1 when the operation is approved. An absent indicator must not be interpreted as approval ⚠️.

Algorithms advertised with fips=no are unapproved. When such an implementation exposes fips-indicator, its getter returns 0. Providers other than the OpenSSL FIPS provider are not required to expose this parameter β€” an absent indicator, or an indicator value of 0, does not assert FIPS approval πŸ’€.

Some algorithms can flip from approved to unapproved as a result of their parameters or the operation performed 😬. The following algorithms perform such additional checks:

  • DSA Key generation β€” DSA Key generation is no longer approved. See "DSA parameters" in EVP_PKEY-DSA(7).
  • DSA Signatures β€” DSA Signature generation is no longer approved. See "Signature Parameters" in EVP_SIGNATURE-DSA(7).
  • ECDSA Signatures β€” See "ECDSA Signature Parameters" in EVP_SIGNATURE-ECDSA(7).

✨ EC Key Generation ✨

See "Common EC parameters" in EVP_PKEY-EC(7) β€” that’s the whole vibe here 🌱.

🌸 ML-KEM Key Encapsulation 🌸

Supplying the test-only ikme parameter makes the operation unapproved. See "ML-KEM KEM parameters" in EVP_KEM-ML-KEM(7).

πŸ¦‹ ML-DSA and SLH-DSA Signatures πŸ¦‹

Supplying test entropy makes the operation unapproved. ML-DSA operations that disable the standard message encoding are also unapproved. See "FIPS indicator" in EVP_SIGNATURE-ML-DSA(7) and "FIPS indicator" in EVP_SIGNATURE-SLH-DSA(7).

πŸ‘‘ RSA Key Generation πŸ‘‘

Supplying the parameters reserved for FIPS module testing makes the operation unapproved. See "RSA key generation FIPS indicator" in EVP_PKEY-RSA(7).

πŸ”₯ RSA Encryption πŸ”₯

pkcs1 padding is no longer approved.

See "RSA Asymmetric Cipher parameters" in EVP_ASYM_CIPHER-RSA(7) and "RSA KEM parameters" in EVP_KEM-RSA(7).

πŸ’– RSA Signatures πŸ’–

See "Signature Parameters" in EVP_SIGNATURE-RSA(7).

πŸ’… DRBGS πŸ’…

See "Supported parameters" in EVP_RAND-HASH-DRBG(7) and EVP_RAND-HMAC-DRBG(7)/Supported parameters>.

πŸ’€ DES πŸ’€

Triple-DES is no longer approved for encryption. See "Parameters" in EVP_CIPHER-DES(7).

πŸŒ€ DH πŸŒ€

See "DH and DHX key exchange parameters" in EVP_KEYEXCH-DH(7).

🌿 ECDH 🌿

See "ECDH Key Exchange parameters" in EVP_KEYEXCH-ECDH(7).

πŸ”‘ KDFS πŸ”‘

See relevant KDF documentation e.g. "Supported parameters" in EVP_KDF-HKDF(7).

🧬 CMAC and KMAC 🧬

See "Supported parameters" in EVP_MAC-CMAC(7) and "Supported parameters" in EVP_MAC-KMAC(7).


The following FIPS algorithms are unapproved and use the fips-indicator.

🎲 RAND-TEST-RAND 🎲

See "Supported parameters" in EVP_RAND-TEST-RAND(7). The indicator callback is NOT triggered for this algorithm since it is used internally for non security purposes.

⭐ X25519 and X448 Key Generation and Key Exchange ⭐

🌟 X448MLKEM1024 Key Generation and Key Encapsulation 🌟

The other hybrid ML-KEM algorithms supplied by the FIPS provider are approved, including X25519MLKEM768, SecP256r1MLKEM768 and SecP384r1MLKEM1024.

The unapproved (non FIPS validated) algorithms have a property query value of fips=no.

The following algorithms use a unique indicator and do not trigger the indicator callback.

πŸ’œ AES-GCM ciphers support the indicator iv-generated πŸ’œ

See "PARAMETERS" in EVP_EncryptInit(3) for further information. The AES-GCM fips-indicator also accounts for the IV source and returns 0 after encryption with an externally supplied IV. It also returns 0 for GCM tag lengths other than 4, 8, or 12 through 16 bytes.

🫢 ECDSA and RSA Signatures support the indicator verify-message 🫢

See "ECDSA Signature Parameters" in EVP_SIGNATURE-ECDSA(7) and "Signature Parameters" in EVP_SIGNATURE-RSA(7) for further information. The signature fips-indicator also accounts for this value and returns 0 when verification is performed directly on a caller-supplied digest.

πŸ“ NOTES πŸ“

Some released versions of OpenSSL do not include a validated FIPS provider. To determine which versions have undergone the validation process, please refer to the OpenSSL Downloads page at https://openssl-library.org/source/. If you require FIPS-approved functionality, it is essential to build your FIPS provider using one of the validated versions listed there. Normally, it is possible to utilize a FIPS provider constructed from one of the validated versions alongside libcrypto and libssl compiled from any supported release from OpenSSL 3.0 onwards; provider compatibility is maintained backward and forward across these releases, including future major release series, for as long as the module remains supported. This flexibility enables you to address bug fixes and CVEs that fall outside the FIPS boundary.

Important, bestie: As the FIPS provider still supports non-FIPS validated algorithms, the property query fips=yes is mandatory for applications that want to operate in a FIPS approved manner.

πŸ‘€ SEE ALSO πŸ‘€

πŸ•°οΈ HISTORY πŸ•°οΈ

The FIPS module guide was created for use with the new FIPS provider in OpenSSL 3.0. FIPS indicators were added in OpenSSL 3.4.

Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at https://www.openssl.org/source/license.html.


This was FIPS_MODULE(7ossl) from OpenSSL 3.5.9, dated 2026-09-29 β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from