]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - secure/lib/libcrypto/man/man3/SSL_CTX_set_security_level.3
Merge OpenSSL 1.1.1i.
[FreeBSD/FreeBSD.git] / secure / lib / libcrypto / man / man3 / SSL_CTX_set_security_level.3
1 .\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 .    ds C`
42 .    ds C'
43 'br\}
44 .\"
45 .\" Escape single quotes in literal strings from groff's Unicode transform.
46 .ie \n(.g .ds Aq \(aq
47 .el       .ds Aq '
48 .\"
49 .\" If the F register is >0, we'll generate index entries on stderr for
50 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
51 .\" entries marked with X<> in POD.  Of course, you'll have to process the
52 .\" output yourself in some meaningful fashion.
53 .\"
54 .\" Avoid warning from groff about undefined register 'F'.
55 .de IX
56 ..
57 .nr rF 0
58 .if \n(.g .if rF .nr rF 1
59 .if (\n(rF:(\n(.g==0)) \{\
60 .    if \nF \{\
61 .        de IX
62 .        tm Index:\\$1\t\\n%\t"\\$2"
63 ..
64 .        if !\nF==2 \{\
65 .            nr % 0
66 .            nr F 2
67 .        \}
68 .    \}
69 .\}
70 .rr rF
71 .\"
72 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
73 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
74 .    \" fudge factors for nroff and troff
75 .if n \{\
76 .    ds #H 0
77 .    ds #V .8m
78 .    ds #F .3m
79 .    ds #[ \f1
80 .    ds #] \fP
81 .\}
82 .if t \{\
83 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
84 .    ds #V .6m
85 .    ds #F 0
86 .    ds #[ \&
87 .    ds #] \&
88 .\}
89 .    \" simple accents for nroff and troff
90 .if n \{\
91 .    ds ' \&
92 .    ds ` \&
93 .    ds ^ \&
94 .    ds , \&
95 .    ds ~ ~
96 .    ds /
97 .\}
98 .if t \{\
99 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
100 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
101 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
102 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
103 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
104 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
105 .\}
106 .    \" troff and (daisy-wheel) nroff accents
107 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
108 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
109 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
110 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
111 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
112 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
113 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
114 .ds ae a\h'-(\w'a'u*4/10)'e
115 .ds Ae A\h'-(\w'A'u*4/10)'E
116 .    \" corrections for vroff
117 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
118 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
119 .    \" for low resolution devices (crt and lpr)
120 .if \n(.H>23 .if \n(.V>19 \
121 \{\
122 .    ds : e
123 .    ds 8 ss
124 .    ds o a
125 .    ds d- d\h'-1'\(ga
126 .    ds D- D\h'-1'\(hy
127 .    ds th \o'bp'
128 .    ds Th \o'LP'
129 .    ds ae ae
130 .    ds Ae AE
131 .\}
132 .rm #[ #] #H #V #F C
133 .\" ========================================================================
134 .\"
135 .IX Title "SSL_CTX_SET_SECURITY_LEVEL 3"
136 .TH SSL_CTX_SET_SECURITY_LEVEL 3 "2020-12-08" "1.1.1i" "OpenSSL"
137 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
138 .\" way too many mistakes in technical documents.
139 .if n .ad l
140 .nh
141 .SH "NAME"
142 SSL_CTX_set_security_level, SSL_set_security_level, SSL_CTX_get_security_level, SSL_get_security_level, SSL_CTX_set_security_callback, SSL_set_security_callback, SSL_CTX_get_security_callback, SSL_get_security_callback, SSL_CTX_set0_security_ex_data, SSL_set0_security_ex_data, SSL_CTX_get0_security_ex_data, SSL_get0_security_ex_data \- SSL/TLS security framework
143 .SH "SYNOPSIS"
144 .IX Header "SYNOPSIS"
145 .Vb 1
146 \& #include <openssl/ssl.h>
147 \&
148 \& void SSL_CTX_set_security_level(SSL_CTX *ctx, int level);
149 \& void SSL_set_security_level(SSL *s, int level);
150 \&
151 \& int SSL_CTX_get_security_level(const SSL_CTX *ctx);
152 \& int SSL_get_security_level(const SSL *s);
153 \&
154 \& void SSL_CTX_set_security_callback(SSL_CTX *ctx,
155 \&                                    int (*cb)(SSL *s, SSL_CTX *ctx, int op,
156 \&                                              int bits, int nid,
157 \&                                              void *other, void *ex));
158 \&
159 \& void SSL_set_security_callback(SSL *s, int (*cb)(SSL *s, SSL_CTX *ctx, int op,
160 \&                                                  int bits, int nid,
161 \&                                                  void *other, void *ex));
162 \&
163 \& int (*SSL_CTX_get_security_callback(const SSL_CTX *ctx))(SSL *s, SSL_CTX *ctx, int op,
164 \&                                                          int bits, int nid, void *other,
165 \&                                                          void *ex);
166 \& int (*SSL_get_security_callback(const SSL *s))(SSL *s, SSL_CTX *ctx, int op,
167 \&                                                int bits, int nid, void *other,
168 \&                                                void *ex);
169 \&
170 \& void SSL_CTX_set0_security_ex_data(SSL_CTX *ctx, void *ex);
171 \& void SSL_set0_security_ex_data(SSL *s, void *ex);
172 \&
173 \& void *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx);
174 \& void *SSL_get0_security_ex_data(const SSL *s);
175 .Ve
176 .SH "DESCRIPTION"
177 .IX Header "DESCRIPTION"
178 The functions \fBSSL_CTX_set_security_level()\fR and \fBSSL_set_security_level()\fR set
179 the security level to \fBlevel\fR. If not set the library default security level
180 is used.
181 .PP
182 The functions \fBSSL_CTX_get_security_level()\fR and \fBSSL_get_security_level()\fR
183 retrieve the current security level.
184 .PP
185 \&\fBSSL_CTX_set_security_callback()\fR, \fBSSL_set_security_callback()\fR,
186 \&\fBSSL_CTX_get_security_callback()\fR and \fBSSL_get_security_callback()\fR get or set
187 the security callback associated with \fBctx\fR or \fBs\fR. If not set a default
188 security callback is used. The meaning of the parameters and the behaviour
189 of the default callbacks is described below.
190 .PP
191 \&\fBSSL_CTX_set0_security_ex_data()\fR, \fBSSL_set0_security_ex_data()\fR,
192 \&\fBSSL_CTX_get0_security_ex_data()\fR and \fBSSL_get0_security_ex_data()\fR set the
193 extra data pointer passed to the \fBex\fR parameter of the callback. This
194 value is passed to the callback verbatim and can be set to any convenient
195 application specific value.
196 .SH "DEFAULT CALLBACK BEHAVIOUR"
197 .IX Header "DEFAULT CALLBACK BEHAVIOUR"
198 If an application doesn't set its own security callback the default
199 callback is used. It is intended to provide sane defaults. The meaning
200 of each level is described below.
201 .IP "\fBLevel 0\fR" 4
202 .IX Item "Level 0"
203 Everything is permitted. This retains compatibility with previous versions of
204 OpenSSL.
205 .IP "\fBLevel 1\fR" 4
206 .IX Item "Level 1"
207 The security level corresponds to a minimum of 80 bits of security. Any
208 parameters offering below 80 bits of security are excluded. As a result \s-1RSA,
209 DSA\s0 and \s-1DH\s0 keys shorter than 1024 bits and \s-1ECC\s0 keys shorter than 160 bits
210 are prohibited. All export cipher suites are prohibited since they all offer
211 less than 80 bits of security. \s-1SSL\s0 version 2 is prohibited. Any cipher suite
212 using \s-1MD5\s0 for the \s-1MAC\s0 is also prohibited.
213 .IP "\fBLevel 2\fR" 4
214 .IX Item "Level 2"
215 Security level set to 112 bits of security. As a result \s-1RSA, DSA\s0 and \s-1DH\s0 keys
216 shorter than 2048 bits and \s-1ECC\s0 keys shorter than 224 bits are prohibited.
217 In addition to the level 1 exclusions any cipher suite using \s-1RC4\s0 is also
218 prohibited. \s-1SSL\s0 version 3 is also not allowed. Compression is disabled.
219 .IP "\fBLevel 3\fR" 4
220 .IX Item "Level 3"
221 Security level set to 128 bits of security. As a result \s-1RSA, DSA\s0 and \s-1DH\s0 keys
222 shorter than 3072 bits and \s-1ECC\s0 keys shorter than 256 bits are prohibited.
223 In addition to the level 2 exclusions cipher suites not offering forward
224 secrecy are prohibited. \s-1TLS\s0 versions below 1.1 are not permitted. Session
225 tickets are disabled.
226 .IP "\fBLevel 4\fR" 4
227 .IX Item "Level 4"
228 Security level set to 192 bits of security. As a result \s-1RSA, DSA\s0 and
229 \&\s-1DH\s0 keys shorter than 7680 bits and \s-1ECC\s0 keys shorter than 384 bits are
230 prohibited.  Cipher suites using \s-1SHA1\s0 for the \s-1MAC\s0 are prohibited. \s-1TLS\s0
231 versions below 1.2 are not permitted.
232 .IP "\fBLevel 5\fR" 4
233 .IX Item "Level 5"
234 Security level set to 256 bits of security. As a result \s-1RSA, DSA\s0 and \s-1DH\s0 keys
235 shorter than 15360 bits and \s-1ECC\s0 keys shorter than 512 bits are prohibited.
236 .SH "APPLICATION DEFINED SECURITY CALLBACKS"
237 .IX Header "APPLICATION DEFINED SECURITY CALLBACKS"
238 \&\fIDocumentation to be provided.\fR
239 .SH "NOTES"
240 .IX Header "NOTES"
241 The default security level can be configured when OpenSSL is compiled by
242 setting \fB\-DOPENSSL_TLS_SECURITY_LEVEL=level\fR. If not set then 1 is used.
243 .PP
244 The security framework disables or reject parameters inconsistent with the
245 set security level. In the past this was difficult as applications had to set
246 a number of distinct parameters (supported ciphers, supported curves supported
247 signature algorithms) to achieve this end and some cases (\s-1DH\s0 parameter size
248 for example) could not be checked at all.
249 .PP
250 By setting an appropriate security level much of this complexity can be
251 avoided.
252 .PP
253 The bits of security limits affect all relevant parameters including
254 cipher suite encryption algorithms, supported \s-1ECC\s0 curves, supported
255 signature algorithms, \s-1DH\s0 parameter sizes, certificate key sizes and
256 signature algorithms. This limit applies no matter what other custom
257 settings an application has set: so if the cipher suite is set to \fB\s-1ALL\s0\fR
258 then only cipher suites consistent with the security level are permissible.
259 .PP
260 See \s-1SP800\-57\s0 for how the security limits are related to individual
261 algorithms.
262 .PP
263 Some security levels require large key sizes for non-ECC public key
264 algorithms which can severely degrade performance. For example 256 bits
265 of security requires the use of \s-1RSA\s0 keys of at least 15360 bits in size.
266 .PP
267 Some restrictions can be gracefully handled: for example cipher suites
268 offering insufficient security are not sent by the client and will not
269 be selected by the server. Other restrictions such as the peer certificate
270 key size or the \s-1DH\s0 parameter size will abort the handshake with a fatal
271 alert.
272 .PP
273 Attempts to set certificates or parameters with insufficient security are
274 also blocked. For example trying to set a certificate using a 512 bit \s-1RSA\s0
275 key using \fBSSL_CTX_use_certificate()\fR at level 1. Applications which do not
276 check the return values for errors will misbehave: for example it might
277 appear that a certificate is not set at all because it had been rejected.
278 .SH "RETURN VALUES"
279 .IX Header "RETURN VALUES"
280 \&\fBSSL_CTX_set_security_level()\fR and \fBSSL_set_security_level()\fR do not return values.
281 .PP
282 \&\fBSSL_CTX_get_security_level()\fR and \fBSSL_get_security_level()\fR return a integer that
283 represents the security level with \fB\s-1SSL_CTX\s0\fR or \fB\s-1SSL\s0\fR, respectively.
284 .PP
285 \&\fBSSL_CTX_set_security_callback()\fR and \fBSSL_set_security_callback()\fR do not return
286 values.
287 .PP
288 \&\fBSSL_CTX_get_security_callback()\fR and \fBSSL_get_security_callback()\fR return the pointer
289 to the security callback or \s-1NULL\s0 if the callback is not set.
290 .PP
291 \&\fBSSL_CTX_get0_security_ex_data()\fR and \fBSSL_get0_security_ex_data()\fR return the extra
292 data pointer or \s-1NULL\s0 if the ex data is not set.
293 .SH "HISTORY"
294 .IX Header "HISTORY"
295 These functions were added in OpenSSL 1.1.0.
296 .SH "COPYRIGHT"
297 .IX Header "COPYRIGHT"
298 Copyright 2014\-2020 The OpenSSL Project Authors. All Rights Reserved.
299 .PP
300 Licensed under the OpenSSL license (the \*(L"License\*(R").  You may not use
301 this file except in compliance with the License.  You can obtain a copy
302 in the file \s-1LICENSE\s0 in the source distribution or at
303 <https://www.openssl.org/source/license.html>.