xref: /freebsd/secure/lib/libcrypto/man/man3/SSL_CTX_set_security_level.3 (revision 174c0ac687ec4ccb0b56ee30d48c0a7b8b9c4e15)
Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)

Standard preamble:
========================================================================
..
..
.. Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.

If the F register is >0, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.

Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================

Title "SSL_CTX_SET_SECURITY_LEVEL 3ossl"
SSL_CTX_SET_SECURITY_LEVEL 3ossl "2023-09-19" "3.0.11" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
"NAME"
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
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1 #include <openssl/ssl.h> \& void SSL_CTX_set_security_level(SSL_CTX *ctx, int level); void SSL_set_security_level(SSL *s, int level); \& int SSL_CTX_get_security_level(const SSL_CTX *ctx); int SSL_get_security_level(const SSL *s); \& void SSL_CTX_set_security_callback(SSL_CTX *ctx, int (*cb)(SSL *s, SSL_CTX *ctx, int op, int bits, int nid, void *other, void *ex)); \& void SSL_set_security_callback(SSL *s, int (*cb)(SSL *s, SSL_CTX *ctx, int op, int bits, int nid, void *other, void *ex)); \& int (*SSL_CTX_get_security_callback(const SSL_CTX *ctx))(SSL *s, SSL_CTX *ctx, int op, int bits, int nid, void *other, void *ex); int (*SSL_get_security_callback(const SSL *s))(SSL *s, SSL_CTX *ctx, int op, int bits, int nid, void *other, void *ex); \& void SSL_CTX_set0_security_ex_data(SSL_CTX *ctx, void *ex); void SSL_set0_security_ex_data(SSL *s, void *ex); \& void *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx); void *SSL_get0_security_ex_data(const SSL *s); .Ve
"DESCRIPTION"
Header "DESCRIPTION" The functions SSL_CTX_set_security_level() and SSL_set_security_level() set the security level to level. If not set the library default security level is used.

The functions SSL_CTX_get_security_level() and SSL_get_security_level() retrieve the current security level.

\fBSSL_CTX_set_security_callback(), SSL_set_security_callback(), \fBSSL_CTX_get_security_callback() and SSL_get_security_callback() get or set the security callback associated with ctx or s. If not set a default security callback is used. The meaning of the parameters and the behaviour of the default callbacks is described below.

\fBSSL_CTX_set0_security_ex_data(), SSL_set0_security_ex_data(), \fBSSL_CTX_get0_security_ex_data() and SSL_get0_security_ex_data() set the extra data pointer passed to the ex parameter of the callback. This value is passed to the callback verbatim and can be set to any convenient application specific value.

"DEFAULT CALLBACK BEHAVIOUR"
Header "DEFAULT CALLBACK BEHAVIOUR" If an application doesn't set its own security callback the default callback is used. It is intended to provide sane defaults. The meaning of each level is described below.
"Level 0" 4
Item "Level 0" Everything is permitted. This retains compatibility with previous versions of OpenSSL.
"Level 1" 4
Item "Level 1" The security level corresponds to a minimum of 80 bits of security. Any parameters offering below 80 bits of security are excluded. As a result \s-1RSA, DSA\s0 and \s-1DH\s0 keys shorter than 1024 bits and \s-1ECC\s0 keys shorter than 160 bits are prohibited. All export cipher suites are prohibited since they all offer less than 80 bits of security. \s-1SSL\s0 version 2 is prohibited. Any cipher suite using \s-1MD5\s0 for the \s-1MAC\s0 is also prohibited. Note that signatures using \s-1SHA1\s0 and \s-1MD5\s0 are also forbidden at this level as they have less than 80 security bits.
"Level 2" 4
Item "Level 2" Security level set to 112 bits of security. As a result \s-1RSA, DSA\s0 and \s-1DH\s0 keys shorter than 2048 bits and \s-1ECC\s0 keys shorter than 224 bits are prohibited. In addition to the level 1 exclusions any cipher suite using \s-1RC4\s0 is also prohibited. \s-1SSL\s0 version 3 is also not allowed. Compression is disabled.
"Level 3" 4
Item "Level 3" Security level set to 128 bits of security. As a result \s-1RSA, DSA\s0 and \s-1DH\s0 keys shorter than 3072 bits and \s-1ECC\s0 keys shorter than 256 bits are prohibited. In addition to the level 2 exclusions cipher suites not offering forward secrecy are prohibited. \s-1TLS\s0 versions below 1.1 are not permitted. Session tickets are disabled.
"Level 4" 4
Item "Level 4" Security level set to 192 bits of security. As a result \s-1RSA, DSA\s0 and \s-1DH\s0 keys shorter than 7680 bits and \s-1ECC\s0 keys shorter than 384 bits are prohibited. Cipher suites using \s-1SHA1\s0 for the \s-1MAC\s0 are prohibited. \s-1TLS\s0 versions below 1.2 are not permitted.
"Level 5" 4
Item "Level 5" Security level set to 256 bits of security. As a result \s-1RSA, DSA\s0 and \s-1DH\s0 keys shorter than 15360 bits and \s-1ECC\s0 keys shorter than 512 bits are prohibited.
"APPLICATION DEFINED SECURITY CALLBACKS"
Header "APPLICATION DEFINED SECURITY CALLBACKS" \fIDocumentation to be provided.
"NOTES"
Header "NOTES" The default security level can be configured when OpenSSL is compiled by setting -DOPENSSL_TLS_SECURITY_LEVEL=level. If not set then 1 is used.

