@@ -40,13 +40,13 @@ SSL_get1_curves, SSL_get_shared_curve, SSL_CTX_get0_implemented_groups
4040
4141For all of the functions below that set the supported groups there must be at
4242least one group in the list. A number of these functions identify groups via a
43- unique integer NID value. However, support for some groups may be added by
44- external providers. In this case there will be no NID assigned for the group.
43+ unique integer B< NID> value. However, support for some groups may be added by
44+ external providers. In this case there will be no B< NID> assigned for the group.
4545When setting such groups applications should use the "list" form of these
4646functions (i.e. SSL_CTX_set1_groups_list() and SSL_set1_groups_list()).
4747
4848SSL_CTX_set1_groups() sets the supported groups for B<ctx> to B<glistlen>
49- groups in the array B<glist>. The array consist of all NIDs of supported groups.
49+ groups in the array B<glist>. The array consist of all B< NIDs> of supported groups.
5050The supported groups for B<TLSv1.3> include:
5151B<NID_X9_62_prime256v1>,
5252B<NID_secp384r1>,
@@ -73,20 +73,27 @@ B<SSL_OP_SERVER_PREFERENCE> is set, the order of the elements in the
7373array determines the selected group. Otherwise, the order is ignored and the
7474client's order determines the selection.
7575
76- For a TLS 1.3 server, the groups determine the selected group, but
77- selection is more complex. A TLS 1.3 client sends both a group list as well as a
78- predicted subset of groups. Choosing a group outside the predicted subset incurs
79- an extra roundtrip. However, in some situations, the most preferred group may
80- not be predicted. OpenSSL considers all supported groups in I<clist> to be comparable
81- in security and prioritizes avoiding roundtrips above either client or server
82- preference order. If an application uses an external provider to extend OpenSSL
83- with, e.g., a post-quantum algorithm, this behavior may allow a network attacker
84- to downgrade connections to a weaker algorithm. It is therefore recommended
85- to use SSL_CTX_set1_groups_list() with the ability to specify group tuples.
76+ For a TLS 1.3 server, the groups determine the selected group, but selection is
77+ more complex.
78+ A TLS 1.3 client sends both a group list and predicted keyshares for a subset
79+ of groups.
80+ A server choosing a group outside the client's predicted subset incurs an extra
81+ roundtrip.
82+ However, in some situations, the most preferred group may not be predicted.
83+
84+ When groups are specified via SSL_CTX_set1_groups() as a list of B<NID>
85+ values, OpenSSL considers all supported groups in I<clist> to be comparable in
86+ security and prioritises avoiding roundtrips above either client or server
87+ preference order.
88+ If an application uses an external provider to extend OpenSSL with, e.g., a
89+ post-quantum algorithm, this behavior may allow a network attacker to downgrade
90+ connections to a weaker algorithm.
91+ It is therefore recommended to use SSL_CTX_set1_groups_list() instead, making
92+ it possible to specify group tuples as described below.
8693
8794SSL_CTX_set1_groups_list() sets the supported groups for B<ctx> to
8895string I<list>. In contrast to SSL_CTX_set1_groups(), the names of the
89- groups, rather than their NIDs, are used.
96+ groups, rather than their B< NIDs> , are used.
9097
9198The commands below list the available groups for TLS 1.2 and TLS 1.3,
9299respectively:
@@ -102,30 +109,72 @@ The preferred group names are those defined by
102109L<IANA|https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8>.
103110
104111The I<list> can be used to define several group tuples of comparable security
105- levels, and can specify which key shares should be sent by a client.
106- The specified list elements can optionally be ignored, if not implemented
112+ levels, and can specify which predicted key shares should be sent by a client.
113+ Group tuples are used by OpenSSL TLS servers to decide whether to request a
114+ stronger keyshare than those predicted by sending a Hello Retry Request
115+ (B<HRR>) even if some of the predicted groups are supported.
116+ OpenSSL clients ignore tuple boundaries, and pay attenion only to the overall
117+ order of I<list> elements and which groups are selected as predicted keyshares
118+ as described below.
119+
120+ The specified list elements can optionally be ignored if not implemented
107121(listing unknown groups otherwise results in error).
108- It is also possible to specify the built-in default set of groups, and to explicitly
109- remove a group from that list.
110-
111- In its simplest form, the string I<list> is just a colon separated list
112- of group names, for example "P-521:P-384:P-256:X25519:ffdhe2048". The first
113- group listed will also be used for the B<key_share> sent by a client in a
114- TLSv1.3 B<ClientHello>. For servers note the discussion above. The list should
115- be in order of preference with the most preferred group first.
116-
117- Group tuples of comparable security are defined by separating them from each
118- other by a tuple separator C</>. Keyshares to be sent by a client are specified
119- by prepending a C<*> to the group name, while any C<*> will be ignored by a
120- server. The following string I<list> for example defines three tuples when
121- used on the server-side, and triggers the generation of three key shares
122- when used on the client-side: P-521:*P-256/*P-384/*X25519:P-384:ffdhe2048.
123-
124- If a group name is preceded with the C<?> character, it will be ignored if an
125- implementation is missing. If a group name is preceded with the C<-> character, it
126- will be removed from the list of groups if present (including not sending a
127- key share for this group), ignored otherwise. The pseudo group name
128- C<DEFAULT> can be used to select the OpenSSL built-in default list of groups.
122+ It is also possible to specify the built-in default set of groups, and to
123+ explicitly remove a group from that list.
124+
125+ In its simplest legacy form, the string I<list> is just a colon separated list
126+ of group names, for example "P-521:P-384:P-256:X25519:ffdhe2048".
127+ The first group listed will in this case be used as the sole predicted
128+ B<key_share> sent by a client in a TLSv1.3 B<ClientHello>.
129+ The list should be in order of preference with the most preferred group first.
130+
131+ A more expressive syntax supports definition of group tuples of comparable
132+ security by separating them from each other with C</> characters.
133+
134+ The predicted keyshares to be sent by clients can be explicitly specified by
135+ adding a C<*> prefix to the associated group name.
136+ These C<*> prefixes are ignored by servers.
137+
138+ If a group name is prefixed with the C<?> character, it will be ignored if an
139+ implementation is missing.
140+ Otherwise, listing an unknown group name will cause a failure to parse the
141+ I<list>.
142+ Note that whether a group is known or not may depend on the OpenSSL version,
143+ how OpenSSL was compiled and/or which providers are loaded.
144+ Make sure you have the correct spelling of the group name and when in doubt
145+ prefix it with a C<?> to handle configurations in which it might nevertheless
146+ be unknown.
147+
148+ If a group name is prefixed with the C<-> character, it will be removed from
149+ the list of groups specified up to that point.
150+ It can be added again if specified later.
151+ Removal of groups that have not been included earlier in the list is silently
152+ ignored.
153+
154+ The pseudo group name C<DEFAULT> can be used to select the OpenSSL built-in
155+ default list of groups.
156+ Prepending one or more groups to C<DEFAULT> using only C<:> separators prepends those
157+ groups to the built-in default list's first tuple.
158+ Additional tuples can be prepended by use of the C</> separator.
159+ Appending a set of groups to C<DEFAULT> using only C<:> separators appends those
160+ groups to the built-in default list's last tuple.
161+ Additional tuples can be appended by use of the C</> separator.
162+
163+ The B<DEFAULT> list selects B<X25519MLKEM768> as one of the predicted keyshares.
164+ In rare cases this can lead to failures or timeouts because the resulting
165+ larger TLS Client Hello message may no longer fit in a single TCP segment and
166+ firewall software may erroneously disrupt the TLS handshake.
167+ If this is an issue or concern, prepending C<?X25519MLKEM768:> without a C<*>
168+ prefix leads to its occurrence in the default list to be ignored as a duplicate,
169+ and along with that also the keyshare prediction.
170+ The group will then only be selected by servers that specifically expect it,
171+ after a Hello Retry Request (HRR).
172+ Servers that specifically prefer B<X25519MLKEM768>, are much less likely to be
173+ found behind problematic firewalls.
174+
175+ The following string I<list> for example defines three tuples when used on the
176+ server-side, and triggers the generation of three key shares when used on the
177+ client-side: P-521:*P-256/*P-384/*X25519:P-384:ffdhe2048.
129178
130179For a TLS 1.3 client, all the groups in the string I<list> are added to the
131180supported groups extension of a C<ClientHello>, in the order in which they are listed,
0 commit comments