A local copy of OpenSSL from GitHub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

339 lines
8.4 KiB

=head1 NAME
The OpenSSL FIPS provider is a special provider that conforms to the Federal
Information Processing Standards (FIPS) specified in FIPS 140-2. This 'module'
contains an approved set of cryptographic algorithms that is validated by an
accredited testing laboratory.
=head2 Properties
The implementations in this provider specifically have these properties
=over 4
It may be used in a property query string with fetching functions such as
L<EVP_MD_fetch(3)> or L<EVP_CIPHER_fetch(3)>, as well as with other
functions that take a property query string, such as
It isn't mandatory to query for any of these properties, except to
make sure to get implementations of this provider and none other.
The "fips=yes" property can be use to make sure only FIPS approved
implementations are used for crypto operations. This may also include
other non-crypto support operations that are not in the fips provider,
such as asymmetric key serializers,
see L<OSSL_PROVIDER-default(7)/Asymmetric Key Management>.
The OpenSSL FIPS provider supports these operations and algorithms:
=head2 Hashing Algorithms / Message Digests
=over 4
=item SHA1, see L<EVP_MD-SHA1(7)>
=item SHA2, see L<EVP_MD-SHA2(7)>
=item SHA3, see L<EVP_MD-SHA3(7)>
=head2 Symmetric Ciphers
=over 4
=item AES, see L<EVP_CIPHER-AES(7)>
=item DES-EDE3 (TrippleDES), see L<EVP_CIPHER-DES(7)>
=head2 Message Authentication Code (MAC)
=over 4
=item CMAC, see L<EVP_MAC-CMAC(7)>
=item GMAC, see L<EVP_MAC-GMAC(7)>
=item HMAC, see L<EVP_MAC-HMAC(7)>
=item KMAC, see L<EVP_MAC-KMAC(7)>
=head2 Key Derivation Function (KDF)
=over 4
=item HKDF, see L<EVP_KDF-HKDF(7)>
=item SSKDF, see L<EVP_KDF-SSKDF(7)>
=item PBKDF2, see L<EVP_KDF-PBKDF2(7)>
=item TLS1-PRF, see L<EVP_KDF-TLS1-PRF(7)>
=item KBKDF, see L<EVP_KDF-KBKDF(7)>
=head2 Key Exchange
=over 4
=item DH, see L<EVP_KEYEXCH-DH(7)>
=head2 Asymmetric Signature
=over 4
=item DSA, see L<EVP_KEYEXCH-DSA(7)>
=head2 Asymmetric Cipher
=over 4
=item RSA, see L<EVP_KEYEXCH-RSA(7)>
=head2 Asymmetric Key Management
=over 4
=item DH, see L<EVP_KEYMGMT-DH(7)>
=item DSA, see L<EVP_KEYMGMT-DSA(7)>
=item RSA, see L<EVP_KEYMGMT-RSA(7)>
One of the requirements for the FIPS module is self testing. An optional callback
mechanism is available to return information to the user using
The parameters passed to the callback are described in L<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().
=over 4
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 digest.
Known answer test 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.
=item "Pairwise_Consistency_Test" (B<OSSL_SELF_TEST_TYPE_PCT>)
Conditional test that is run during the generation of key pairs.
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
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().
=over 4
"Module_Integrity" and "Install_Integrity" use this.
Key generation tests used with the "Pairwise_Consistency_Test" type.
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.
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;
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;
return ret;
=head1 SEE ALSO
=head1 HISTORY
The type and functions described here were added in OpenSSL 3.0.
Copyright 2019-2020 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