]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man7/OSSL_PROVIDER-FIPS.pod
Add FIPS Self test for AES_ECB decrypt
[thirdparty/openssl.git] / doc / man7 / OSSL_PROVIDER-FIPS.pod
CommitLineData
36fc5fc6
SL
1=pod
2
3=head1 NAME
4
c5926e93 5OSSL_PROVIDER-FIPS - OpenSSL FIPS provider
36fc5fc6
SL
6
7=head1 DESCRIPTION
8
c5926e93 9The OpenSSL FIPS provider is a special provider that conforms to the Federal
36fc5fc6
SL
10Information Processing Standards (FIPS) specified in FIPS 140-2. This 'module'
11contains an approved set of cryptographic algorithms that is validated by an
12accredited testing laboratory.
13
c5926e93
RL
14=head2 Properties
15
16The implementations in this provider specifically have these properties
17defined:
18
19=over 4
20
b8086652 21=item "provider=default"
c5926e93 22
b8086652 23=item "fips=yes"
c5926e93
RL
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
32It isn't mandatory to query for any of these properties, except to
33make sure to get implementations of this provider and none other.
34
35The "fips=yes" property can be use to make sure only FIPS approved
36implementations are used for crypto operations. This may also include
37other non-crypto support operations that are not in the fips provider,
ece9304c 38such as asymmetric key encoders,
c5926e93
RL
39see L<OSSL_PROVIDER-default(7)/Asymmetric Key Management>.
40
41=head1 OPERATIONS AND ALGORITHMS
42
43The OpenSSL FIPS provider supports these operations and algorithms:
44
45=head2 Hashing Algorithms / Message Digests
46
47=over 4
48
49=item SHA1, see L<EVP_MD-SHA1(7)>
50
51=item SHA2, see L<EVP_MD-SHA2(7)>
52
53=item SHA3, see L<EVP_MD-SHA3(7)>
54
55=item KECCAK-KMAC, see L<EVP_MD-KECCAK-KMAC(7)>
56
57=back
58
59=head2 Symmetric Ciphers
60
61=over 4
62
63=item AES, see L<EVP_CIPHER-AES(7)>
64
65=item DES-EDE3 (TrippleDES), see L<EVP_CIPHER-DES(7)>
66
67=back
68
69=head2 Message Authentication Code (MAC)
70
71=over 4
72
73=item CMAC, see L<EVP_MAC-CMAC(7)>
74
75=item GMAC, see L<EVP_MAC-GMAC(7)>
76
77=item HMAC, see L<EVP_MAC-HMAC(7)>
78
79=item KMAC, see L<EVP_MAC-KMAC(7)>
80
81=back
82
83=head2 Key Derivation Function (KDF)
84
85=over 4
86
87=item HKDF, see L<EVP_KDF-HKDF(7)>
88
89=item SSKDF, see L<EVP_KDF-SSKDF(7)>
90
91=item PBKDF2, see L<EVP_KDF-PBKDF2(7)>
92
89cccbea
SL
93=item SSHKDF, see L<EVP_KDF-SSHKDF(7)>
94
c5926e93
RL
95=item TLS1-PRF, see L<EVP_KDF-TLS1-PRF(7)>
96
97=item KBKDF, see L<EVP_KDF-KBKDF(7)>
98
89cccbea
SL
99=item X942KDF-ASN1, see L<EVP_KDF-X942-ASN1(7)>
100
101=item X942KDF-CONCAT, see L<EVP_KDF-X942-CONCAT(7)>
102
103=item X963KDF, see L<EVP_KDF-X963(7)>
104
c5926e93
RL
105=back
106
107=head2 Key Exchange
108
109=over 4
110
111=item DH, see L<EVP_KEYEXCH-DH(7)>
112
b8086652
SL
113=item ECDH, see L<EVP_KEYEXCH-ECDH(7)>
114
115=item X25519, see L<EVP_KEYEXCH-X25519(7)>
116
117This has the property "provider=fips,fips=no"
118
119=item X448, see L<EVP_KEYEXCH-X448(7)>
120
121This has the property "provider=fips,fips=no"
122
c5926e93
RL
123=back
124
125=head2 Asymmetric Signature
126
127=over 4
128
129=item DSA, see L<EVP_KEYEXCH-DSA(7)>
130
820d87bc
MC
131=item RSA, see L<EVP_SIGNATURE-RSA(7)>
132
133=item HMAC, see L<EVP_SIGNATURE-HMAC(7)>
134
135=item CMAC, see L<EVP_SIGNATURE-CMAC(7)>
136
c5926e93
RL
137=back
138
139=head2 Asymmetric Cipher
140
141=over 4
142
143=item RSA, see L<EVP_KEYEXCH-RSA(7)>
144
145=back
146
80f4fd18
SL
147=head2 Asymmetric Key Encapsulation
148
149=over 4
150
151=item RSA, see L<EVP_KEM-RSA(7)>
152
153=back
154
c5926e93
RL
155=head2 Asymmetric Key Management
156
157=over 4
158
159=item DH, see L<EVP_KEYMGMT-DH(7)>
160
161=item DSA, see L<EVP_KEYMGMT-DSA(7)>
162
163=item RSA, see L<EVP_KEYMGMT-RSA(7)>
164
165=back
166
36fc5fc6
SL
167=head1 SELF TESTING
168
169One of the requirements for the FIPS module is self testing. An optional callback
170mechanism is available to return information to the user using
fadb57e5 171L<OSSL_SELF_TEST_set_callback(3)>.
36fc5fc6 172
47c239c6
SL
173The parameters passed to the callback are described in L<OSSL_SELF_TEST_new(3)>
174
c5926e93 175The OpenSSL FIPS module uses the following mechanism to provide information
36fc5fc6
SL
176about the self tests as they run.
177This is useful for debugging if a self test is failing.
178The callback also allows forcing any self test to fail, in order to check that
179it operates correctly on failure.
36fc5fc6
SL
180Note that all self tests run even if a self test failure occurs.
181
47c239c6 182The FIPS module passes the following type(s) to OSSL_SELF_TEST_onbegin().
36fc5fc6
SL
183
184=over 4
185
186=item "Module_Integrity" (B<OSSL_SELF_TEST_TYPE_MODULE_INTEGRITY>)
187
188Uses HMAC SHA256 on the module file to validate that the module has not been
189modified. The integrity value is compared to a value written to a configuration
190file during installation.
191
192=item "Install_Integrity" (B<OSSL_SELF_TEST_TYPE_INSTALL_INTEGRITY>)
193
194Uses HMAC SHA256 on a fixed string to validate that the installation process
195has already been performed and the self test KATS have already been tested,
196The integrity value is compared to a value written to a configuration
197file after successfully running the self tests during installation.
198
199=item "KAT_Cipher" (B<OSSL_SELF_TEST_TYPE_KAT_CIPHER>)
200
201Known answer test for a symmetric cipher.
202
4343a418
SL
203=item "KAT_AsymmetricCipher" (B<OSSL_SELF_TEST_TYPE_KAT_ASYM_CIPHER>)
204
205Known answer test for a asymmetric cipher.
206
36fc5fc6
SL
207=item "KAT_Digest" (B<OSSL_SELF_TEST_TYPE_KAT_DIGEST>)
208
209Known answer test for a digest.
210
211=item "KAT_Signature" (B<OSSL_SELF_TEST_TYPE_KAT_SIGNATURE>)
212
213Known answer test for a signature.
214
215=item "KAT_KDF" (B<OSSL_SELF_TEST_TYPE_KAT_KDF>)
216
217Known answer test for a key derivation function.
218
219=item "KAT_KA" (B<OSSL_SELF_TEST_TYPE_KAT_KA>)
220
221Known answer test for key agreement.
222
223=item "DRBG" (B<OSSL_SELF_TEST_TYPE_DRBG>)
224
225Known answer test for a Deterministic Random Bit Generator.
226
227=item "Pairwise_Consistency_Test" (B<OSSL_SELF_TEST_TYPE_PCT>)
228
229Conditional test that is run during the generation of key pairs.
230
7f9e7440
SL
231=item "Continuous_RNG_Test" (B<OSSL_SELF_TEST_TYPE_CRNG>)
232
233Continuous random number generator test.
234
36fc5fc6
SL
235=back
236
237The "Module_Integrity" self test is always run at startup.
238The "Install_Integrity" self test is used to check if the self tests have
239already been run at installation time. If they have already run then the
240self tests are not run on subsequent startups.
241All other self test categories are run once at installation time, except for the
242"Pairwise_Consistency_Test".
243
244There is only one instance of the "Module_Integrity" and "Install_Integrity"
245self tests. All other self tests may have multiple instances.
246
36fc5fc6 247
47c239c6 248The FIPS module passes the following descriptions(s) to OSSL_SELF_TEST_onbegin().
36fc5fc6
SL
249
250=over 4
251
252=item "HMAC" (B<OSSL_SELF_TEST_DESC_INTEGRITY_HMAC>)
253
254"Module_Integrity" and "Install_Integrity" use this.
255
256=item "RSA" (B<OSSL_SELF_TEST_DESC_PCT_RSA_PKCS1>)
257
258=item "ECDSA" (B<OSSL_SELF_TEST_DESC_PCT_ECDSA>)
259
260=item "DSA" (B<OSSL_SELF_TEST_DESC_PCT_DSA>)
261
262Key generation tests used with the "Pairwise_Consistency_Test" type.
263
4343a418
SL
264=item "RSA_Encrypt" (B<OSSL_SELF_TEST_DESC_ASYM_RSA_ENC>)
265
266=item "RSA_Decrypt" (B<OSSL_SELF_TEST_DESC_ASYM_RSA_DEC>)
267
268"KAT_AsymmetricCipher" uses this to indicate an encrypt or decrypt KAT.
269
3fed2718
SL
270=item "AES_GCM_Encrypt" (B<OSSL_SELF_TEST_DESC_CIPHER_AES_GCM>)
271
272=item "AES_ECB_Decrypt" (B<OSSL_SELF_TEST_DESC_CIPHER_AES_ECB>)
36fc5fc6
SL
273
274=item "TDES" (B<OSSL_SELF_TEST_DESC_CIPHER_TDES>)
275
276Symmetric cipher tests used with the "KAT_Cipher" type.
277
278=item "SHA1" (B<OSSL_SELF_TEST_DESC_MD_SHA1>)
279
280=item "SHA2" (B<OSSL_SELF_TEST_DESC_MD_SHA2>)
281
282=item "SHA3" (B<OSSL_SELF_TEST_DESC_MD_SHA3>)
283
284Digest tests used with the "KAT_Digest" type.
285
286=item "DSA" (B<OSSL_SELF_TEST_DESC_SIGN_DSA>)
287
288=item "RSA" (B<OSSL_SELF_TEST_DESC_SIGN_RSA>)
289
290=item "ECDSA" (B<OSSL_SELF_TEST_DESC_SIGN_ECDSA>)
291
292Signature tests used with the "KAT_Signature" type.
293
294=item "ECDH" (B<OSSL_SELF_TEST_DESC_KA_ECDH>)
295
ec4d1b8f 296=item "DH" (B<OSSL_SELF_TEST_DESC_KA_DH>)
36fc5fc6
SL
297
298Key agreement tests used with the "KAT_KA" type.
299
300=item "HKDF" (B<OSSL_SELF_TEST_DESC_KDF_HKDF>)
301
ec4d1b8f
SL
302=item "SSKDF" (B<OSSL_SELF_TEST_DESC_KDF_SSKDF>)
303
acd3e548
SL
304=item "X963KDF" (B<OSSL_SELF_TEST_DESC_KDF_X963KDF>)
305
306=item "X942KDF" (B<OSSL_SELF_TEST_DESC_KDF_X942KDF>)
307
308=item "PBKDF2" (B<OSSL_SELF_TEST_DESC_KDF_PBKDF2>)
309
310=item "SSHKDF" (B<OSSL_SELF_TEST_DESC_KDF_SSHKDF>)
311
312=item "TLS12_PRF" (B<OSSL_SELF_TEST_DESC_KDF_TLS12_PRF>)
313
314=item "KBKDF" (B<OSSL_SELF_TEST_DESC_KDF_KBKDF>)
315
36fc5fc6
SL
316Key Derivation Function tests used with the "KAT_KDF" type.
317
318=item "CTR" (B<OSSL_SELF_TEST_DESC_DRBG_CTR>)
319
320=item "HASH" (B<OSSL_SELF_TEST_DESC_DRBG_HASH>)
321
322=item "HMAC" (B<OSSL_SELF_TEST_DESC_DRBG_HMAC>)
323
324DRBG tests used with the "DRBG" type.
325
7f9e7440
SL
326= item "RNG" (B<OSSL_SELF_TEST_DESC_RNG>)
327
328"Continuous_RNG_Test" uses this.
329
36fc5fc6
SL
330=back
331
36fc5fc6
SL
332=head1 EXAMPLES
333
334A simple self test callback is shown below for illustrative purposes.
335
336 #include <openssl/self_test.h>
337
338 static OSSL_CALLBACK self_test_cb;
339
340 static int self_test_cb(const OSSL_PARAM params[], void *arg)
341 {
342 int ret = 0;
343 const OSSL_PARAM *p = NULL;
344 const char *phase = NULL, *type = NULL, *desc = NULL;
345
346 p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_PHASE);
347 if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)
348 goto err;
349 phase = (const char *)p->data;
350
351 p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_DESC);
352 if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)
353 goto err;
354 desc = (const char *)p->data;
355
356 p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_TYPE);
357 if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)
358 goto err;
359 type = (const char *)p->data;
360
361 /* Do some logging */
362 if (strcmp(phase, OSSL_SELF_TEST_PHASE_START) == 0)
363 BIO_printf(bio_out, "%s : (%s) : ", desc, type);
364 if (strcmp(phase, OSSL_SELF_TEST_PHASE_PASS) == 0
365 || strcmp(phase, OSSL_SELF_TEST_PHASE_FAIL) == 0)
366 BIO_printf(bio_out, "%s\n", phase);
367
368 /* Corrupt the SHA1 self test during the 'corrupt' phase by returning 0 */
369 if (strcmp(phase, OSSL_SELF_TEST_PHASE_CORRUPT) == 0
370 && strcmp(desc, OSSL_SELF_TEST_DESC_MD_SHA1) == 0) {
371 BIO_printf(bio_out, "%s %s", phase, desc);
372 return 0;
373 }
374 ret = 1;
375 err:
376 return ret;
377 }
378
379=head1 SEE ALSO
380
381L<openssl-fipsinstall(1)>,
382L<fips_config(5)>,
fadb57e5 383L<OSSL_SELF_TEST_set_callback(3)>,
47c239c6 384L<OSSL_SELF_TEST_new(3)>,
36fc5fc6 385L<OSSL_PARAM(3)>,
c5926e93 386L<openssl-core.h(7)>,
23c48d94 387L<openssl-core_dispatch.h(7)>,
c5926e93 388L<provider(7)>
36fc5fc6
SL
389
390=head1 HISTORY
391
392The type and functions described here were added in OpenSSL 3.0.
393
394=head1 COPYRIGHT
395
47c239c6 396Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
36fc5fc6
SL
397
398Licensed under the Apache License 2.0 (the "License"). You may not use
399this file except in compliance with the License. You can obtain a copy
400in the file LICENSE in the source distribution or at
401L<https://www.openssl.org/source/license.html>.
402
403=cut