xref: /freebsd/crypto/openssl/doc/man7/property.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1*b077aed3SPierre Pronchery=pod
2*b077aed3SPierre Pronchery
3*b077aed3SPierre Pronchery=head1 NAME
4*b077aed3SPierre Pronchery
5*b077aed3SPierre Proncheryproperty - Properties, a selection mechanism for algorithm implementations
6*b077aed3SPierre Pronchery
7*b077aed3SPierre Pronchery=head1 DESCRIPTION
8*b077aed3SPierre Pronchery
9*b077aed3SPierre ProncheryAs of OpenSSL 3.0, a new method has been introduced to decide which of
10*b077aed3SPierre Proncherymultiple implementations of an algorithm will be used.
11*b077aed3SPierre ProncheryThe method is centered around the concept of properties.
12*b077aed3SPierre ProncheryEach implementation defines a number of properties and when an algorithm
13*b077aed3SPierre Proncheryis being selected, filters based on these properties can be used to
14*b077aed3SPierre Proncherychoose the most appropriate implementation of the algorithm.
15*b077aed3SPierre Pronchery
16*b077aed3SPierre ProncheryProperties are like variables, they are referenced by name and have a value
17*b077aed3SPierre Proncheryassigned.
18*b077aed3SPierre Pronchery
19*b077aed3SPierre Pronchery=head2 Property Names
20*b077aed3SPierre Pronchery
21*b077aed3SPierre ProncheryProperty names fall into two categories: those reserved by the OpenSSL
22*b077aed3SPierre Proncheryproject and user defined names.
23*b077aed3SPierre ProncheryA I<reserved> property name consists of a single C-style identifier
24*b077aed3SPierre Pronchery(except for leading underscores not being permitted), which begins
25*b077aed3SPierre Proncherywith a letter and can be followed by any number of letters, numbers
26*b077aed3SPierre Proncheryand underscores.
27*b077aed3SPierre ProncheryProperty names are case-insensitive, but OpenSSL will only use lowercase
28*b077aed3SPierre Proncheryletters.
29*b077aed3SPierre Pronchery
30*b077aed3SPierre ProncheryA I<user defined> property name is similar, but it B<must> consist of
31*b077aed3SPierre Proncherytwo or more C-style identifiers, separated by periods.
32*b077aed3SPierre ProncheryThe last identifier in the name can be considered the 'true' property
33*b077aed3SPierre Proncheryname, which is prefixed by some sort of 'namespace'.
34*b077aed3SPierre ProncheryProviders for example could include their name in the prefix and use
35*b077aed3SPierre Proncheryproperty names like
36*b077aed3SPierre Pronchery
37*b077aed3SPierre Pronchery  <provider_name>.<property_name>
38*b077aed3SPierre Pronchery  <provider_name>.<algorithm_name>.<property_name>
39*b077aed3SPierre Pronchery
40*b077aed3SPierre Pronchery=head2 Properties
41*b077aed3SPierre Pronchery
42*b077aed3SPierre ProncheryA I<property> is a I<name=value> pair.
43*b077aed3SPierre ProncheryA I<property definition> is a sequence of comma separated properties.
44*b077aed3SPierre ProncheryThere can be any number of properties in a definition, however each name must
45*b077aed3SPierre Proncherybe unique.
46*b077aed3SPierre ProncheryFor example: "" defines an empty property definition (i.e., no restriction);
47*b077aed3SPierre Pronchery"my.foo=bar" defines a property named I<my.foo> which has a string value I<bar>
48*b077aed3SPierre Proncheryand "iteration.count=3" defines a property named I<iteration.count> which
49*b077aed3SPierre Proncheryhas a numeric value of I<3>.
50*b077aed3SPierre ProncheryThe full syntax for property definitions appears below.
51*b077aed3SPierre Pronchery
52*b077aed3SPierre Pronchery=head2 Implementations
53*b077aed3SPierre Pronchery
54*b077aed3SPierre ProncheryEach implementation of an algorithm can define any number of
55*b077aed3SPierre Proncheryproperties.
56*b077aed3SPierre ProncheryFor example, the default provider defines the property I<provider=default>
57*b077aed3SPierre Proncheryfor all of its algorithms.
58*b077aed3SPierre ProncheryLikewise, OpenSSL's FIPS provider defines I<provider=fips> and the legacy
59*b077aed3SPierre Proncheryprovider defines I<provider=legacy> for all of their algorithms.
60*b077aed3SPierre Pronchery
61*b077aed3SPierre Pronchery=head2 Queries
62*b077aed3SPierre Pronchery
63*b077aed3SPierre ProncheryA I<property query clause> is a single conditional test.
64*b077aed3SPierre ProncheryFor example, "fips=yes", "provider!=default" or "?iteration.count=3".
65*b077aed3SPierre ProncheryThe first two represent mandatory clauses, such clauses B<must> match
66*b077aed3SPierre Proncheryfor any algorithm to even be under consideration.
67*b077aed3SPierre ProncheryThe third clause represents an optional clause.
68*b077aed3SPierre ProncheryMatching such clauses is not a requirement, but any additional optional
69*b077aed3SPierre Proncherymatch counts in favor of the algorithm.
70*b077aed3SPierre ProncheryMore details about that in the B<Lookups> section.
71*b077aed3SPierre ProncheryA I<property query> is a sequence of comma separated property query clauses.
72*b077aed3SPierre ProncheryIt is an error if a property name appears in more than one query clause.
73*b077aed3SPierre ProncheryThe full syntax for property queries appears below, but the available syntactic
74*b077aed3SPierre Proncheryfeatures are:
75*b077aed3SPierre Pronchery
76*b077aed3SPierre Pronchery=over 4
77*b077aed3SPierre Pronchery
78*b077aed3SPierre Pronchery=item *
79*b077aed3SPierre Pronchery
80*b077aed3SPierre ProncheryB<=> is an infix operator providing an equality test.
81*b077aed3SPierre Pronchery
82*b077aed3SPierre Pronchery=item *
83*b077aed3SPierre Pronchery
84*b077aed3SPierre ProncheryB<!=> is an infix operator providing an inequality test.
85*b077aed3SPierre Pronchery
86*b077aed3SPierre Pronchery=item *
87*b077aed3SPierre Pronchery
88*b077aed3SPierre ProncheryB<?> is a prefix operator that means that the following clause is optional
89*b077aed3SPierre Proncherybut preferred.
90*b077aed3SPierre Pronchery
91*b077aed3SPierre Pronchery=item *
92*b077aed3SPierre Pronchery
93*b077aed3SPierre ProncheryB<-> is a prefix operator that means any global query clause involving the
94*b077aed3SPierre Proncheryfollowing property name should be ignored.
95*b077aed3SPierre Pronchery
96*b077aed3SPierre Pronchery=item *
97*b077aed3SPierre Pronchery
98*b077aed3SPierre ProncheryB<"..."> is a quoted string.
99*b077aed3SPierre ProncheryThe quotes are not included in the body of the string.
100*b077aed3SPierre Pronchery
101*b077aed3SPierre Pronchery=item *
102*b077aed3SPierre Pronchery
103*b077aed3SPierre ProncheryB<'...'> is a quoted string.
104*b077aed3SPierre ProncheryThe quotes are not included in the body of the string.
105*b077aed3SPierre Pronchery
106*b077aed3SPierre Pronchery=back
107*b077aed3SPierre Pronchery
108*b077aed3SPierre Pronchery=head2 Lookups
109*b077aed3SPierre Pronchery
110*b077aed3SPierre ProncheryWhen an algorithm is looked up, a property query is used to determine
111*b077aed3SPierre Proncherythe best matching algorithm.
112*b077aed3SPierre ProncheryAll mandatory query clauses B<must> be present and the implementation
113*b077aed3SPierre Proncherythat additionally has the largest number of matching optional query
114*b077aed3SPierre Proncheryclauses will be used.
115*b077aed3SPierre ProncheryIf there is more than one such optimal candidate, the result will be
116*b077aed3SPierre Proncherychosen from amongst those in an indeterminate way.
117*b077aed3SPierre ProncheryOrdering of optional clauses is not significant.
118*b077aed3SPierre Pronchery
119*b077aed3SPierre Pronchery=head2 Shortcut
120*b077aed3SPierre Pronchery
121*b077aed3SPierre ProncheryIn order to permit a more concise expression of boolean properties, there
122*b077aed3SPierre Proncheryis one short cut: a property name alone (e.g. "my.property") is
123*b077aed3SPierre Proncheryexactly equivalent to "my.property=yes" in both definitions and queries.
124*b077aed3SPierre Pronchery
125*b077aed3SPierre Pronchery=head2 Global and Local
126*b077aed3SPierre Pronchery
127*b077aed3SPierre ProncheryTwo levels of property query are supported.
128*b077aed3SPierre ProncheryA context based property query that applies to all fetch operations and a local
129*b077aed3SPierre Proncheryproperty query.
130*b077aed3SPierre ProncheryWhere both the context and local queries include a clause with the same name,
131*b077aed3SPierre Proncherythe local clause overrides the context clause.
132*b077aed3SPierre Pronchery
133*b077aed3SPierre ProncheryIt is possible for a local property query to remove a clause in the context
134*b077aed3SPierre Proncheryproperty query by preceding the property name with a '-'.
135*b077aed3SPierre ProncheryFor example, a context property query that contains "fips=yes" would normally
136*b077aed3SPierre Proncheryresult in implementations that have "fips=yes".
137*b077aed3SPierre Pronchery
138*b077aed3SPierre ProncheryHowever, if the setting of the "fips" property is irrelevant to the
139*b077aed3SPierre Proncheryoperations being performed, the local property query can include the
140*b077aed3SPierre Proncheryclause "-fips".
141*b077aed3SPierre ProncheryNote that the local property query could not use "fips=no" because that would
142*b077aed3SPierre Proncherydisallow any implementations with "fips=yes" rather than not caring about the
143*b077aed3SPierre Proncherysetting.
144*b077aed3SPierre Pronchery
145*b077aed3SPierre Pronchery=head1 SYNTAX
146*b077aed3SPierre Pronchery
147*b077aed3SPierre ProncheryThe lexical syntax in EBNF is given by:
148*b077aed3SPierre Pronchery
149*b077aed3SPierre Pronchery Definition     ::= PropertyName ( '=' Value )?
150*b077aed3SPierre Pronchery                        ( ',' PropertyName ( '=' Value )? )*
151*b077aed3SPierre Pronchery Query          ::= PropertyQuery ( ',' PropertyQuery )*
152*b077aed3SPierre Pronchery PropertyQuery  ::= '-' PropertyName
153*b077aed3SPierre Pronchery                  | '?'? ( PropertyName (( '=' | '!=' ) Value)?)
154*b077aed3SPierre Pronchery Value          ::= NumberLiteral | StringLiteral
155*b077aed3SPierre Pronchery StringLiteral  ::= QuotedString | UnquotedString
156*b077aed3SPierre Pronchery QuotedString   ::= '"' [^"]* '"' | "'" [^']* "'"
157*b077aed3SPierre Pronchery UnquotedString ::= [A-Za-z] [^{space},]+
158*b077aed3SPierre Pronchery NumberLiteral  ::= '0' ( [0-7]* | 'x' [0-9A-Fa-f]+ ) | '-'? [1-9] [0-9]+
159*b077aed3SPierre Pronchery PropertyName   ::= [A-Za-z] [A-Za-z0-9_]* ( '.' [A-Za-z] [A-Za-z0-9_]* )*
160*b077aed3SPierre Pronchery
161*b077aed3SPierre ProncheryThe flavour of EBNF being used is defined by:
162*b077aed3SPierre ProncheryL<https://www.w3.org/TR/2010/REC-xquery-20101214/#EBNFNotation>.
163*b077aed3SPierre Pronchery
164*b077aed3SPierre Pronchery=head1 HISTORY
165*b077aed3SPierre Pronchery
166*b077aed3SPierre ProncheryProperties were added in OpenSSL 3.0
167*b077aed3SPierre Pronchery
168*b077aed3SPierre Pronchery=head1 COPYRIGHT
169*b077aed3SPierre Pronchery
170*b077aed3SPierre ProncheryCopyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.
171*b077aed3SPierre Pronchery
172*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
173*b077aed3SPierre Proncherythis file except in compliance with the License.  You can obtain a copy
174*b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at
175*b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>.
176*b077aed3SPierre Pronchery
177*b077aed3SPierre Pronchery=cut
178