.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.48) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" 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'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "SSL_CTX_CONFIG 3ossl" .TH SSL_CTX_CONFIG 3ossl 2026-09-29 4.0.3 OpenSSL .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME SSL_CTX_config, SSL_config \- configure SSL_CTX or SSL structure .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& #include \& \& int SSL_CTX_config(SSL_CTX *ctx, const char *name); \& int SSL_config(SSL *s, const char *name); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" The functions \fBSSL_CTX_config()\fR and \fBSSL_config()\fR apply additional configuration settings to an \fBSSL_CTX\fR or \fBSSL\fR structure using the configuration \fBname\fR. The \fBname\fR must match a parameter in the configuration file\*(Aqs \fBssl\fR module section, whose value is the name of another section with SSL configuration commands. See \fBSSL_CONF_cmd\fR\|(3) for a description of the available commands. .PP By calling \fBSSL_CTX_config()\fR or \fBSSL_config()\fR an application can perform many complex tasks based on the contents of the configuration file: greatly simplifying application configuration code. Some future\-proofing can be attained this way: the specified configuration section can specify settings supported by the run\-time version of OpenSSL that were not known at the time the application code was written. .PP A configuration file must have been previously loaded, for example using \&\fBCONF_modules_load_file\fR\|(3). See \fBconfig\fR\|(5) for details of the configuration file syntax. In most applications the default \fBopenssl.cnf\fR file is loaded automatically as part of library initialisation. .SH "RETURN VALUES" .IX Header "RETURN VALUES" \&\fBSSL_CTX_config()\fR and \fBSSL_config()\fR return 1 for success or 0 if an error occurred. .SH EXAMPLES .IX Header "EXAMPLES" If, for example, the loaded configuration file contains the following: .PP .Vb 3 \& # Top level "default" section, if no application name was specified as part \& # initialisation, it defaults to "openssl_conf". \& openssl_conf = openssl_init \& \& [openssl_init] \& # SSL module initialisation \& ssl_conf = ssl_init \& \& [ssl_init] \& system_default = default_ssl_settings \& tweaks_for_tls12 = tls12_custom_settings \& tweaks_for_tls13 = tls13_custom_settings \& \& [default_ssl_settings] \& MinProtocol = TLSv1.2 \& # Defaults are typically the wisest choice, override only with good cause. \& MinProtocol = ... \& Ciphers = ... \& Groups = ... \& SignatureAlgorithms = ... \& \& [tls12_custom_settings] \& # Defaults are typically the wisest choice, override only with good cause. \& MaxProtocol = TLSv1.2 \& ... \& \& [tls13_custom_settings] \& # Defaults are typically the wisest choice, override only with good cause. \& MinProtocol = TLSv1.3 \& ... .Ve .PP An application that wants to only use "TLS 1.2" might call: .PP .Vb 5 \& /* Initialised per "system_default" settings */ \& if ((ctx = SSL_CTX_new(TLS_server_method())) == NULL) { \& fprintf(stderr, "Error creating the SSL context.\en"); \& goto err; \& } \& \& /* \& * Further tweaks per the "ssl" module "tweaks_for_tls12" setting, i.e. the \& * configuration file\*(Aqs "tls12_custom_settings" section. \& */ \& if (SSL_CTX_config(ctx, "tweaks_for_tls12") == 0) { \& fprintf(stderr, "Error applying \*(Aqtweaks_for_tls12\*(Aq context configuration.\en"); \& goto err; \& } .Ve .PP The setting of the protocol version ceiling and any other settings relevant to TLS 1.2 are in the configuration file, and don\*(Aqt need to be hard\-coded in the application. Similarly, using \f(CW\*(C`tweaks_for_tls13\*(C'\fR as the configuration \fBname\fR applies the corresponding settings from the "tls13_custom_settings" section (per the SSL module \f(CW\*(C`tweaks_for_tls13\*(C'\fR parameter). .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBssl\fR\|(7), \&\fBconfig\fR\|(5), \&\fBSSL_CONF_cmd\fR\|(3), \&\fBSSL_CTX_new\fR\|(3), \&\fBCONF_modules_load_file\fR\|(3), \&\fBOPENSSL_init_ssl\fR\|(3) .SH HISTORY .IX Header "HISTORY" The \fBSSL_CTX_config()\fR and \fBSSL_config()\fR functions were added in OpenSSL 1.1.0. .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright 2015\-2020 The OpenSSL Project Authors. All Rights Reserved. .PP Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at .