Imported Upstream version 7.59.0
[platform/upstream/curl.git] / docs / libcurl / curl_global_sslset.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
9 .\" *
10 .\" * This software is licensed as described in the file COPYING, which
11 .\" * you should have received as part of this distribution. The terms
12 .\" * are also available at https://curl.haxx.se/docs/copyright.html.
13 .\" *
14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 .\" * copies of the Software, and permit persons to whom the Software is
16 .\" * furnished to do so, under the terms of the COPYING file.
17 .\" *
18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 .\" * KIND, either express or implied.
20 .\" *
21 .\" **************************************************************************
22 .TH curl_global_sslset 3 "September 21, 2017" "libcurl 7.59.0" "libcurl Manual"
23
24 .SH NAME
25 curl_global_sslset - Select SSL backend to use with libcurl
26 .SH SYNOPSIS
27 .B #include <curl/curl.h>
28 .nf
29
30 typedef struct {
31   curl_sslbackend id;
32   const char *name;
33 } curl_ssl_backend;
34
35 typedef enum {
36   CURLSSLBACKEND_NONE = 0,
37   CURLSSLBACKEND_OPENSSL = 1,
38   CURLSSLBACKEND_GNUTLS = 2,
39   CURLSSLBACKEND_NSS = 3,
40   CURLSSLBACKEND_GSKIT = 5,
41   CURLSSLBACKEND_POLARSSL = 6,
42   CURLSSLBACKEND_WOLFSSL = 7,
43   CURLSSLBACKEND_SCHANNEL = 8,
44   CURLSSLBACKEND_DARWINSSL = 9,
45   CURLSSLBACKEND_AXTLS = 10,
46   CURLSSLBACKEND_MBEDTLS = 11
47 } curl_sslbackend;
48
49 .B "CURLsslset curl_global_sslset(curl_sslbackend " id,
50 .B "                              const char *" name,
51 .B "                              curl_ssl_backend ***" avail ");"
52 .fi
53 .SH DESCRIPTION
54 This function configures at runtime which SSL backend to use with
55 libcurl. This function can only be used to select an SSL backend once, and it
56 must be called \fBbefore\fP \fIcurl_global_init(3)\fP.
57
58 The backend can be identified by the \fIid\fP
59 (e.g. \fBCURLSSLBACKEND_OPENSSL\fP). The backend can also be specified via the
60 \fIname\fP parameter for a case insensitive match (passing -1 as \fIid\fP). If
61 both \fIid\fP and \fIname\fP are specified, the \fIname\fP will be ignored.
62
63 If neither \fIid\fP nor \fPname\fP are specified, the function will fail with
64 CURLSSLSET_UNKNOWN_BACKEND and set the \fIavail\fP pointer to the
65 NULL-terminated list of available backends. The available backends are those
66 that this particular build of libcurl supports.
67
68 Upon success, the function returns CURLSSLSET_OK.
69
70 If the specified SSL backend is not available, the function returns
71 CURLSSLSET_UNKNOWN_BACKEND and sets the \fIavail\fP pointer to a
72 NULL-terminated list of available SSL backends. In this case, you may call the
73 function again to try to select a different backend.
74
75 The SSL backend can be set only once. If it has already been set, a subsequent
76 attempt to change it will result in a \fBCURLSSLSET_TOO_LATE\fP.
77
78 \fBThis function is not thread safe.\fP You must not call it when any other
79 thread in the program (i.e. a thread sharing the same memory) is running.
80 This doesn't just mean no other thread that is using libcurl.
81
82 .SH AVAILABILITY
83 This function was added in libcurl 7.56.0. Before this version, there was no
84 support for choosing SSL backends at runtime.
85 .SH RETURN VALUE
86 If this function returns CURLSSLSET_OK, the backend was successfully selected.
87
88 If the chosen backend is unknown (or support for the chosed backend has not
89 been compiled into libcurl), the function returns \fICURLSSLSET_UNKNOWN_BACKEND\fP.
90
91 If the backend had been configured previously, or if \fIcurl_global_init(3)\fP
92 has already been called, the function returns \fICURLSSLSET_TOO_LATE\fP.
93
94 If this libcurl was built completely without SSL support, with no backends at
95 all, this function returns \fICURLSSLSET_NO_BACKENDS\fP.
96 .SH "SEE ALSO"
97 .BR curl_global_init "(3), "
98 .BR libcurl "(3) "