openssl.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef HEADER_CURL_SSLUSE_H
  2. #define HEADER_CURL_SSLUSE_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. #ifdef USE_OPENSSL
  28. /*
  29. * This header should only be needed to get included by vtls.c, openssl.c
  30. * and ngtcp2.c
  31. */
  32. #include <openssl/ssl.h>
  33. #include "urldata.h"
  34. #if (OPENSSL_VERSION_NUMBER < 0x30000000L)
  35. #define SSL_get1_peer_certificate SSL_get_peer_certificate
  36. #endif
  37. /*
  38. * In an effort to avoid using 'X509 *' here, we instead use the struct
  39. * x509_st version of the type so that we can forward-declare it here without
  40. * having to include <openssl/x509v3.h>. Including that header causes name
  41. * conflicts when libcurl is built with both Schannel and OpenSSL support.
  42. */
  43. struct x509_st;
  44. CURLcode Curl_ossl_verifyhost(struct Curl_easy *data, struct connectdata *conn,
  45. struct ssl_peer *peer,
  46. struct x509_st *server_cert);
  47. extern const struct Curl_ssl Curl_ssl_openssl;
  48. struct ssl_ctx_st;
  49. CURLcode Curl_ossl_set_client_cert(struct Curl_easy *data,
  50. struct ssl_ctx_st *ctx, char *cert_file,
  51. const struct curl_blob *cert_blob,
  52. const char *cert_type, char *key_file,
  53. const struct curl_blob *key_blob,
  54. const char *key_type, char *key_passwd);
  55. CURLcode Curl_ossl_certchain(struct Curl_easy *data, SSL *ssl);
  56. /**
  57. * Setup the OpenSSL X509_STORE in `ssl_ctx` for the cfilter `cf` and
  58. * easy handle `data`. Will allow reuse of a shared cache if suitable
  59. * and configured.
  60. */
  61. CURLcode Curl_ssl_setup_x509_store(struct Curl_cfilter *cf,
  62. struct Curl_easy *data,
  63. SSL_CTX *ssl_ctx);
  64. CURLcode Curl_ossl_ctx_configure(struct Curl_cfilter *cf,
  65. struct Curl_easy *data,
  66. SSL_CTX *ssl_ctx);
  67. #endif /* USE_OPENSSL */
  68. #endif /* HEADER_CURL_SSLUSE_H */