The security framework disables or reject parameters inconsistent with the set security level. In the past this was difficult as applications had to set a number of distinct parameters (supported ciphers, supported curves supported signature algorithms) to achieve this end and some cases (\s-1DH\s0 parameter size for example) could not be checked at all.

By setting an appropriate security level much of this complexity can be avoided.

The bits of security limits affect all relevant parameters including cipher suite encryption algorithms, supported \s-1ECC\s0 curves, supported signature algorithms, \s-1DH\s0 parameter sizes, certificate key sizes and signature algorithms. This limit applies no matter what other custom settings an application has set: so if the cipher suite is set to \s-1ALL\s0 then only cipher suites consistent with the security level are permissible.

See \s-1SP800-57\s0 for how the security limits are related to individual algorithms.

Some security levels require large key sizes for non-ECC public key algorithms which can severely degrade performance. For example 256 bits of security requires the use of \s-1RSA\s0 keys of at least 15360 bits in size.

Some restrictions can be gracefully handled: for example cipher suites offering insufficient security are not sent by the client and will not be selected by the server. Other restrictions such as the peer certificate key size or the \s-1DH\s0 parameter size will abort the handshake with a fatal alert.

Attempts to set certificates or parameters with insufficient security are also blocked. For example trying to set a certificate using a 512 bit \s-1RSA\s0 key or a certificate with a signature with \s-1SHA1\s0 digest at level 1 using \fBSSL_CTX_use_certificate(). Applications which do not check the return values for errors will misbehave: for example it might appear that a certificate is not set at all because it had been rejected.

"RETURN VALUES"
Header "RETURN VALUES" \fBSSL_CTX_set_security_level() and SSL_set_security_level() do not return values.

\fBSSL_CTX_get_security_level() and SSL_get_security_level() return a integer that represents the security level with \s-1SSL_CTX\s0 or \s-1SSL\s0, respectively.

\fBSSL_CTX_set_security_callback() and SSL_set_security_callback() do not return values.

\fBSSL_CTX_get_security_callback() and SSL_get_security_callback() return the pointer to the security callback or \s-1NULL\s0 if the callback is not set.

\fBSSL_CTX_get0_security_ex_data() and SSL_get0_security_ex_data() return the extra data pointer or \s-1NULL\s0 if the ex data is not set.

"SEE ALSO"
Header "SEE ALSO" \fBssl\|(7)
"HISTORY"
Header "HISTORY" These functions were added in OpenSSL 1.1.0.
"COPYRIGHT"
Header "COPYRIGHT" Copyright 2014-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use this file except in compliance with the License. You can obtain a copy in the file \s-1LICENSE\s0 in the source distribution or at <https://www.openssl.org/source/license.html>.