]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man7/property.pod
Document property hierarchy.
[thirdparty/openssl.git] / doc / man7 / property.pod
CommitLineData
cec3901a
P
1=pod
2
3=head1 NAME
4
5property - Properties, a selection mechanism for algorithm implementations
6
7=head1 DESCRIPTION
8
9As of OpenSSL 3.0, a new method has been introduced to decide which of
10multiple implementations of an algorithm will be used.
11The method is centered around the concept of properties.
12Each implementation defines a number of properties and when an algorithm
13is being selected, filters based on these properties can be used to
14choose the most appropriate implementation of the algorithm.
15
16Properties are like variables, they are referenced by name and have a value
17assigned.
18
19=head2 Property Names
20
21Property names fall into two categories: those reserved by the OpenSSL
22project and user defined names.
23A I<reserved> property name consists of a single C-style identifier
24(except for leading underscores not being permitted), which begins
25with a letter and can be followed by any number of letters, numbers
26and underscores.
27Property names are case-insensitive, but OpenSSL will only use lowercase
28letters.
29
30A I<user defined> property name is similar, but it B<must> consist of
31two or more C-style identifiers, separated by periods.
32The last identifier in the name can be considered the 'true' property
33name, which is prefixed by some sort of 'namespace'.
34Providers for example could include their name in the prefix and use
35property names like
36
37 <provider_name>.<property_name>
38 <provider_name>.<algorithm_name>.<property_name>
39
40=head2 Properties
41
42A I<property> is a I<name=value> pair.
43A I<property definition> is a sequence of comma separated properties.
44There can be any number of properties in a definition.
45For example: "" defines a null property definition; "my.foo=bar"
46defines a property named I<my.foo> which has a string value I<bar> and
47"iteration.count=3" defines a property named I<iteration.count> which
48has a numeric value of I<3>.
49The full syntax for property definitions appears below.
50
51=head2 Implementations
52
53Each implementation of an algorithm can define any number of
54properties.
55For example, the default provider defines the property I<default=yes>
56for all of its algorithms.
57Likewise, the FIPS provider defines I<fips=yes> and the legacy provider
58defines I<legacy=yes> for all of their algorithms.
59
60=head2 Queries
61
62A I<property query clause> is a single conditional test.
63For example, "fips=yes", "default!=yes" or "?iteration.count!=3".
64The first two represent mandatory clauses, such clauses B<must> match
65for any algorithm to even be under consideration.
66The third clause represents an optional clause.
67Matching such clauses is not a requirement, but any additional optional
68match counts in favor of the algorithm.
69More details about that in the B<Lookups> section.
70A I<property query> is a sequence of comma separated property query clauses.
85e0ad9f
P
71The full syntax for property queries appears below, but the available syntatic
72features are:
73
74=over
75
76=item *
77
78B<=> is an infix operator providing an equality test.
79
80=item *
81
82B<!=> is an infix operator providing an inequality test.
83
84=item *
85
86B<?> is a prefix operator that means that the following clause is optional
87but preferred.
88
89=item *
90
91B<-> is a prefix operator that means any global query clause involving the
92following property name should be ignored.
93
94=item *
95
96B<"..."> is a quoted string.
97The quotes are not included in the body of the string.
98
99=item *
100
101B<'...'> is a quoted string.
102The quotes are not included in the body of the string.
103
104=back
cec3901a
P
105
106=head2 Lookups
107
108When an algorithm is looked up, a property query is used to determine
109the best matching algorithm.
110All mandatory query clauses B<must> be present and the implementation
111that additionally has the largest number of matching optional query
112clauses will be used.
113If there is more than one such optimal candidate, the result will be
114chosen from amongst those in an indeterminate way.
115Ordering of optional clauses is not significant.
116
117=head2 Shortcut
118
119In order to permit a more concise expression of boolean properties, there
120is one short cut: a property name alone (e.g. "default") is
121exactly equivalent to "default=yes" in both definitions and queries.
122
85e0ad9f
P
123=head2 Global and Local
124
125Two levels of property query are supported.
126A context based property query that applies to all fetch operations and a local
127property query.
128Where both the context and local queries include a clause with the same name,
129the local clause is used and the context one ignored.
130For example, a context property query of "fips=yes" and a local property query
131of "fips=no" would result in algorithms that have the "fips" property set t
132"no".
133
134=head2 Override
135
136It is possible for a local property query to override a clause in the context
137property query by preceeding the property name with a '-'.
138For example, a conxtet property query that contains "fips=yes" would normally
139result in implementations that have "fips=yes".
140However, if the setting of
141the "fips" property is irrelevant to the operations being performed, the local
142property query can include the clause "-fips".
143Note that the local property query could not use "fips=no" because that would
144disallow any implementations with "fips=yes" rather than not caring about the
145setting.
146
147=head1 SYNTAX
cec3901a
P
148
149The lexical syntax in EBNF is given by:
150
151 Definition ::= PropertyName ( '=' Value )?
152 ( ',' PropertyName ( '=' Value )? )*
153 Query ::= PropertyQuery ( ',' PropertyQuery )*
915bf45e 154 PropertyQuery ::= '-' PropertyName
cec3901a
P
155 | '?'? ( PropertyName (( '=' | '!=' ) Value)?)
156 Value ::= NumberLiteral | StringLiteral
157 StringLiteral ::= QuotedString | UnquotedString
158 QuotedString ::= '"' [^"]* '"' | "'" [^']* "'"
159 UnquotedString ::= [^{space},]+
160 NumberLiteral ::= '0' ( [0-7]* | 'x' [0-9A-Fa-f]+ ) | '-'? [1-9] [0-9]+
161 PropertyName ::= [A-Z] [A-Z0-9_]* ( '.' [A-Z] [A-Z0-9_]* )*
162
cec3901a
P
163=head1 HISTORY
164
165Properties were added in OpenSSL 3.0
166
167=head1 COPYRIGHT
168
169Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
170
171Licensed under the Apache License 2.0 (the "License"). You may not use
172this file except in compliance with the License. You can obtain a copy
173in the file LICENSE in the source distribution or at
174L<https://www.openssl.org/source/license.html>.
175
176=cut