curl_global_sslset.3 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2020, 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 "15 July 2017" "libcurl 7.56" "libcurl Manual"
  23. .SH NAME
  24. curl_global_sslset - Select SSL backend to use with libcurl
  25. .SH SYNOPSIS
  26. .B #include <curl/curl.h>
  27. .nf
  28. typedef struct {
  29. curl_sslbackend id;
  30. const char *name;
  31. } curl_ssl_backend;
  32. typedef enum {
  33. CURLSSLBACKEND_NONE = 0,
  34. CURLSSLBACKEND_OPENSSL = 1,
  35. CURLSSLBACKEND_GNUTLS = 2,
  36. CURLSSLBACKEND_NSS = 3,
  37. CURLSSLBACKEND_GSKIT = 5,
  38. CURLSSLBACKEND_POLARSSL = 6, /* deprecated */
  39. CURLSSLBACKEND_WOLFSSL = 7,
  40. CURLSSLBACKEND_SCHANNEL = 8,
  41. CURLSSLBACKEND_SECURETRANSPORT = 9,
  42. CURLSSLBACKEND_AXTLS = 10, /* deprecated */
  43. CURLSSLBACKEND_MBEDTLS = 11,
  44. CURLSSLBACKEND_MESALINK = 12,
  45. CURLSSLBACKEND_BEARSSL = 13
  46. } curl_sslbackend;
  47. .B "CURLsslset curl_global_sslset(curl_sslbackend " id,
  48. .B " const char *" name,
  49. .B " curl_ssl_backend ***" avail ");"
  50. .fi
  51. .SH DESCRIPTION
  52. This function configures at runtime which SSL backend to use with
  53. libcurl. This function can only be used to select an SSL backend once, and it
  54. must be called \fBbefore\fP \fIcurl_global_init(3)\fP.
  55. The backend can be identified by the \fIid\fP
  56. (e.g. \fBCURLSSLBACKEND_OPENSSL\fP). The backend can also be specified via the
  57. \fIname\fP parameter for a case insensitive match (passing -1 as \fIid\fP). If
  58. both \fIid\fP and \fIname\fP are specified, the \fIname\fP will be ignored.
  59. If neither \fIid\fP nor \fPname\fP are specified, the function will fail with
  60. CURLSSLSET_UNKNOWN_BACKEND and set the \fIavail\fP pointer to the
  61. NULL-terminated list of available backends. The available backends are those
  62. that this particular build of libcurl supports.
  63. Since libcurl 7.60.0, the \fIavail\fP pointer will always be set to the list
  64. of alternatives if non-NULL.
  65. Upon success, the function returns CURLSSLSET_OK.
  66. If the specified SSL backend is not available, the function returns
  67. CURLSSLSET_UNKNOWN_BACKEND and sets the \fIavail\fP pointer to a
  68. NULL-terminated list of available SSL backends. In this case, you may call the
  69. function again to try to select a different backend.
  70. The SSL backend can be set only once. If it has already been set, a subsequent
  71. attempt to change it will result in a \fBCURLSSLSET_TOO_LATE\fP.
  72. \fBThis function is not thread safe.\fP You must not call it when any other
  73. thread in the program (i.e. a thread sharing the same memory) is running.
  74. This doesn't just mean no other thread that is using libcurl.
  75. .SH AVAILABILITY
  76. This function was added in libcurl 7.56.0. Before this version, there was no
  77. support for choosing SSL backends at runtime.
  78. .SH RETURN VALUE
  79. If this function returns CURLSSLSET_OK, the backend was successfully selected.
  80. If the chosen backend is unknown (or support for the chosen backend has not
  81. been compiled into libcurl), the function returns \fICURLSSLSET_UNKNOWN_BACKEND\fP.
  82. If the backend had been configured previously, or if \fIcurl_global_init(3)\fP
  83. has already been called, the function returns \fICURLSSLSET_TOO_LATE\fP.
  84. If this libcurl was built completely without SSL support, with no backends at
  85. all, this function returns \fICURLSSLSET_NO_BACKENDS\fP.
  86. .SH "SEE ALSO"
  87. .BR curl_global_init "(3), "
  88. .BR libcurl "(3) "