gtls.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef HEADER_CURL_GTLS_H
  2. #define HEADER_CURL_GTLS_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at https://curl.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. * SPDX-License-Identifier: curl
  24. *
  25. ***************************************************************************/
  26. #include "curl_setup.h"
  27. #include <curl/curl.h>
  28. #ifdef USE_GNUTLS
  29. #include <gnutls/gnutls.h>
  30. #ifdef HAVE_GNUTLS_SRP
  31. /* the function exists */
  32. #ifdef USE_TLS_SRP
  33. /* the functionality is not disabled */
  34. #define USE_GNUTLS_SRP
  35. #endif
  36. #endif
  37. struct Curl_easy;
  38. struct Curl_cfilter;
  39. struct ssl_primary_config;
  40. struct ssl_config_data;
  41. struct ssl_peer;
  42. struct gtls_ctx {
  43. gnutls_session_t session;
  44. gnutls_certificate_credentials_t cred;
  45. #ifdef USE_GNUTLS_SRP
  46. gnutls_srp_client_credentials_t srp_client_cred;
  47. #endif
  48. CURLcode io_result; /* result of last IO cfilter operation */
  49. BIT(trust_setup); /* x509 anchors + CRLs have been set up */
  50. };
  51. typedef CURLcode Curl_gtls_ctx_setup_cb(struct Curl_cfilter *cf,
  52. struct Curl_easy *data,
  53. void *user_data);
  54. CURLcode Curl_gtls_ctx_init(struct gtls_ctx *gctx,
  55. struct Curl_cfilter *cf,
  56. struct Curl_easy *data,
  57. struct ssl_peer *peer,
  58. const unsigned char *alpn, size_t alpn_len,
  59. Curl_gtls_ctx_setup_cb *cb_setup,
  60. void *cb_user_data,
  61. void *ssl_user_data);
  62. CURLcode Curl_gtls_client_trust_setup(struct Curl_cfilter *cf,
  63. struct Curl_easy *data,
  64. struct gtls_ctx *gtls);
  65. CURLcode Curl_gtls_verifyserver(struct Curl_easy *data,
  66. gnutls_session_t session,
  67. struct ssl_primary_config *config,
  68. struct ssl_config_data *ssl_config,
  69. struct ssl_peer *peer,
  70. const char *pinned_key);
  71. extern const struct Curl_ssl Curl_ssl_gnutls;
  72. #endif /* USE_GNUTLS */
  73. #endif /* HEADER_CURL_GTLS_H */