Skip to content

Commit 745fc91

Browse files
committed
Introduce the provider property
Replace the properties default, fips and legacy with a single property called "provider". So, for example, instead of writing "default=yes" to get algorithms from the default provider you would instead write "provider=default". We also have a new "fips" property to indicate that an algorithm is compatible with FIPS mode. This applies to all the algorithms in the FIPS provider, as well as any non-cryptographic algorithms (currently only serializers). Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from openssl#11097)
1 parent 980a880 commit 745fc91

15 files changed

Lines changed: 194 additions & 166 deletions

crypto/property/property_parse.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -562,12 +562,9 @@ OSSL_PROPERTY_LIST *ossl_property_merge(const OSSL_PROPERTY_LIST *a,
562562
int ossl_property_parse_init(OPENSSL_CTX *ctx)
563563
{
564564
static const char *const predefined_names[] = {
565-
"default", /* Being provided by the default built-in provider */
566-
"legacy", /* Provided by the legacy provider */
567-
"provider", /* Name of provider (default, fips) */
565+
"provider", /* Name of provider (default, legacy, fips) */
568566
"version", /* Version number of this provider */
569-
"fips", /* FIPS supporting provider */
570-
"engine", /* An old style engine masquerading as a provider */
567+
"fips", /* FIPS validated or FIPS supporting algorithm */
571568
"format", /* output format for serializers */
572569
"type", /* output type for serializers */
573570
};

doc/man7/EVP_MAC-BLAKE2.pod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ properties, to be used with EVP_MAC_fetch():
1616

1717
=over 4
1818

19-
=item "BLAKE2BMAC", "default=yes"
19+
=item "BLAKE2BMAC", "provider=default"
2020

21-
=item "BLAKE2SMAC", "default=yes"
21+
=item "BLAKE2SMAC", "provider=default"
2222

2323
=back
2424

doc/man7/EVP_MAC-CMAC.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ used with EVP_MAC_fetch():
1515

1616
=over 4
1717

18-
=item "CMAC", "default=yes"
18+
=item "CMAC", "provider=default" or "provider=fips"
1919

2020
=back
2121

doc/man7/EVP_MAC-GMAC.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ used with EVP_MAC_fetch():
1515

1616
=over 4
1717

18-
=item "GMAC", "default=yes"
18+
=item "GMAC", "provider=default" or "provider=fips"
1919

2020
=back
2121

doc/man7/EVP_MAC-HMAC.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ used with EVP_MAC_fetch():
1515

1616
=over 4
1717

18-
=item "HMAC", "default=yes"
18+
=item "HMAC", "provider=default" or "provider=fips"
1919

2020
=back
2121

doc/man7/EVP_MAC-KMAC.pod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ properties, to be used with EVP_MAC_fetch():
1616

1717
=over 4
1818

19-
=item "KMAC-128", "default=yes"
19+
=item "KMAC-128", "provider=default" or "provider=fips"
2020

21-
=item "KMAC-256", "default=yes"
21+
=item "KMAC-256", "provider=default" or "provider=fips"
2222

2323
=back
2424

doc/man7/EVP_MAC-Poly1305.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ used with EVP_MAC_fetch():
1515

1616
=over 4
1717

18-
=item "POLY1305", "default=yes"
18+
=item "POLY1305", "provider=default"
1919

2020
=back
2121

doc/man7/EVP_MAC-Siphash.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ used with EVP_MAC_fetch():
1515

1616
=over 4
1717

18-
=item "SIPHASH", "default=yes"
18+
=item "SIPHASH", "provider=default"
1919

2020
=back
2121

doc/man7/property.pod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ The full syntax for property definitions appears below.
5252

5353
Each implementation of an algorithm can define any number of
5454
properties.
55-
For example, the default provider defines the property I<default=yes>
55+
For example, the default provider defines the property I<provider=default>
5656
for all of its algorithms.
57-
Likewise, the FIPS provider defines I<fips=yes> and the legacy provider
58-
defines I<legacy=yes> for all of their algorithms.
57+
Likewise, OpenSSL's FIPS provider defines I<provider=fips> and the legacy
58+
provider defines I<provider=legacy> for all of their algorithms.
5959

6060
=head2 Queries
6161

6262
A I<property query clause> is a single conditional test.
63-
For example, "fips=yes", "default!=yes" or "?iteration.count!=3".
63+
For example, "fips=yes", "provider!=default" or "?iteration.count!=3".
6464
The first two represent mandatory clauses, such clauses B<must> match
6565
for any algorithm to even be under consideration.
6666
The third clause represents an optional clause.
@@ -117,8 +117,8 @@ Ordering of optional clauses is not significant.
117117
=head2 Shortcut
118118

119119
In order to permit a more concise expression of boolean properties, there
120-
is one short cut: a property name alone (e.g. "default") is
121-
exactly equivalent to "default=yes" in both definitions and queries.
120+
is one short cut: a property name alone (e.g. "my.property") is
121+
exactly equivalent to "my.property=yes" in both definitions and queries.
122122

123123
=head2 Global and Local
124124

doc/man7/provider.pod

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -260,25 +260,31 @@ algorithm identifier to the appropriate fetching function.
260260

261261
The default provider is built in as part of the F<libcrypto> library.
262262
Should it be needed (if other providers are loaded and offer
263-
implementations of the same algorithms), the property "default=yes"
264-
can be used as a search criterion for these implementations.
263+
implementations of the same algorithms), the property "provider=default"
264+
can be used as a search criterion for these implementations. Some
265+
non-cryptographic algorithms (such as serializers for loading keys and
266+
parameters from files) are not FIPS algorithm implementations in themselves but
267+
support algorithms from the FIPS provider and are allowed for use in "FIPS
268+
mode". The property "fips=yes" can be used to select such algorithms.
265269

266270
=head2 FIPS provider
267271

268272
The FIPS provider is a dynamically loadable module, and must therefore
269273
be loaded explicitly, either in code or through OpenSSL configuration
270274
(see L<config(5)>).
271275
Should it be needed (if other providers are loaded and offer
272-
implementations of the same algorithms), the property "fips=yes" can
273-
be used as a search criterion for these implementations.
276+
implementations of the same algorithms), the property "provider=fips" can
277+
be used as a search criterion for these implementations. All algorithm
278+
implementations in the FIPS provider can also be selected with the property
279+
"fips=yes".
274280

