=pod =head1 NAME OSSL_PROVIDER-FIPS - OpenSSL FIPS provider =head1 DESCRIPTION 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 defined: =over 4 =item "provider=default" =item "fips=yes" =back It may be used in a property query string with fetching functions such as L or L, as well as with other functions that take a property query string, such as L. 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 encoders, see L. =head1 OPERATIONS AND ALGORITHMS The OpenSSL FIPS provider supports these operations and algorithms: =head2 Hashing Algorithms / Message Digests =over 4 =item SHA1, see L =item SHA2, see L =item SHA3, see L =item KECCAK-KMAC, see L =back =head2 Symmetric Ciphers =over 4 =item AES, see L =item DES-EDE3 (TrippleDES), see L =back =head2 Message Authentication Code (MAC) =over 4 =item CMAC, see L =item GMAC, see L =item HMAC, see L =item KMAC, see L =back =head2 Key Derivation Function (KDF) =over 4 =item HKDF, see L =item SSKDF, see L =item PBKDF2, see L =item SSHKDF, see L =item TLS1-PRF, see L =item KBKDF, see L =item X942KDF-ASN1, see L =item X942KDF-CONCAT, see L =item X963KDF, see L =back =head2 Key Exchange =over 4 =item DH, see L =item ECDH, see L =item X25519, see L This has the property "provider=fips,fips=no" =item X448, see L This has the property "provider=fips,fips=no" =back =head2 Asymmetric Signature =over 4 =item DSA, see L =item RSA, see L =item HMAC, see L =item CMAC, see L =back =head2 Asymmetric Cipher =over 4 =item RSA, see L =back =head2 Asymmetric Key Encapsulation =over 4 =item RSA, see L =back =head2 Asymmetric Key Management =over 4 =item DH, see L =item DSA, see L =item RSA, see L =back =head1 SELF TESTING One of the requirements for the FIPS module is self testing. An optional callback mechanism is available to return information to the user using L. The parameters passed to the callback are described in L 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 =item "Module_Integrity" (B) 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. =item "Install_Integrity" (B) 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. =item "KAT_Cipher" (B) Known answer test for a symmetric cipher. =item "KAT_AsymmetricCipher" (B) Known answer test for a asymmetric cipher. =item "KAT_Digest" (B) Known answer test for a digest. =item "KAT_Signature" (B) Known answer test for a signature. =item "KAT_KDF" (B) Known answer test for a key derivation function. =item "KAT_KA" (B) Known answer test for key agreement. =item "DRBG" (B) Known answer test for a Deterministic Random Bit Generator. =item "Pairwise_Consistency_Test" (B) Conditional test that is run during the generation of key pairs. =item "Continuous_RNG_Test" (B) Continuous random number generator test. =back 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(). =over 4 =item "HMAC" (B) "Module_Integrity" and "Install_Integrity" use this. =item "RSA" (B) =item "ECDSA" (B) =item "DSA" (B) Key generation tests used with the "Pairwise_Consistency_Test" type. =item "RSA_Encrypt" (B) =item "RSA_Decrypt" (B) "KAT_AsymmetricCipher" uses this to indicate an encrypt or decrypt KAT. =item "AES_GCM_Encrypt" (B) =item "AES_ECB_Decrypt" (B) =item "TDES" (B) Symmetric cipher tests used with the "KAT_Cipher" type. =item "SHA1" (B) =item "SHA2" (B) =item "SHA3" (B) Digest tests used with the "KAT_Digest" type. =item "DSA" (B) =item "RSA" (B) =item "ECDSA" (B) Signature tests used with the "KAT_Signature" type. =item "ECDH" (B) =item "DH" (B) Key agreement tests used with the "KAT_KA" type. =item "HKDF" (B) =item "SSKDF" (B) =item "X963KDF" (B) =item "X942KDF" (B) =item "PBKDF2" (B) =item "SSHKDF" (B) =item "TLS12_PRF" (B) =item "KBKDF" (B) Key Derivation Function tests used with the "KAT_KDF" type. =item "CTR" (B) =item "HASH" (B) =item "HMAC" (B) DRBG tests used with the "DRBG" type. = item "RNG" (B) "Continuous_RNG_Test" uses this. =back =head1 EXAMPLES A simple self test callback is shown below for illustrative purposes. #include 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; } =head1 SEE ALSO L, L, L, L, L, L, L, L =head1 HISTORY The type and functions described here were added in OpenSSL 3.0. =head1 COPYRIGHT 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 L. =cut