OSSL_PROVIDER-FIPS - OpenSSL FIPS provider
The OpenSSL FIPS provider is a special provider that conforms to the Federal Information Processing Standards (FIPS) specified in FIPS 140-3. This 'module' contains an approved set of cryptographic algorithms that is validated by an accredited testing laboratory.
The implementations in this provider specifically have these properties defined:
It may be used in a property query string with fetching functions such as EVP_MD_fetch(3) or EVP_CIPHER_fetch(3), as well as with other functions that take a property query string, such as EVP_PKEY_CTX_new_from_name(3).
To be FIPS compliant, it is mandatory to include fips=yes
as part of all property queries. This ensures that only FIPS approved implementations are used for cryptographic operations. The fips=yes
query may also include other non-crypto support operations that are not in the FIPS provider, such as asymmetric key encoders, see "Asymmetric Key Management" in OSSL_PROVIDER-default(7).
It is not mandatory to include provider=fips
as part of your property query. Including provider=fips
in your property query guarantees that the OpenSSL FIPS provider is used for cryptographic operations rather than other FIPS capable providers.
See "Provider parameters" in provider-base(7) for a list of base parameters. Additionally the OpenSSL FIPS provider also supports the following gettable parameters:
For further information refer to the openssl-fipsinstall(1) option -no_security_checks.
The OpenSSL FIPS provider supports these operations and algorithms:
This is an unapproved algorithm.
This is an unapproved algorithm.
This is an unapproved algorithm.
This is an unapproved algorithm.
This is an unapproved algorithm.
TEST-RAND is an unapproved algorithm.
One of the requirements for the FIPS module is self testing. An optional callback mechanism is available to return information to the user using OSSL_SELF_TEST_set_callback(3).
The parameters passed to the callback are described in OSSL_SELF_TEST_new(3)
The OpenSSL FIPS module uses the following mechanism to provide information about the self tests as they run. This is useful for debugging if a self test is failing. The callback also allows forcing any self test to fail, in order to check that it operates correctly on failure. Note that all self tests run even if a self test failure occurs.
The FIPS module passes the following type(s) to OSSL_SELF_TEST_onbegin().
Uses HMAC SHA256 on the module file to validate that the module has not been modified. The integrity value is compared to a value written to a configuration file during installation.
Uses HMAC SHA256 on a fixed string to validate that the installation process has already been performed and the self test KATS have already been tested, The integrity value is compared to a value written to a configuration file after successfully running the self tests during installation.
Known answer test for a symmetric cipher.
Known answer test for a asymmetric cipher.
Known answer test for a digest.
Known answer test for a signature.
Pairwise Consistency check for a signature.
Known answer test for a key derivation function.
Known answer test for key agreement.
Known answer test for a Deterministic Random Bit Generator.
Conditional test that is run during the generation of key pairs.
Continuous random number generator test.
The "Module_Integrity" self test is always run at startup. The "Install_Integrity" self test is used to check if the self tests have already been run at installation time. If they have already run then the self tests are not run on subsequent startups. All other self test categories are run once at installation time, except for the "Pairwise_Consistency_Test".
There is only one instance of the "Module_Integrity" and "Install_Integrity" self tests. All other self tests may have multiple instances.
The FIPS module passes the following descriptions(s) to OSSL_SELF_TEST_onbegin().
"Module_Integrity" and "Install_Integrity" use this.
Key generation tests used with the "Pairwise_Consistency_Test" type.
"KAT_AsymmetricCipher" uses this to indicate an encrypt or decrypt KAT.
Symmetric cipher tests used with the "KAT_Cipher" type.
Digest tests used with the "KAT_Digest" type.
Signature tests used with the "KAT_Signature" type.
Key agreement tests used with the "KAT_KA" type.
Key Derivation Function tests used with the "KAT_KDF" type.
DRBG tests used with the "DRBG" type.
"Continuous_RNG_Test" uses this.
A simple self test callback is shown below for illustrative purposes.
#include <openssl/self_test.h>
static OSSL_CALLBACK self_test_cb;
static int self_test_cb(const OSSL_PARAM params[], void *arg)
{
int ret = 0;
const OSSL_PARAM *p = NULL;
const char *phase = NULL, *type = NULL, *desc = NULL;
p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_PHASE);
if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)
goto err;
phase = (const char *)p->data;
p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_DESC);
if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)
goto err;
desc = (const char *)p->data;
p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_TYPE);
if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)
goto err;
type = (const char *)p->data;
/* Do some logging */
if (strcmp(phase, OSSL_SELF_TEST_PHASE_START) == 0)
BIO_printf(bio_out, "%s : (%s) : ", desc, type);
if (strcmp(phase, OSSL_SELF_TEST_PHASE_PASS) == 0
|| strcmp(phase, OSSL_SELF_TEST_PHASE_FAIL) == 0)
BIO_printf(bio_out, "%s\n", phase);
/* Corrupt the SHA1 self test during the 'corrupt' phase by returning 0 */
if (strcmp(phase, OSSL_SELF_TEST_PHASE_CORRUPT) == 0
&& strcmp(desc, OSSL_SELF_TEST_DESC_MD_SHA1) == 0) {
BIO_printf(bio_out, "%s %s", phase, desc);
return 0;
}
ret = 1;
err:
return ret;
}
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. 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 release within the same major release series. This flexibility enables you to address bug fixes and CVEs that fall outside the FIPS boundary.
The FIPS provider in OpenSSL 3.1 includes some non-FIPS validated algorithms, consequently the property query fips=yes
is mandatory for applications that want to operate in a FIPS approved manner. The algorithms are:
openssl-fipsinstall(1), fips_config(5), OSSL_SELF_TEST_set_callback(3), OSSL_SELF_TEST_new(3), OSSL_PARAM(3), openssl-core.h(7), openssl-core_dispatch.h(7), provider(7), https://www.openssl.org/source/
This functionality was added in OpenSSL 3.0.
Copyright 2019-2024 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.