1curl_global_sslset(3) libcurl Manual curl_global_sslset(3)
2
3
4
6 curl_global_sslset - Select SSL backend to use with libcurl
7
9 #include <curl/curl.h>
10
11 typedef struct {
12 curl_sslbackend id;
13 const char *name;
14 } curl_ssl_backend;
15
16 typedef enum {
17 CURLSSLBACKEND_NONE = 0,
18 CURLSSLBACKEND_OPENSSL = 1,
19 CURLSSLBACKEND_GNUTLS = 2,
20 CURLSSLBACKEND_NSS = 3,
21 CURLSSLBACKEND_GSKIT = 5,
22 CURLSSLBACKEND_POLARSSL = 6, /* deprecated */
23 CURLSSLBACKEND_WOLFSSL = 7,
24 CURLSSLBACKEND_SCHANNEL = 8,
25 CURLSSLBACKEND_SECURETRANSPORT = 9,
26 CURLSSLBACKEND_AXTLS = 10, /* deprecated */
27 CURLSSLBACKEND_MBEDTLS = 11,
28 CURLSSLBACKEND_MESALINK = 12,
29 CURLSSLBACKEND_BEARSSL = 13
30 } curl_sslbackend;
31
32 CURLsslset curl_global_sslset(curl_sslbackend id,
33 const char *name,
34 curl_ssl_backend ***avail);
35
37 This function configures at runtime which SSL backend to use with
38 libcurl. This function can only be used to select an SSL backend once,
39 and it must be called before [22mcurl_global_init(3).
40
41 The backend can be identified by the id (e.g. CURLSSLBACKEND_OPENSSL).
42 The backend can also be specified via the name parameter for a case in‐
43 sensitive match (passing -1 as id). If both id and name are specified,
44 the name will be ignored.
45
46 If neither id nor name are specified, the function will fail with
47 CURLSSLSET_UNKNOWN_BACKEND and set the avail pointer to the NULL-termi‐
48 nated list of available backends. The available backends are those that
49 this particular build of libcurl supports.
50
51 Since libcurl 7.60.0, the avail pointer will always be set to the list
52 of alternatives if non-NULL.
53
54 Upon success, the function returns CURLSSLSET_OK.
55
56 If the specified SSL backend is not available, the function returns
57 CURLSSLSET_UNKNOWN_BACKEND and sets the avail pointer to a NULL-termi‐
58 nated list of available SSL backends. In this case, you may call the
59 function again to try to select a different backend.
60
61 The SSL backend can be set only once. If it has already been set, a
62 subsequent attempt to change it will result in a CURLSSLSET_TOO_LATE.
63
64 This function is thread-safe since libcurl 7.84.0 if curl_ver‐
65 sion_info(3) has the CURL_VERSION_THREADSAFE feature bit set (most
66 platforms).
67
68 If this is not thread-safe, you must not call this function when any
69 other thread in the program (i.e. a thread sharing the same memory) is
70 running. This does not just mean no other thread that is using
71 libcurl.
72
74 /* choose a specific backend */
75 curl_global_sslset(CURLSSLBACKEND_WOLFSSL, NULL, NULL);
76
77 /* list the available ones */
78 const curl_ssl_backend **list;
79 curl_global_sslset((curl_sslbackend)-1, NULL, &list);
80
81 for(i = 0; list[i]; i++)
82 printf("SSL backend #%d: '%s' (ID: %d)\n",
83 i, list[i]->name, list[i]->id);
84
86 This function was added in libcurl 7.56.0. Before this version, there
87 was no support for choosing SSL backends at runtime.
88
90 If this function returns CURLSSLSET_OK, the backend was successfully
91 selected.
92
93 If the chosen backend is unknown (or support for the chosen backend has
94 not been compiled into libcurl), the function returns CURLSSLSET_UN‐
95 KNOWN_BACKEND.
96
97 If the backend had been configured previously, or if
98 curl_global_init(3) has already been called, the function returns
99 CURLSSLSET_TOO_LATE.
100
101 If this libcurl was built completely without SSL support, with no back‐
102 ends at all, this function returns CURLSSLSET_NO_BACKENDS.
103
105 curl_global_init(3), libcurl(3)
106
107
108
109libcurl 7.85.0 June 15, 2022 curl_global_sslset(3)