xref: /freebsd/crypto/openssl/doc/man7/OSSL_PROVIDER-FIPS.pod (revision aa7957345732816fb0ba8308798d2f79f45597f9)
1b077aed3SPierre Pronchery=pod
2b077aed3SPierre Pronchery
3b077aed3SPierre Pronchery=head1 NAME
4b077aed3SPierre Pronchery
5b077aed3SPierre ProncheryOSSL_PROVIDER-FIPS - OpenSSL FIPS provider
6b077aed3SPierre Pronchery
7b077aed3SPierre Pronchery=head1 DESCRIPTION
8b077aed3SPierre Pronchery
9b077aed3SPierre ProncheryThe OpenSSL FIPS provider is a special provider that conforms to the Federal
10b077aed3SPierre ProncheryInformation Processing Standards (FIPS) specified in FIPS 140-2. This 'module'
11b077aed3SPierre Proncherycontains an approved set of cryptographic algorithms that is validated by an
12b077aed3SPierre Proncheryaccredited testing laboratory.
13b077aed3SPierre Pronchery
14b077aed3SPierre Pronchery=head2 Properties
15b077aed3SPierre Pronchery
16b077aed3SPierre ProncheryThe implementations in this provider specifically have these properties
17b077aed3SPierre Proncherydefined:
18b077aed3SPierre Pronchery
19b077aed3SPierre Pronchery=over 4
20b077aed3SPierre Pronchery
21b077aed3SPierre Pronchery=item "provider=fips"
22b077aed3SPierre Pronchery
23b077aed3SPierre Pronchery=item "fips=yes"
24b077aed3SPierre Pronchery
25b077aed3SPierre Pronchery=back
26b077aed3SPierre Pronchery
27b077aed3SPierre ProncheryIt may be used in a property query string with fetching functions such as
28b077aed3SPierre ProncheryL<EVP_MD_fetch(3)> or L<EVP_CIPHER_fetch(3)>, as well as with other
29b077aed3SPierre Proncheryfunctions that take a property query string, such as
30b077aed3SPierre ProncheryL<EVP_PKEY_CTX_new_from_name(3)>.
31b077aed3SPierre Pronchery
32b077aed3SPierre ProncheryIt isn't mandatory to query for any of these properties, except to
33b077aed3SPierre Proncherymake sure to get implementations of this provider and none other.
34b077aed3SPierre Pronchery
35b077aed3SPierre ProncheryThe "fips=yes" property can be use to make sure only FIPS approved
36b077aed3SPierre Proncheryimplementations are used for crypto operations.  This may also include
37b077aed3SPierre Proncheryother non-crypto support operations that are not in the FIPS provider,
38b077aed3SPierre Proncherysuch as asymmetric key encoders,
39b077aed3SPierre Proncherysee L<OSSL_PROVIDER-default(7)/Asymmetric Key Management>.
40b077aed3SPierre Pronchery
41b077aed3SPierre Pronchery=head1 OPERATIONS AND ALGORITHMS
42b077aed3SPierre Pronchery
43b077aed3SPierre ProncheryThe OpenSSL FIPS provider supports these operations and algorithms:
44b077aed3SPierre Pronchery
45b077aed3SPierre Pronchery=head2 Hashing Algorithms / Message Digests
46b077aed3SPierre Pronchery
47b077aed3SPierre Pronchery=over 4
48b077aed3SPierre Pronchery
49b077aed3SPierre Pronchery=item SHA1, see L<EVP_MD-SHA1(7)>
50b077aed3SPierre Pronchery
51b077aed3SPierre Pronchery=item SHA2, see L<EVP_MD-SHA2(7)>
52b077aed3SPierre Pronchery
53b077aed3SPierre Pronchery=item SHA3, see L<EVP_MD-SHA3(7)>
54b077aed3SPierre Pronchery
55b077aed3SPierre Pronchery=item KECCAK-KMAC, see L<EVP_MD-KECCAK-KMAC(7)>
56b077aed3SPierre Pronchery
57b077aed3SPierre Pronchery=back
58b077aed3SPierre Pronchery
59b077aed3SPierre Pronchery=head2 Symmetric Ciphers
60b077aed3SPierre Pronchery
61b077aed3SPierre Pronchery=over 4
62b077aed3SPierre Pronchery
63b077aed3SPierre Pronchery=item AES, see L<EVP_CIPHER-AES(7)>
64b077aed3SPierre Pronchery
65b077aed3SPierre Pronchery=item DES-EDE3 (TripleDES), see L<EVP_CIPHER-DES(7)>
66b077aed3SPierre Pronchery
67b077aed3SPierre Pronchery=back
68b077aed3SPierre Pronchery
69b077aed3SPierre Pronchery=head2 Message Authentication Code (MAC)
70b077aed3SPierre Pronchery
71b077aed3SPierre Pronchery=over 4
72b077aed3SPierre Pronchery
73b077aed3SPierre Pronchery=item CMAC, see L<EVP_MAC-CMAC(7)>
74b077aed3SPierre Pronchery
75b077aed3SPierre Pronchery=item GMAC, see L<EVP_MAC-GMAC(7)>
76b077aed3SPierre Pronchery
77b077aed3SPierre Pronchery=item HMAC, see L<EVP_MAC-HMAC(7)>
78b077aed3SPierre Pronchery
79b077aed3SPierre Pronchery=item KMAC, see L<EVP_MAC-KMAC(7)>
80b077aed3SPierre Pronchery
81b077aed3SPierre Pronchery=back
82b077aed3SPierre Pronchery
83b077aed3SPierre Pronchery=head2 Key Derivation Function (KDF)
84b077aed3SPierre Pronchery
85b077aed3SPierre Pronchery=over 4
86b077aed3SPierre Pronchery
87b077aed3SPierre Pronchery=item HKDF, see L<EVP_KDF-HKDF(7)>
88b077aed3SPierre Pronchery
89b077aed3SPierre Pronchery=item TLS13-KDF, see L<EVP_KDF-TLS13_KDF(7)>
90b077aed3SPierre Pronchery
91b077aed3SPierre Pronchery=item SSKDF, see L<EVP_KDF-SS(7)>
92b077aed3SPierre Pronchery
93b077aed3SPierre Pronchery=item PBKDF2, see L<EVP_KDF-PBKDF2(7)>
94b077aed3SPierre Pronchery
95b077aed3SPierre Pronchery=item SSHKDF, see L<EVP_KDF-SSHKDF(7)>
96b077aed3SPierre Pronchery
97b077aed3SPierre Pronchery=item TLS1-PRF, see L<EVP_KDF-TLS1_PRF(7)>
98b077aed3SPierre Pronchery
99b077aed3SPierre Pronchery=item KBKDF, see L<EVP_KDF-KB(7)>
100b077aed3SPierre Pronchery
101b077aed3SPierre Pronchery=item X942KDF-ASN1, see L<EVP_KDF-X942-ASN1(7)>
102b077aed3SPierre Pronchery
103b077aed3SPierre Pronchery=item X942KDF-CONCAT, see L<EVP_KDF-X942-CONCAT(7)>
104b077aed3SPierre Pronchery
105b077aed3SPierre Pronchery=item X963KDF, see L<EVP_KDF-X963(7)>
106b077aed3SPierre Pronchery
107b077aed3SPierre Pronchery=back
108b077aed3SPierre Pronchery
109b077aed3SPierre Pronchery=head2 Key Exchange
110b077aed3SPierre Pronchery
111b077aed3SPierre Pronchery=over 4
112b077aed3SPierre Pronchery
113b077aed3SPierre Pronchery=item DH, see L<EVP_KEYEXCH-DH(7)>
114b077aed3SPierre Pronchery
115b077aed3SPierre Pronchery=item ECDH, see L<EVP_KEYEXCH-ECDH(7)>
116b077aed3SPierre Pronchery
117b077aed3SPierre Pronchery=item X25519, see L<EVP_KEYEXCH-X25519(7)>
118b077aed3SPierre Pronchery
119b077aed3SPierre Pronchery=item X448, see L<EVP_KEYEXCH-X448(7)>
120b077aed3SPierre Pronchery
121b077aed3SPierre Pronchery=back
122b077aed3SPierre Pronchery
123b077aed3SPierre Pronchery=head2 Asymmetric Signature
124b077aed3SPierre Pronchery
125b077aed3SPierre Pronchery=over 4
126b077aed3SPierre Pronchery
127b077aed3SPierre Pronchery=item RSA, see L<EVP_SIGNATURE-RSA(7)>
128b077aed3SPierre Pronchery
129b077aed3SPierre Pronchery=item X25519, see L<EVP_SIGNATURE-ED25519(7)>
130b077aed3SPierre Pronchery
131b077aed3SPierre Pronchery=item X448, see L<EVP_SIGNATURE-ED448(7)>
132b077aed3SPierre Pronchery
133b077aed3SPierre Pronchery=item HMAC, see L<EVP_SIGNATURE-HMAC(7)>
134b077aed3SPierre Pronchery
135b077aed3SPierre Pronchery=item CMAC, see L<EVP_SIGNATURE-CMAC(7)>
136b077aed3SPierre Pronchery
137b077aed3SPierre Pronchery=back
138b077aed3SPierre Pronchery
139b077aed3SPierre Pronchery=head2 Asymmetric Cipher
140b077aed3SPierre Pronchery
141b077aed3SPierre Pronchery=over 4
142b077aed3SPierre Pronchery
143b077aed3SPierre Pronchery=item RSA, see L<EVP_ASYM_CIPHER-RSA(7)>
144b077aed3SPierre Pronchery
145b077aed3SPierre Pronchery=back
146b077aed3SPierre Pronchery
147b077aed3SPierre Pronchery=head2 Asymmetric Key Encapsulation
148b077aed3SPierre Pronchery
149b077aed3SPierre Pronchery=over 4
150b077aed3SPierre Pronchery
151b077aed3SPierre Pronchery=item RSA, see L<EVP_KEM-RSA(7)>
152b077aed3SPierre Pronchery
153b077aed3SPierre Pronchery=back
154b077aed3SPierre Pronchery
155b077aed3SPierre Pronchery=head2 Asymmetric Key Management
156b077aed3SPierre Pronchery
157b077aed3SPierre Pronchery=over 4
158b077aed3SPierre Pronchery
159b077aed3SPierre Pronchery=item DH, see L<EVP_KEYMGMT-DH(7)>
160b077aed3SPierre Pronchery
161b077aed3SPierre Pronchery=item DHX, see L<EVP_KEYMGMT-DHX(7)>
162b077aed3SPierre Pronchery
163b077aed3SPierre Pronchery=item DSA, see L<EVP_KEYMGMT-DSA(7)>
164b077aed3SPierre Pronchery
165b077aed3SPierre Pronchery=item RSA, see L<EVP_KEYMGMT-RSA(7)>
166b077aed3SPierre Pronchery
167b077aed3SPierre Pronchery=item EC, see L<EVP_KEYMGMT-EC(7)>
168b077aed3SPierre Pronchery
169b077aed3SPierre Pronchery=item X25519, see L<EVP_KEYMGMT-X25519(7)>
170b077aed3SPierre Pronchery
171b077aed3SPierre Pronchery=item X448, see L<EVP_KEYMGMT-X448(7)>
172b077aed3SPierre Pronchery
173b077aed3SPierre Pronchery=back
174b077aed3SPierre Pronchery
175b077aed3SPierre Pronchery=head2 Random Number Generation
176b077aed3SPierre Pronchery
177b077aed3SPierre Pronchery=over 4
178b077aed3SPierre Pronchery
179b077aed3SPierre Pronchery=item CTR-DRBG, see L<EVP_RAND-CTR-DRBG(7)>
180b077aed3SPierre Pronchery
181b077aed3SPierre Pronchery=item HASH-DRBG, see L<EVP_RAND-HASH-DRBG(7)>
182b077aed3SPierre Pronchery
183b077aed3SPierre Pronchery=item HMAC-DRBG, see L<EVP_RAND-HMAC-DRBG(7)>
184b077aed3SPierre Pronchery
185b077aed3SPierre Pronchery=item TEST-RAND, see L<EVP_RAND-TEST-RAND(7)>
186b077aed3SPierre Pronchery
187b077aed3SPierre ProncheryTEST-RAND is an unapproved algorithm.
188b077aed3SPierre Pronchery
189b077aed3SPierre Pronchery=back
190b077aed3SPierre Pronchery
191b077aed3SPierre Pronchery=head1 SELF TESTING
192b077aed3SPierre Pronchery
193b077aed3SPierre ProncheryOne of the requirements for the FIPS module is self testing. An optional callback
194b077aed3SPierre Proncherymechanism is available to return information to the user using
195b077aed3SPierre ProncheryL<OSSL_SELF_TEST_set_callback(3)>.
196b077aed3SPierre Pronchery
197b077aed3SPierre ProncheryThe parameters passed to the callback are described in L<OSSL_SELF_TEST_new(3)>
198b077aed3SPierre Pronchery
199b077aed3SPierre ProncheryThe OpenSSL FIPS module uses the following mechanism to provide information
200b077aed3SPierre Proncheryabout the self tests as they run.
201b077aed3SPierre ProncheryThis is useful for debugging if a self test is failing.
202b077aed3SPierre ProncheryThe callback also allows forcing any self test to fail, in order to check that
203b077aed3SPierre Proncheryit operates correctly on failure.
204b077aed3SPierre ProncheryNote that all self tests run even if a self test failure occurs.
205b077aed3SPierre Pronchery
206b077aed3SPierre ProncheryThe FIPS module passes the following type(s) to OSSL_SELF_TEST_onbegin().
207b077aed3SPierre Pronchery
208b077aed3SPierre Pronchery=over 4
209b077aed3SPierre Pronchery
210b077aed3SPierre Pronchery=item "Module_Integrity" (B<OSSL_SELF_TEST_TYPE_MODULE_INTEGRITY>)
211b077aed3SPierre Pronchery
212b077aed3SPierre ProncheryUses HMAC SHA256 on the module file to validate that the module has not been
213b077aed3SPierre Proncherymodified. The integrity value is compared to a value written to a configuration
214b077aed3SPierre Proncheryfile during installation.
215b077aed3SPierre Pronchery
216b077aed3SPierre Pronchery=item "Install_Integrity" (B<OSSL_SELF_TEST_TYPE_INSTALL_INTEGRITY>)
217b077aed3SPierre Pronchery
218b077aed3SPierre ProncheryUses HMAC SHA256 on a fixed string to validate that the installation process
219b077aed3SPierre Proncheryhas already been performed and the self test KATS have already been tested,
220b077aed3SPierre ProncheryThe integrity value is compared to a value written to a configuration
221b077aed3SPierre Proncheryfile after successfully running the self tests during installation.
222b077aed3SPierre Pronchery
223b077aed3SPierre Pronchery=item "KAT_Cipher" (B<OSSL_SELF_TEST_TYPE_KAT_CIPHER>)
224b077aed3SPierre Pronchery
225b077aed3SPierre ProncheryKnown answer test for a symmetric cipher.
226b077aed3SPierre Pronchery
227b077aed3SPierre Pronchery=item "KAT_AsymmetricCipher" (B<OSSL_SELF_TEST_TYPE_KAT_ASYM_CIPHER>)
228b077aed3SPierre Pronchery
229b077aed3SPierre ProncheryKnown answer test for a asymmetric cipher.
230b077aed3SPierre Pronchery
231b077aed3SPierre Pronchery=item "KAT_Digest" (B<OSSL_SELF_TEST_TYPE_KAT_DIGEST>)
232b077aed3SPierre Pronchery
233b077aed3SPierre ProncheryKnown answer test for a digest.
234b077aed3SPierre Pronchery
235b077aed3SPierre Pronchery=item "KAT_Signature" (B<OSSL_SELF_TEST_TYPE_KAT_SIGNATURE>)
236b077aed3SPierre Pronchery
237b077aed3SPierre ProncheryKnown answer test for a signature.
238b077aed3SPierre Pronchery
239b077aed3SPierre Pronchery=item "PCT_Signature" (B<OSSL_SELF_TEST_TYPE_PCT_SIGNATURE>)
240b077aed3SPierre Pronchery
241b077aed3SPierre ProncheryPairwise Consistency check for a signature.
242b077aed3SPierre Pronchery
243b077aed3SPierre Pronchery=item "KAT_KDF" (B<OSSL_SELF_TEST_TYPE_KAT_KDF>)
244b077aed3SPierre Pronchery
245b077aed3SPierre ProncheryKnown answer test for a key derivation function.
246b077aed3SPierre Pronchery
247b077aed3SPierre Pronchery=item "KAT_KA" (B<OSSL_SELF_TEST_TYPE_KAT_KA>)
248b077aed3SPierre Pronchery
249b077aed3SPierre ProncheryKnown answer test for key agreement.
250b077aed3SPierre Pronchery
251b077aed3SPierre Pronchery=item "DRBG" (B<OSSL_SELF_TEST_TYPE_DRBG>)
252b077aed3SPierre Pronchery
253b077aed3SPierre ProncheryKnown answer test for a Deterministic Random Bit Generator.
254b077aed3SPierre Pronchery
255b077aed3SPierre Pronchery=item "Conditional_PCT" (B<OSSL_SELF_TEST_TYPE_PCT>)
256b077aed3SPierre Pronchery
257b077aed3SPierre ProncheryConditional test that is run during the generation of key pairs.
258b077aed3SPierre Pronchery
259b077aed3SPierre Pronchery=item "Continuous_RNG_Test" (B<OSSL_SELF_TEST_TYPE_CRNG>)
260b077aed3SPierre Pronchery
261b077aed3SPierre ProncheryContinuous random number generator test.
262b077aed3SPierre Pronchery
263b077aed3SPierre Pronchery=back
264b077aed3SPierre Pronchery
265b077aed3SPierre ProncheryThe "Module_Integrity" self test is always run at startup.
266b077aed3SPierre ProncheryThe "Install_Integrity" self test is used to check if the self tests have
267b077aed3SPierre Proncheryalready been run at installation time. If they have already run then the
268b077aed3SPierre Proncheryself tests are not run on subsequent startups.
269b077aed3SPierre ProncheryAll other self test categories are run once at installation time, except for the
270b077aed3SPierre Pronchery"Pairwise_Consistency_Test".
271b077aed3SPierre Pronchery
272b077aed3SPierre ProncheryThere is only one instance of the "Module_Integrity" and "Install_Integrity"
273b077aed3SPierre Proncheryself tests. All other self tests may have multiple instances.
274b077aed3SPierre Pronchery
275b077aed3SPierre Pronchery
276b077aed3SPierre ProncheryThe FIPS module passes the following descriptions(s) to OSSL_SELF_TEST_onbegin().
277b077aed3SPierre Pronchery
278b077aed3SPierre Pronchery=over 4
279b077aed3SPierre Pronchery
280b077aed3SPierre Pronchery=item "HMAC" (B<OSSL_SELF_TEST_DESC_INTEGRITY_HMAC>)
281b077aed3SPierre Pronchery
282b077aed3SPierre Pronchery"Module_Integrity" and "Install_Integrity" use this.
283b077aed3SPierre Pronchery
284b077aed3SPierre Pronchery=item "RSA" (B<OSSL_SELF_TEST_DESC_PCT_RSA_PKCS1>)
285b077aed3SPierre Pronchery
286b077aed3SPierre Pronchery=item "ECDSA" (B<OSSL_SELF_TEST_DESC_PCT_ECDSA>)
287b077aed3SPierre Pronchery
288b077aed3SPierre Pronchery=item "DSA" (B<OSSL_SELF_TEST_DESC_PCT_DSA>)
289b077aed3SPierre Pronchery
290b077aed3SPierre ProncheryKey generation tests used with the "Pairwise_Consistency_Test" type.
291b077aed3SPierre Pronchery
292b077aed3SPierre Pronchery=item "RSA_Encrypt" (B<OSSL_SELF_TEST_DESC_ASYM_RSA_ENC>)
293b077aed3SPierre Pronchery
294b077aed3SPierre Pronchery=item "RSA_Decrypt" (B<OSSL_SELF_TEST_DESC_ASYM_RSA_DEC>)
295b077aed3SPierre Pronchery
296b077aed3SPierre Pronchery"KAT_AsymmetricCipher" uses this to indicate an encrypt or decrypt KAT.
297b077aed3SPierre Pronchery
298b077aed3SPierre Pronchery=item "AES_GCM" (B<OSSL_SELF_TEST_DESC_CIPHER_AES_GCM>)
299b077aed3SPierre Pronchery
300b077aed3SPierre Pronchery=item "AES_ECB_Decrypt" (B<OSSL_SELF_TEST_DESC_CIPHER_AES_ECB>)
301b077aed3SPierre Pronchery
302b077aed3SPierre Pronchery=item "TDES" (B<OSSL_SELF_TEST_DESC_CIPHER_TDES>)
303b077aed3SPierre Pronchery
304b077aed3SPierre ProncherySymmetric cipher tests used with the "KAT_Cipher" type.
305b077aed3SPierre Pronchery
306b077aed3SPierre Pronchery=item "SHA1" (B<OSSL_SELF_TEST_DESC_MD_SHA1>)
307b077aed3SPierre Pronchery
308b077aed3SPierre Pronchery=item "SHA2" (B<OSSL_SELF_TEST_DESC_MD_SHA2>)
309b077aed3SPierre Pronchery
310b077aed3SPierre Pronchery=item "SHA3" (B<OSSL_SELF_TEST_DESC_MD_SHA3>)
311b077aed3SPierre Pronchery
312b077aed3SPierre ProncheryDigest tests used with the "KAT_Digest" type.
313b077aed3SPierre Pronchery
314b077aed3SPierre Pronchery=item "DSA" (B<OSSL_SELF_TEST_DESC_SIGN_DSA>)
315b077aed3SPierre Pronchery
316b077aed3SPierre Pronchery=item "RSA" (B<OSSL_SELF_TEST_DESC_SIGN_RSA>)
317b077aed3SPierre Pronchery
318b077aed3SPierre Pronchery=item "ECDSA" (B<OSSL_SELF_TEST_DESC_SIGN_ECDSA>)
319b077aed3SPierre Pronchery
320b077aed3SPierre ProncherySignature tests used with the "KAT_Signature" type.
321b077aed3SPierre Pronchery
322b077aed3SPierre Pronchery=item "ECDH" (B<OSSL_SELF_TEST_DESC_KA_ECDH>)
323b077aed3SPierre Pronchery
324b077aed3SPierre Pronchery=item "DH" (B<OSSL_SELF_TEST_DESC_KA_DH>)
325b077aed3SPierre Pronchery
326b077aed3SPierre ProncheryKey agreement tests used with the "KAT_KA" type.
327b077aed3SPierre Pronchery
328b077aed3SPierre Pronchery=item "HKDF" (B<OSSL_SELF_TEST_DESC_KDF_HKDF>)
329b077aed3SPierre Pronchery
330b077aed3SPierre Pronchery=item "TLS13_KDF_EXTRACT" (B<OSSL_SELF_TEST_DESC_KDF_TLS13_EXTRACT>)
331b077aed3SPierre Pronchery
332b077aed3SPierre Pronchery=item "TLS13_KDF_EXPAND" (B<OSSL_SELF_TEST_DESC_KDF_TLS13_EXPAND>)
333b077aed3SPierre Pronchery
334b077aed3SPierre Pronchery=item "SSKDF" (B<OSSL_SELF_TEST_DESC_KDF_SSKDF>)
335b077aed3SPierre Pronchery
336b077aed3SPierre Pronchery=item "X963KDF" (B<OSSL_SELF_TEST_DESC_KDF_X963KDF>)
337b077aed3SPierre Pronchery
338b077aed3SPierre Pronchery=item "X942KDF" (B<OSSL_SELF_TEST_DESC_KDF_X942KDF>)
339b077aed3SPierre Pronchery
340b077aed3SPierre Pronchery=item "PBKDF2" (B<OSSL_SELF_TEST_DESC_KDF_PBKDF2>)
341b077aed3SPierre Pronchery
342b077aed3SPierre Pronchery=item "SSHKDF" (B<OSSL_SELF_TEST_DESC_KDF_SSHKDF>)
343b077aed3SPierre Pronchery
344b077aed3SPierre Pronchery=item "TLS12_PRF" (B<OSSL_SELF_TEST_DESC_KDF_TLS12_PRF>)
345b077aed3SPierre Pronchery
346b077aed3SPierre Pronchery=item "KBKDF" (B<OSSL_SELF_TEST_DESC_KDF_KBKDF>)
347b077aed3SPierre Pronchery
348b077aed3SPierre ProncheryKey Derivation Function tests used with the "KAT_KDF" type.
349b077aed3SPierre Pronchery
350b077aed3SPierre Pronchery=item "CTR" (B<OSSL_SELF_TEST_DESC_DRBG_CTR>)
351b077aed3SPierre Pronchery
352b077aed3SPierre Pronchery=item "HASH" (B<OSSL_SELF_TEST_DESC_DRBG_HASH>)
353b077aed3SPierre Pronchery
354b077aed3SPierre Pronchery=item "HMAC" (B<OSSL_SELF_TEST_DESC_DRBG_HMAC>)
355b077aed3SPierre Pronchery
356b077aed3SPierre ProncheryDRBG tests used with the "DRBG" type.
357b077aed3SPierre Pronchery
358b077aed3SPierre Pronchery= item "RNG" (B<OSSL_SELF_TEST_DESC_RNG>)
359b077aed3SPierre Pronchery
360b077aed3SPierre Pronchery"Continuous_RNG_Test" uses this.
361b077aed3SPierre Pronchery
362b077aed3SPierre Pronchery=back
363b077aed3SPierre Pronchery
364b077aed3SPierre Pronchery=head1 EXAMPLES
365b077aed3SPierre Pronchery
366b077aed3SPierre ProncheryA simple self test callback is shown below for illustrative purposes.
367b077aed3SPierre Pronchery
368b077aed3SPierre Pronchery  #include <openssl/self_test.h>
369b077aed3SPierre Pronchery
370b077aed3SPierre Pronchery  static OSSL_CALLBACK self_test_cb;
371b077aed3SPierre Pronchery
372b077aed3SPierre Pronchery  static int self_test_cb(const OSSL_PARAM params[], void *arg)
373b077aed3SPierre Pronchery  {
374b077aed3SPierre Pronchery    int ret = 0;
375b077aed3SPierre Pronchery    const OSSL_PARAM *p = NULL;
376b077aed3SPierre Pronchery    const char *phase = NULL, *type = NULL, *desc = NULL;
377b077aed3SPierre Pronchery
378b077aed3SPierre Pronchery    p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_PHASE);
379b077aed3SPierre Pronchery    if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)
380b077aed3SPierre Pronchery        goto err;
381b077aed3SPierre Pronchery    phase = (const char *)p->data;
382b077aed3SPierre Pronchery
383b077aed3SPierre Pronchery    p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_DESC);
384b077aed3SPierre Pronchery    if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)
385b077aed3SPierre Pronchery        goto err;
386b077aed3SPierre Pronchery    desc = (const char *)p->data;
387b077aed3SPierre Pronchery
388b077aed3SPierre Pronchery    p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_TYPE);
389b077aed3SPierre Pronchery    if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)
390b077aed3SPierre Pronchery        goto err;
391b077aed3SPierre Pronchery    type = (const char *)p->data;
392b077aed3SPierre Pronchery
393b077aed3SPierre Pronchery    /* Do some logging */
394b077aed3SPierre Pronchery    if (strcmp(phase, OSSL_SELF_TEST_PHASE_START) == 0)
395b077aed3SPierre Pronchery        BIO_printf(bio_out, "%s : (%s) : ", desc, type);
396b077aed3SPierre Pronchery    if (strcmp(phase, OSSL_SELF_TEST_PHASE_PASS) == 0
397b077aed3SPierre Pronchery            || strcmp(phase, OSSL_SELF_TEST_PHASE_FAIL) == 0)
398b077aed3SPierre Pronchery        BIO_printf(bio_out, "%s\n", phase);
399b077aed3SPierre Pronchery
400b077aed3SPierre Pronchery    /* Corrupt the SHA1 self test during the 'corrupt' phase by returning 0 */
401b077aed3SPierre Pronchery    if (strcmp(phase, OSSL_SELF_TEST_PHASE_CORRUPT) == 0
402b077aed3SPierre Pronchery            && strcmp(desc, OSSL_SELF_TEST_DESC_MD_SHA1) == 0) {
403b077aed3SPierre Pronchery        BIO_printf(bio_out, "%s %s", phase, desc);
404b077aed3SPierre Pronchery        return 0;
405b077aed3SPierre Pronchery    }
406b077aed3SPierre Pronchery    ret = 1;
407b077aed3SPierre Pronchery  err:
408b077aed3SPierre Pronchery    return ret;
409b077aed3SPierre Pronchery  }
410b077aed3SPierre Pronchery
411*aa795734SPierre Pronchery=head1 NOTES
412*aa795734SPierre Pronchery
413*aa795734SPierre ProncherySome released versions of OpenSSL do not include a validated
414*aa795734SPierre ProncheryFIPS provider.  To determine which versions have undergone
415*aa795734SPierre Proncherythe validation process, please refer to the
416*aa795734SPierre ProncheryL<OpenSSL Downloads page|https://www.openssl.org/source/>.  If you
417*aa795734SPierre Proncheryrequire FIPS-approved functionality, it is essential to build your FIPS
418*aa795734SPierre Proncheryprovider using one of the validated versions listed there.  Normally,
419*aa795734SPierre Proncheryit is possible to utilize a FIPS provider constructed from one of the
420*aa795734SPierre Proncheryvalidated versions alongside F<libcrypto> and F<libssl> compiled from any
421*aa795734SPierre Proncheryrelease within the same major release series.  This flexibility enables
422*aa795734SPierre Proncheryyou to address bug fixes and CVEs that fall outside the FIPS boundary.
423*aa795734SPierre Pronchery
424b077aed3SPierre Pronchery=head1 SEE ALSO
425b077aed3SPierre Pronchery
426b077aed3SPierre ProncheryL<openssl-fipsinstall(1)>,
427b077aed3SPierre ProncheryL<fips_config(5)>,
428b077aed3SPierre ProncheryL<OSSL_SELF_TEST_set_callback(3)>,
429b077aed3SPierre ProncheryL<OSSL_SELF_TEST_new(3)>,
430b077aed3SPierre ProncheryL<OSSL_PARAM(3)>,
431b077aed3SPierre ProncheryL<openssl-core.h(7)>,
432b077aed3SPierre ProncheryL<openssl-core_dispatch.h(7)>,
433*aa795734SPierre ProncheryL<provider(7)>,
434*aa795734SPierre ProncheryL<https://www.openssl.org/source/>
435b077aed3SPierre Pronchery
436b077aed3SPierre Pronchery=head1 HISTORY
437b077aed3SPierre Pronchery
438b077aed3SPierre ProncheryThis functionality was added in OpenSSL 3.0.
439b077aed3SPierre Pronchery
440b077aed3SPierre Pronchery=head1 COPYRIGHT
441b077aed3SPierre Pronchery
442b077aed3SPierre ProncheryCopyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.
443b077aed3SPierre Pronchery
444b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
445b077aed3SPierre Proncherythis file except in compliance with the License.  You can obtain a copy
446b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at
447b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>.
448b077aed3SPierre Pronchery
449b077aed3SPierre Pronchery=cut
450