1 1.1 christos =pod 2 1.1 christos 3 1.1 christos =head1 NAME 4 1.1 christos 5 1.1 christos SSL_CTX_config, SSL_config - configure SSL_CTX or SSL structure 6 1.1 christos 7 1.1 christos =head1 SYNOPSIS 8 1.1 christos 9 1.1 christos #include <openssl/ssl.h> 10 1.1 christos 11 1.1 christos int SSL_CTX_config(SSL_CTX *ctx, const char *name); 12 1.1 christos int SSL_config(SSL *s, const char *name); 13 1.1 christos 14 1.1 christos =head1 DESCRIPTION 15 1.1 christos 16 1.1 christos The functions SSL_CTX_config() and SSL_config() configure an B<SSL_CTX> or 17 1.1 christos B<SSL> structure using the configuration B<name>. 18 1.1 christos 19 1.1 christos By calling SSL_CTX_config() or SSL_config() an application can perform many 20 1.1 christos complex tasks based on the contents of the configuration file: greatly 21 1.1 christos simplifying application configuration code. A degree of future proofing 22 1.1 christos can also be achieved: an application can support configuration features 23 1.1 christos in newer versions of OpenSSL automatically. 24 1.1 christos 25 1.1 christos A configuration file must have been previously loaded, for example using 26 1.1 christos CONF_modules_load_file(). See L<config(5)> for details of the configuration 27 1.1 christos file syntax. 28 1.1 christos 29 1.1 christos =head1 RETURN VALUES 30 1.1 christos 31 1.1 christos SSL_CTX_config() and SSL_config() return 1 for success or 0 if an error 32 1.1 christos occurred. 33 1.1 christos 34 1.1.1.3 christos =head1 EXAMPLES 35 1.1 christos 36 1.1 christos If the file "config.cnf" contains the following: 37 1.1 christos 38 1.1 christos testapp = test_sect 39 1.1 christos 40 1.1 christos [test_sect] 41 1.1 christos # list of configuration modules 42 1.1 christos 43 1.1 christos ssl_conf = ssl_sect 44 1.1 christos 45 1.1 christos [ssl_sect] 46 1.1 christos server = server_section 47 1.1 christos 48 1.1 christos [server_section] 49 1.1 christos RSA.Certificate = server-rsa.pem 50 1.1 christos ECDSA.Certificate = server-ecdsa.pem 51 1.1 christos Ciphers = ALL:!RC4 52 1.1 christos 53 1.1 christos An application could call: 54 1.1 christos 55 1.1 christos if (CONF_modules_load_file("config.cnf", "testapp", 0) <= 0) { 56 1.1 christos fprintf(stderr, "Error processing config file\n"); 57 1.1 christos goto err; 58 1.1 christos } 59 1.1 christos 60 1.1 christos ctx = SSL_CTX_new(TLS_server_method()); 61 1.1 christos 62 1.1 christos if (SSL_CTX_config(ctx, "server") == 0) { 63 1.1 christos fprintf(stderr, "Error configuring server.\n"); 64 1.1 christos goto err; 65 1.1 christos } 66 1.1 christos 67 1.1 christos In this example two certificates and the cipher list are configured without 68 1.1 christos the need for any additional application code. 69 1.1 christos 70 1.1 christos =head1 SEE ALSO 71 1.1 christos 72 1.1.1.4 christos L<ssl(7)>, 73 1.1 christos L<config(5)>, 74 1.1 christos L<SSL_CONF_cmd(3)>, 75 1.1 christos L<CONF_modules_load_file(3)> 76 1.1 christos 77 1.1 christos =head1 HISTORY 78 1.1 christos 79 1.1.1.2 christos The SSL_CTX_config() and SSL_config() functions were added in OpenSSL 1.1.0. 80 1.1 christos 81 1.1 christos =head1 COPYRIGHT 82 1.1 christos 83 1.1.1.4 christos Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved. 84 1.1 christos 85 1.1.1.4 christos Licensed under the Apache License 2.0 (the "License"). You may not use 86 1.1 christos this file except in compliance with the License. You can obtain a copy 87 1.1 christos in the file LICENSE in the source distribution or at 88 1.1 christos L<https://www.openssl.org/source/license.html>. 89 1.1 christos 90 1.1 christos =cut 91