1=pod 2 3=head1 NAME 4 5OSSL_PROVIDER-FIPS - OpenSSL FIPS provider 6 7=head1 DESCRIPTION 8 9The OpenSSL FIPS provider is a special provider that conforms to the Federal 10Information Processing Standards (FIPS) specified in FIPS 140-3. This 'module' 11contains an approved set of cryptographic algorithms that is validated by an 12accredited testing laboratory. 13 14=head2 Properties 15 16The implementations in this provider specifically have these properties 17defined for approved algorithms: 18 19=over 4 20 21=item "provider=fips" 22 23=item "fips=yes" 24 25=back 26 27It may be used in a property query string with fetching functions such as 28L<EVP_MD_fetch(3)> or L<EVP_CIPHER_fetch(3)>, as well as with other 29functions that take a property query string, such as 30L<EVP_PKEY_CTX_new_from_name(3)>. 31 32To be FIPS compliant, it is mandatory to include C<fips=yes> as 33part of all property queries. This ensures that only FIPS approved 34implementations are used for cryptographic operations. The C<fips=yes> 35query may also include other non-crypto support operations that 36are not in the FIPS provider, such as asymmetric key encoders, see 37L<OSSL_PROVIDER-default(7)/Asymmetric Key Management>. 38 39It is not mandatory to include C<provider=fips> as part of your property 40query. Including C<provider=fips> in your property query guarantees 41that the OpenSSL FIPS provider is used for cryptographic operations 42rather than other FIPS capable providers. 43 44=head2 Approved algorithms 45 46Algorithms that are fetched using "fips=yes" may still be unapproved if certain 47conditions are not met. See L<fips_module(7)/FIPS indicators> for additional 48information. 49 50=head2 Provider parameters 51 52See L<provider-base(7)/Provider parameters> for a list of base parameters. 53The OpenSSL FIPS provider also handles FIPS indicator related parameters as 54specified by L<fips_config(5)/FIPS indicator options>. 55 56=head1 OPERATIONS AND ALGORITHMS 57 58The OpenSSL FIPS provider supports these operations and algorithms: 59 60=head2 Hashing Algorithms / Message Digests 61 62=over 4 63 64=item SHA1, see L<EVP_MD-SHA1(7)> 65 66=item SHA2, see L<EVP_MD-SHA2(7)> 67 68=item SHA3, see L<EVP_MD-SHA3(7)> 69 70=item KECCAK-KMAC, see L<EVP_MD-KECCAK-KMAC(7)> 71 72=item SHAKE, see L<EVP_MD-SHAKE(7)> 73 74=back 75 76=head2 Symmetric Ciphers 77 78=over 4 79 80=item AES, see L<EVP_CIPHER-AES(7)> 81 82=item 3DES, see L<EVP_CIPHER-DES(7)> 83 84=back 85 86=head2 Message Authentication Code (MAC) 87 88=over 4 89 90=item CMAC, see L<EVP_MAC-CMAC(7)> 91 92=item GMAC, see L<EVP_MAC-GMAC(7)> 93 94=item HMAC, see L<EVP_MAC-HMAC(7)> 95 96=item KMAC, see L<EVP_MAC-KMAC(7)> 97 98=back 99 100=head2 Key Derivation Function (KDF) 101 102=over 4 103 104=item HKDF, see L<EVP_KDF-HKDF(7)> 105 106=item TLS13-KDF, see L<EVP_KDF-TLS13_KDF(7)> 107 108=item SSKDF, see L<EVP_KDF-SS(7)> 109 110=item PBKDF2, see L<EVP_KDF-PBKDF2(7)> 111 112=item SSHKDF, see L<EVP_KDF-SSHKDF(7)> 113 114=item TLS1-PRF, see L<EVP_KDF-TLS1_PRF(7)> 115 116=item KBKDF, see L<EVP_KDF-KB(7)> 117 118=item X942KDF-ASN1, see L<EVP_KDF-X942-ASN1(7)> 119 120=item X942KDF-CONCAT, see L<EVP_KDF-X942-CONCAT(7)> 121 122=item X963KDF, see L<EVP_KDF-X963(7)> 123 124=back 125 126=head2 Key Exchange 127 128=over 4 129 130=item DH, see L<EVP_KEYEXCH-DH(7)> 131 132=item ECDH, see L<EVP_KEYEXCH-ECDH(7)> 133 134=item X25519, see L<EVP_KEYEXCH-X25519(7)> 135 136=item X448, see L<EVP_KEYEXCH-X448(7)> 137 138=item ML-KEM, see L<EVP_KEM-ML-KEM(7)> 139 140=item TLS1-PRF 141 142=item HKDF 143 144=back 145 146=head2 Asymmetric Signature 147 148=over 4 149 150=item RSA, see L<EVP_SIGNATURE-RSA(7)> 151 152The B<X931> padding mode "OSSL_PKEY_RSA_PAD_MODE_X931" is no longer supported 153for signature generation, but may be used for verification for legacy use cases. 154(This is a FIPS 140-3 requirement) 155 156=item DSA, see L<EVP_SIGNATURE-DSA(7)> 157 158=item ED25519, see L<EVP_SIGNATURE-ED25519(7)> 159 160=item ED448, see L<EVP_SIGNATURE-ED448(7)> 161 162=item ECDSA, see L<EVP_SIGNATURE-ECDSA(7)> 163 164=item ML-DSA-44, see L<EVP_SIGNATURE-ML-DSA(7)> 165 166=item ML-DSA-65, see L<EVP_SIGNATURE-ML-DSA(7)> 167 168=item ML-DSA-87, see L<EVP_SIGNATURE-ML-DSA(7)> 169 170=item SLH-DSA, see L<EVP_SIGNATURE-SLH-DSA(7)> 171 172=item HMAC, see L<EVP_SIGNATURE-HMAC(7)> 173 174=item CMAC, see L<EVP_SIGNATURE-CMAC(7)> 175 176=back 177 178=head2 Asymmetric Cipher 179 180=over 4 181 182=item RSA, see L<EVP_ASYM_CIPHER-RSA(7)> 183 184=back 185 186=head2 Asymmetric Key Encapsulation 187 188=over 4 189 190=item RSA, see L<EVP_KEM-RSA(7)> 191 192=back 193 194=head2 Asymmetric Key Management 195 196=over 4 197 198=item DH, see L<EVP_KEYMGMT-DH(7)> 199 200=item DHX, see L<EVP_KEYMGMT-DHX(7)> 201 202=item DSA, see L<EVP_KEYMGMT-DSA(7)> 203 204=item RSA, see L<EVP_KEYMGMT-RSA(7)> 205 206=item RSA-PSS 207 208=item EC, see L<EVP_KEYMGMT-EC(7)> 209 210=item ED25519, see L<EVP_KEYMGMT-ED25519(7)> 211 212=item ED448, see L<EVP_KEYMGMT-ED448(7)> 213 214=item X25519, see L<EVP_KEYMGMT-X25519(7)> 215 216This is an unapproved algorithm. 217The FIPS 140-3 IG states that "Curves that are included in SP 800-186 but not 218included in SP 800-56Arev3 are not approved for key agreement". 219 220=item X448, see L<EVP_KEYMGMT-X448(7)> 221 222This is an unapproved algorithm. 223The FIPS 140-3 IG states that "Curves that are included in SP 800-186 but not" 224included in SP 800-56Arev3 are not approved for key agreement". 225 226=item TLS1-PRF 227 228=item HKDF 229 230=item HMAC, see L<EVP_KEYMGMT-HMAC(7)> 231 232=item CMAC, see L<EVP_KEYMGMT-CMAC(7)> 233 234=item ML-DSA-44, see L<EVP_KEYMGMT-ML-DSA(7)> 235 236=item ML-DSA-65, see L<EVP_KEYMGMT-ML-DSA(7)> 237 238=item ML-DSA-87, see L<EVP_KEYMGMT-ML-DSA(7)> 239 240=item SLH-DSA-SHA2-128s, see L<EVP_KEYMGMT-SLH-DSA(7)> 241 242=item SLH-DSA-SHA2-128f, see L<EVP_KEYMGMT-SLH-DSA(7)> 243 244=item SLH-DSA-SHA2-192s, see L<EVP_KEYMGMT-SLH-DSA(7)> 245 246=item SLH-DSA-SHA2-192f, see L<EVP_KEYMGMT-SLH-DSA(7)> 247 248=item SLH-DSA-SHA2-256s, see L<EVP_KEYMGMT-SLH-DSA(7)> 249 250=item SLH-DSA-SHA2-256f, see L<EVP_KEYMGMT-SLH-DSA(7)> 251 252=item SLH-DSA-SHAKE-128s, see L<EVP_KEYMGMT-SLH-DSA(7)> 253 254=item SLH-DSA-SHAKE-128f, see L<EVP_KEYMGMT-SLH-DSA(7)> 255 256=item SLH-DSA-SHAKE-192s, see L<EVP_KEYMGMT-SLH-DSA(7)> 257 258=item SLH-DSA-SHAKE-192f, see L<EVP_KEYMGMT-SLH-DSA(7)> 259 260=item SLH-DSA-SHAKE-256s, see L<EVP_KEYMGMT-SLH-DSA(7)> 261 262=item SLH-DSA-SHAKE-256f, see L<EVP_KEYMGMT-SLH-DSA(7)> 263 264=back 265 266=head2 Random Number Generation 267 268=over 4 269 270=item CRNG-TEST, see L<EVP_RAND-CRNG-TEST(7)> 271 272=item CTR-DRBG, see L<EVP_RAND-CTR-DRBG(7)> 273 274=item HASH-DRBG, see L<EVP_RAND-HASH-DRBG(7)> 275 276=item HMAC-DRBG, see L<EVP_RAND-HMAC-DRBG(7)> 277 278=item TEST-RAND, see L<EVP_RAND-TEST-RAND(7)> 279 280TEST-RAND is an unapproved algorithm. 281 282=back 283 284=head1 SELF TESTING 285 286A requirement of FIPS modules is to run cryptographic algorithm self tests. 287FIPS 140-3 requires known answer tests to be run on startup as well as 288conditional tests that run during cryptographic operations. 289 290An optional callback mechanism is available to return information to the user using 291L<OSSL_SELF_TEST_set_callback(3)>. 292 293The parameters passed to the callback are described in L<OSSL_SELF_TEST_new(3)> 294 295The OpenSSL FIPS module uses the following mechanism to provide information 296about the self tests as they run. 297This is useful for debugging if a self test is failing. 298The callback also allows forcing any self test to fail, in order to check that 299it operates correctly on failure. 300Note that all self tests run even if a self test failure occurs. 301 302The FIPS module passes the following type(s) to OSSL_SELF_TEST_onbegin(). 303 304=over 4 305 306=item "Module_Integrity" (B<OSSL_SELF_TEST_TYPE_MODULE_INTEGRITY>) 307 308Uses HMAC SHA256 on the module file to validate that the module has not been 309modified. The integrity value is compared to a value written to a configuration 310file during installation. 311 312=item "KAT_Integrity" (B<OSSL_SELF_TEST_TYPE_KAT_INTEGRITY>) 313 314Used during the Module Integrity test to perform a known answer test on 315HMAC SHA256 prior to using it. 316 317=item "KAT_Cipher" (B<OSSL_SELF_TEST_TYPE_KAT_CIPHER>) 318 319Known answer test for a symmetric cipher. 320 321=item "KAT_AsymmetricCipher" (B<OSSL_SELF_TEST_TYPE_KAT_ASYM_CIPHER>) 322 323Known answer test for a asymmetric cipher. 324 325=item "KAT_Digest" (B<OSSL_SELF_TEST_TYPE_KAT_DIGEST>) 326 327Known answer test for a digest. 328 329=item "KAT_AsymmetricKeyGeneration" (B<OSSL_SELF_TEST_TYPE_KAT_ASYM_KEYGEN>) 330 331Known answer test for asymmetric key generation. 332 333=item "KAT_Signature" (B<OSSL_SELF_TEST_TYPE_KAT_SIGNATURE>) 334 335Known answer test for a signature. 336 337=item "PCT_Signature" (B<OSSL_SELF_TEST_TYPE_PCT_SIGNATURE>) 338 339Pairwise Consistency check for a signature. 340 341=item "KAT_KDF" (B<OSSL_SELF_TEST_TYPE_KAT_KDF>) 342 343Known answer test for a key derivation function. 344 345=item "KAT_KA" (B<OSSL_SELF_TEST_TYPE_KAT_KA>) 346 347Known answer test for key agreement. 348 349=item "KAT_KEM" (B<OSSL_SELF_TEST_TYPE_KAT_KEM>) 350 351Known answer test for key encapsulation. 352 353=item "DRBG" (B<OSSL_SELF_TEST_TYPE_DRBG>) 354 355Known answer test for a Deterministic Random Bit Generator. 356 357=item "Conditional_PCT" (B<OSSL_SELF_TEST_TYPE_PCT>) 358 359Conditional test that is run during the generation of key pairs. 360 361=item "Import_PCT" (B<OSSL_SELF_TEST_TYPE_PCT_IMPORT>) 362 363Conditional test that is run during the import of key pairs. 364 365=item "Conditional_KAT" (B<OSSL_SELF_TEST_TYPE_PCT_KAT>) 366 367Conditional test run during generation that derive the public key from the 368private key and checks that the public key matches. This is a SP 800-56A requirement. 369 370=item "Continuous_RNG_Test" (B<OSSL_SELF_TEST_TYPE_CRNG>) 371 372Continuous random number generator test. 373 374=item "Install_Integrity" (B<OSSL_SELF_TEST_TYPE_INSTALL_INTEGRITY>) 375 376This is deprecated. The option is no longer used since FIPS 140-3 requires 377self tests to always run on startup. Previous FIPS 140-2 validations allowed 378the self tests to be run just once. 379 380=back 381 382The FIPS module passes the following descriptions(s) to OSSL_SELF_TEST_onbegin(). 383 384=over 4 385 386=item "HMAC" (B<OSSL_SELF_TEST_DESC_INTEGRITY_HMAC>) 387 388"Module_Integrity" uses this. 389 390=item "RSA" (B<OSSL_SELF_TEST_DESC_PCT_RSA_PKCS1>) 391 392=item "RSA" (B<OSSL_SELF_TEST_DESC_PCT_RSA>) 393 394=item "ECDSA" (B<OSSL_SELF_TEST_DESC_PCT_ECDSA>) 395 396=item "EDDSA" (B<OSSL_SELF_TEST_DESC_PCT_EDDSA>) 397 398=item "DSA" (B<OSSL_SELF_TEST_DESC_PCT_DSA>) 399 400=item "ML-DSA" (B<OSSL_SELF_TEST_DESC_PCT_ML_DSA>) 401 402=item "ML-KEM" (B<OSSL_SELF_TEST_DESC_PCT_ML_KEM>) 403 404=item "SLH-DSA" (B<OSSL_SELF_TEST_DESC_PCT_SLH_DSA>) 405 406Key generation tests used with the "Pairwise_Consistency_Test" type. 407 408=item "RSA_Encrypt" (B<OSSL_SELF_TEST_DESC_ASYM_RSA_ENC>) 409 410=item "RSA_Decrypt" (B<OSSL_SELF_TEST_DESC_ASYM_RSA_DEC>) 411 412"KAT_AsymmetricCipher" uses this to indicate an encrypt or decrypt KAT. 413 414=item "ML-DSA" (B<OSSL_SELF_TEST_DESC_KEYGEN_ML_DSA>) 415 416=item "ML-KEM" (B<OSSL_SELF_TEST_DESC_KEYGEN_ML_KEM>) 417 418=item "SLH-DSA" (B<OSSL_SELF_TEST_DESC_KEYGEN_SLH_DSA>) 419 420"KAT_AsymmetricKeyGeneration" uses this to indicate a key generation KAT. 421 422=item "AES_GCM" (B<OSSL_SELF_TEST_DESC_CIPHER_AES_GCM>) 423 424=item "AES_ECB_Decrypt" (B<OSSL_SELF_TEST_DESC_CIPHER_AES_ECB>) 425 426=item "TDES" (B<OSSL_SELF_TEST_DESC_CIPHER_TDES>) 427 428Symmetric cipher tests used with the "KAT_Cipher" type. 429 430=item "SHA1" (B<OSSL_SELF_TEST_DESC_MD_SHA1>) 431 432=item "SHA2" (B<OSSL_SELF_TEST_DESC_MD_SHA2>) 433 434=item "SHA3" (B<OSSL_SELF_TEST_DESC_MD_SHA3>) 435 436Digest tests used with the "KAT_Digest" type. 437 438=item "DSA" (B<OSSL_SELF_TEST_DESC_SIGN_DSA>) 439 440=item "RSA" (B<OSSL_SELF_TEST_DESC_SIGN_RSA>) 441 442=item "ECDSA" (B<OSSL_SELF_TEST_DESC_SIGN_ECDSA>) 443 444=item "EDDSA" (B<OSSL_SELF_TEST_DESC_SIGN_EDDSA>) 445 446=item "ML-DSA" (B<OSSL_SELF_TEST_DESC_SIGN_ML_DSA>) 447 448=item "SLH-DSA" (B<OSSL_SELF_TEST_DESC_SIGN_SLH_DSA>) 449 450Signature tests used with the "KAT_Signature" type. 451 452=item "ECDH" (B<OSSL_SELF_TEST_DESC_KA_ECDH>) 453 454=item "DH" (B<OSSL_SELF_TEST_DESC_KA_DH>) 455 456Key agreement tests used with the "KAT_KA" type. 457 458=item "HKDF" (B<OSSL_SELF_TEST_DESC_KDF_HKDF>) 459 460=item "TLS13_KDF_EXTRACT" (B<OSSL_SELF_TEST_DESC_KDF_TLS13_EXTRACT>) 461 462=item "TLS13_KDF_EXPAND" (B<OSSL_SELF_TEST_DESC_KDF_TLS13_EXPAND>) 463 464=item "SSKDF" (B<OSSL_SELF_TEST_DESC_KDF_SSKDF>) 465 466=item "X963KDF" (B<OSSL_SELF_TEST_DESC_KDF_X963KDF>) 467 468=item "X942KDF" (B<OSSL_SELF_TEST_DESC_KDF_X942KDF>) 469 470=item "PBKDF2" (B<OSSL_SELF_TEST_DESC_KDF_PBKDF2>) 471 472=item "SSHKDF" (B<OSSL_SELF_TEST_DESC_KDF_SSHKDF>) 473 474=item "TLS12_PRF" (B<OSSL_SELF_TEST_DESC_KDF_TLS12_PRF>) 475 476=item "KBKDF" (B<OSSL_SELF_TEST_DESC_KDF_KBKDF>) 477 478Key Encapsulation Function tests used with the "KAT_KEM" type. 479 480=item "KEM_Encap" (B<OSSL_SELF_TEST_DESC_ENCAP_KEM>) 481 482=item "KEM_Decap" (B<OSSL_SELF_TEST_DESC_DECAP_KEM>) 483 484=item "KEM_Decap_Reject" (B<OSSL_SELF_TEST_DESC_DECAP_REJ_KEM>) 485 486Key Derivation Function tests used with the "KAT_KDF" type. 487 488=item "CTR" (B<OSSL_SELF_TEST_DESC_DRBG_CTR>) 489 490=item "HASH" (B<OSSL_SELF_TEST_DESC_DRBG_HASH>) 491 492=item "HMAC" (B<OSSL_SELF_TEST_DESC_DRBG_HMAC>) 493 494DRBG tests used with the "DRBG" type. 495 496=item "RNG" (B<OSSL_SELF_TEST_DESC_RNG>) 497 498"Continuous_RNG_Test" uses this. 499 500=back 501 502=head1 EXAMPLES 503 504A simple self test callback is shown below for illustrative purposes. 505 506 #include <openssl/self_test.h> 507 508 static OSSL_CALLBACK self_test_cb; 509 510 static int self_test_cb(const OSSL_PARAM params[], void *arg) 511 { 512 int ret = 0; 513 const OSSL_PARAM *p = NULL; 514 const char *phase = NULL, *type = NULL, *desc = NULL; 515 516 p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_PHASE); 517 if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING) 518 goto err; 519 phase = (const char *)p->data; 520 521 p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_DESC); 522 if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING) 523 goto err; 524 desc = (const char *)p->data; 525 526 p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_TYPE); 527 if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING) 528 goto err; 529 type = (const char *)p->data; 530 531 /* Do some logging */ 532 if (strcmp(phase, OSSL_SELF_TEST_PHASE_START) == 0) 533 BIO_printf(bio_out, "%s : (%s) : ", desc, type); 534 if (strcmp(phase, OSSL_SELF_TEST_PHASE_PASS) == 0 535 || strcmp(phase, OSSL_SELF_TEST_PHASE_FAIL) == 0) 536 BIO_printf(bio_out, "%s\n", phase); 537 538 /* Corrupt the SHA1 self test during the 'corrupt' phase by returning 0 */ 539 if (strcmp(phase, OSSL_SELF_TEST_PHASE_CORRUPT) == 0 540 && strcmp(desc, OSSL_SELF_TEST_DESC_MD_SHA1) == 0) { 541 BIO_printf(bio_out, "%s %s", phase, desc); 542 return 0; 543 } 544 ret = 1; 545 err: 546 return ret; 547 } 548 549=head1 NOTES 550 551Some released versions of OpenSSL do not include a validated 552FIPS provider. To determine which versions have undergone 553the validation process, please refer to the 554L<OpenSSL Downloads page|https://www.openssl.org/source/>. If you 555require FIPS-approved functionality, it is essential to build your FIPS 556provider using one of the validated versions listed there. Normally, 557it is possible to utilize a FIPS provider constructed from one of the 558validated versions alongside F<libcrypto> and F<libssl> compiled from any 559release within the same major release series. This flexibility enables 560you to address bug fixes and CVEs that fall outside the FIPS boundary. 561 562You can load the FIPS provider into multiple library contexts as any other 563provider. However the following restriction applies. The FIPS provider cannot 564be used by multiple copies of OpenSSL libcrypto in a single process. 565 566As the provider saves core callbacks to the libcrypto obtained in the 567OSSL_provider_init() call to global data it will fail if subsequent 568invocations of its OSSL_provider_init() function yield different addresses 569of these callbacks than in the initial call. This happens when different 570copies of libcrypto are present in the memory of the process and both try 571to load the same FIPS provider. A workaround is to have a different copy 572of the FIPS provider loaded for each of the libcrypto instances in the 573process. 574 575=head1 SEE ALSO 576 577L<openssl-fipsinstall(1)>, 578L<fips_config(5)>, 579L<OSSL_SELF_TEST_set_callback(3)>, 580L<OSSL_SELF_TEST_new(3)>, 581L<OSSL_PARAM(3)>, 582L<openssl-core.h(7)>, 583L<openssl-core_dispatch.h(7)>, 584L<provider(7)>, 585L<https://www.openssl.org/source/> 586 587=head1 HISTORY 588 589This functionality was added in OpenSSL 3.0. 590 591=head1 COPYRIGHT 592 593Copyright 2019-2025 The OpenSSL Project Authors. All Rights Reserved. 594 595Licensed under the Apache License 2.0 (the "License"). You may not use 596this file except in compliance with the License. You can obtain a copy 597in the file LICENSE in the source distribution or at 598L<https://www.openssl.org/source/license.html>. 599 600=cut 601