275281
=head2 Legacy provider
276282

277283
The legacy provider is a dynamically loadable module, and must therefore
278284
be loaded explicitly, either in code or through OpenSSL configuration
279285
(see L<config(5)>).
280286
Should it be needed (if other providers are loaded and offer
281-
implementations of the same algorithms), the property "legacy=yes" can be
287+
implementations of the same algorithms), the property "provider=legacy" can be
282288
used as a search criterion for these implementations.
283289

284290
=head1 EXAMPLES
@@ -300,21 +306,21 @@ Fetch any available implementation of AES-128-CBC in the default context:
300306
Fetch an implementation of SHA2-256 from the default provider in the default
301307
context:
302308

303-
EVP_MD *md = EVP_MD_fetch(NULL, "SHA2-256", "default=yes");
309+
EVP_MD *md = EVP_MD_fetch(NULL, "SHA2-256", "provider=default");
304310
...
305311
EVP_MD_meth_free(md);
306312

307313
Fetch an implementation of SHA2-256 that is not from the default provider in the
308314
default context:
309315

310-
EVP_MD *md = EVP_MD_fetch(NULL, "SHA2-256", "default=no");
316+
EVP_MD *md = EVP_MD_fetch(NULL, "SHA2-256", "provider!=default");
311317
...
312318
EVP_MD_meth_free(md);
313319

314320
Fetch an implementation of SHA2-256 from the default provider in the specified
315321
context:
316322

317-
EVP_MD *md = EVP_MD_fetch(ctx, "SHA2-256", "default=yes");
323+
EVP_MD *md = EVP_MD_fetch(ctx, "SHA2-256", "provider=default");
318324
...
319325
EVP_MD_meth_free(md);
320326

@@ -324,11 +330,11 @@ implementation of WHIRLPOOL from it:
324330
/* This only needs to be done once - usually at application start up */
325331
OSSL_PROVIDER *legacy = OSSL_PROVIDER_load(NULL, "legacy");
326332

327-
EVP_MD *md = EVP_MD_fetch(NULL, "WHIRLPOOL", "legacy=yes");
333+
EVP_MD *md = EVP_MD_fetch(NULL, "WHIRLPOOL", "provider=legacy");
328334
...
329335
EVP_MD_meth_free(md);
330336

331-
Note that in the above example the property string "legacy=yes" is optional
337+
Note that in the above example the property string "provider=legacy" is optional
332338
since, assuming no other providers have been loaded, the only implementation of
333339
the "whirlpool" algorithm is in the "legacy" provider. Also note that the
334340
default provider should be explicitly loaded if it is required in addition to

0 commit comments

Comments
 (0)