5 property - Properties, a selection mechanism for algorithm implementations
9 As of OpenSSL 3.0, a new method has been introduced to decide which of
10 multiple implementations of an algorithm will be used.
11 The method is centered around the concept of properties.
12 Each implementation defines a number of properties and when an algorithm
13 is being selected, filters based on these properties can be used to
14 choose the most appropriate implementation of the algorithm.
16 Properties are like variables, they are referenced by name and have a value
21 Property names fall into two categories: those reserved by the OpenSSL
22 project and user defined names.
23 A I<reserved> property name consists of a single C-style identifier
24 (except for leading underscores not being permitted), which begins
25 with a letter and can be followed by any number of letters, numbers
27 Property names are case-insensitive, but OpenSSL will only use lowercase
30 A I<user defined> property name is similar, but it B<must> consist of
31 two or more C-style identifiers, separated by periods.
32 The last identifier in the name can be considered the 'true' property
33 name, which is prefixed by some sort of 'namespace'.
34 Providers for example could include their name in the prefix and use
37 <provider_name>.<property_name>
38 <provider_name>.<algorithm_name>.<property_name>
42 A I<property> is a I<name=value> pair.
43 A I<property definition> is a sequence of comma separated properties.
44 There can be any number of properties in a definition, however each name must
46 For example: "" defines an empty property definition (i.e., no restriction);
47 "my.foo=bar" defines a property named I<my.foo> which has a string value I<bar>
48 and "iteration.count=3" defines a property named I<iteration.count> which
49 has a numeric value of I<3>.
50 The full syntax for property definitions appears below.
52 =head2 Implementations
54 Each implementation of an algorithm can define any number of
56 For example, the default provider defines the property I<provider=default>
57 for all of its algorithms.
58 Likewise, OpenSSL's FIPS provider defines I<provider=fips> and the legacy
59 provider defines I<provider=legacy> for all of their algorithms.
63 A I<property query clause> is a single conditional test.
64 For example, "fips=yes", "provider!=default" or "?iteration.count=3".
65 The first two represent mandatory clauses, such clauses B<must> match
66 for any algorithm to even be under consideration.
67 The third clause represents an optional clause.
68 Matching such clauses is not a requirement, but any additional optional
69 match counts in favor of the algorithm.
70 More details about that in the B<Lookups> section.
71 A I<property query> is a sequence of comma separated property query clauses.
72 It is an error if a property name appears in more than one query clause.
73 The full syntax for property queries appears below, but the available syntactic
80 B<=> is an infix operator providing an equality test.
84 B<!=> is an infix operator providing an inequality test.
88 B<?> is a prefix operator that means that the following clause is optional
93 B<-> is a prefix operator that means any global query clause involving the
94 following property name should be ignored.
98 B<"..."> is a quoted string.
99 The quotes are not included in the body of the string.
103 B<'...'> is a quoted string.
104 The quotes are not included in the body of the string.
110 When an algorithm is looked up, a property query is used to determine
111 the best matching algorithm.
112 All mandatory query clauses B<must> be present and the implementation
113 that additionally has the largest number of matching optional query
114 clauses will be used.
115 If there is more than one such optimal candidate, the result will be
116 chosen from amongst those in an indeterminate way.
117 Ordering of optional clauses is not significant.
121 In order to permit a more concise expression of boolean properties, there
122 is one short cut: a property name alone (e.g. "my.property") is
123 exactly equivalent to "my.property=yes" in both definitions and queries.
125 =head2 Global and Local
127 Two levels of property query are supported.
128 A context based property query that applies to all fetch operations and a local
130 Where both the context and local queries include a clause with the same name,
131 the local clause overrides the context clause.
133 It is possible for a local property query to remove a clause in the context
134 property query by preceding the property name with a '-'.
135 For example, a context property query that contains "fips=yes" would normally
136 result in implementations that have "fips=yes".
138 However, if the setting of the "fips" property is irrelevant to the
139 operations being performed, the local property query can include the
141 Note that the local property query could not use "fips=no" because that would
142 disallow any implementations with "fips=yes" rather than not caring about the
147 The lexical syntax in EBNF is given by:
149 Definition ::= PropertyName ( '=' Value )?
150 ( ',' PropertyName ( '=' Value )? )*
151 Query ::= PropertyQuery ( ',' PropertyQuery )*
152 PropertyQuery ::= '-' PropertyName
153 | '?'? ( PropertyName (( '=' | '!=' ) Value)?)
154 Value ::= NumberLiteral | StringLiteral
155 StringLiteral ::= QuotedString | UnquotedString
156 QuotedString ::= '"' [^"]* '"' | "'" [^']* "'"
157 UnquotedString ::= [A-Za-z] [^{space},]+
158 NumberLiteral ::= '0' ( [0-7]* | 'x' [0-9A-Fa-f]+ ) | '-'? [1-9] [0-9]+
159 PropertyName ::= [A-Za-z] [A-Za-z0-9_]* ( '.' [A-Za-z] [A-Za-z0-9_]* )*
161 The flavour of EBNF being used is defined by:
162 L<https://www.w3.org/TR/2010/REC-xquery-20101214/#EBNFNotation>.
166 Properties were added in OpenSSL 3.0
170 Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.
172 Licensed under the Apache License 2.0 (the "License"). You may not use
173 this file except in compliance with the License. You can obtain a copy
174 in the file LICENSE in the source distribution or at
175 L<https://www.openssl.org/source/license.html>.