sslgen.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #ifndef HEADER_CURL_SSLGEN_H
  2. #define HEADER_CURL_SSLGEN_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2012, 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 http://curl.haxx.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. ***************************************************************************/
  24. #include "curl_setup.h"
  25. #ifndef MD5_DIGEST_LENGTH
  26. #define MD5_DIGEST_LENGTH 16 /* fixed size */
  27. #endif
  28. bool Curl_ssl_config_matches(struct ssl_config_data* data,
  29. struct ssl_config_data* needle);
  30. bool Curl_clone_ssl_config(struct ssl_config_data* source,
  31. struct ssl_config_data* dest);
  32. void Curl_free_ssl_config(struct ssl_config_data* sslc);
  33. unsigned int Curl_rand(struct SessionHandle *);
  34. #ifdef USE_SSL
  35. int Curl_ssl_init(void);
  36. void Curl_ssl_cleanup(void);
  37. CURLcode Curl_ssl_connect(struct connectdata *conn, int sockindex);
  38. CURLcode Curl_ssl_connect_nonblocking(struct connectdata *conn,
  39. int sockindex,
  40. bool *done);
  41. /* tell the SSL stuff to close down all open information regarding
  42. connections (and thus session ID caching etc) */
  43. void Curl_ssl_close_all(struct SessionHandle *data);
  44. void Curl_ssl_close(struct connectdata *conn, int sockindex);
  45. CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex);
  46. CURLcode Curl_ssl_set_engine(struct SessionHandle *data, const char *engine);
  47. /* Sets engine as default for all SSL operations */
  48. CURLcode Curl_ssl_set_engine_default(struct SessionHandle *data);
  49. struct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data);
  50. /* init the SSL session ID cache */
  51. CURLcode Curl_ssl_initsessions(struct SessionHandle *, size_t);
  52. size_t Curl_ssl_version(char *buffer, size_t size);
  53. bool Curl_ssl_data_pending(const struct connectdata *conn,
  54. int connindex);
  55. int Curl_ssl_check_cxn(struct connectdata *conn);
  56. /* Certificate information list handling. */
  57. void Curl_ssl_free_certinfo(struct SessionHandle *data);
  58. int Curl_ssl_init_certinfo(struct SessionHandle * data, int num);
  59. CURLcode Curl_ssl_push_certinfo_len(struct SessionHandle * data, int certnum,
  60. const char * label, const char * value,
  61. size_t valuelen);
  62. CURLcode Curl_ssl_push_certinfo(struct SessionHandle * data, int certnum,
  63. const char * label, const char * value);
  64. /* Functions to be used by SSL library adaptation functions */
  65. /* extract a session ID */
  66. int Curl_ssl_getsessionid(struct connectdata *conn,
  67. void **ssl_sessionid,
  68. size_t *idsize) /* set 0 if unknown */;
  69. /* add a new session ID */
  70. CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
  71. void *ssl_sessionid,
  72. size_t idsize);
  73. /* Kill a single session ID entry in the cache */
  74. void Curl_ssl_kill_session(struct curl_ssl_session *session);
  75. /* delete a session from the cache */
  76. void Curl_ssl_delsessionid(struct connectdata *conn, void *ssl_sessionid);
  77. /* get N random bytes into the buffer */
  78. void Curl_ssl_random(struct SessionHandle *data, unsigned char *buffer,
  79. size_t length);
  80. void Curl_ssl_md5sum(unsigned char *tmp, /* input */
  81. size_t tmplen,
  82. unsigned char *md5sum, /* output */
  83. size_t md5len);
  84. #define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */
  85. #ifdef have_curlssl_random
  86. #define HAVE_CURL_SSL_RANDOM
  87. #endif
  88. #ifdef have_curlssl_md5sum
  89. #define HAVE_CURL_SSL_MD5SUM
  90. #endif
  91. #else
  92. /* When SSL support is not present, just define away these function calls */
  93. #define Curl_ssl_init() 1
  94. #define Curl_ssl_cleanup() Curl_nop_stmt
  95. #define Curl_ssl_connect(x,y) CURLE_NOT_BUILT_IN
  96. #define Curl_ssl_close_all(x) Curl_nop_stmt
  97. #define Curl_ssl_close(x,y) Curl_nop_stmt
  98. #define Curl_ssl_shutdown(x,y) CURLE_NOT_BUILT_IN
  99. #define Curl_ssl_set_engine(x,y) CURLE_NOT_BUILT_IN
  100. #define Curl_ssl_set_engine_default(x) CURLE_NOT_BUILT_IN
  101. #define Curl_ssl_engines_list(x) NULL
  102. #define Curl_ssl_send(a,b,c,d,e) -1
  103. #define Curl_ssl_recv(a,b,c,d,e) -1
  104. #define Curl_ssl_initsessions(x,y) CURLE_OK
  105. #define Curl_ssl_version(x,y) 0
  106. #define Curl_ssl_data_pending(x,y) 0
  107. #define Curl_ssl_check_cxn(x) 0
  108. #define Curl_ssl_free_certinfo(x) Curl_nop_stmt
  109. #define Curl_ssl_connect_nonblocking(x,y,z) CURLE_NOT_BUILT_IN
  110. #define Curl_ssl_kill_session(x) Curl_nop_stmt
  111. #endif
  112. #endif /* HEADER_CURL_SSLGEN_H */