1 #ifndef HEADER_CURL_VTLS_H
2 #define HEADER_CURL_VTLS_H
3 /***************************************************************************
5 * Project ___| | | | _ \| |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
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.
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.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 ***************************************************************************/
24 #include "curl_setup.h"
26 #ifndef MD5_DIGEST_LENGTH
27 #define MD5_DIGEST_LENGTH 16 /* fixed size */
30 /* see http://tools.ietf.org/html/draft-ietf-tls-applayerprotoneg-04 */
31 #define ALPN_HTTP_1_1_LENGTH 8
32 #define ALPN_HTTP_1_1 "http/1.1"
34 bool Curl_ssl_config_matches(struct ssl_config_data* data,
35 struct ssl_config_data* needle);
36 bool Curl_clone_ssl_config(struct ssl_config_data* source,
37 struct ssl_config_data* dest);
38 void Curl_free_ssl_config(struct ssl_config_data* sslc);
40 unsigned int Curl_rand(struct SessionHandle *);
43 int Curl_ssl_init(void);
44 void Curl_ssl_cleanup(void);
45 CURLcode Curl_ssl_connect(struct connectdata *conn, int sockindex);
46 CURLcode Curl_ssl_connect_nonblocking(struct connectdata *conn,
49 /* tell the SSL stuff to close down all open information regarding
50 connections (and thus session ID caching etc) */
51 void Curl_ssl_close_all(struct SessionHandle *data);
52 void Curl_ssl_close(struct connectdata *conn, int sockindex);
53 CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex);
54 CURLcode Curl_ssl_set_engine(struct SessionHandle *data, const char *engine);
55 /* Sets engine as default for all SSL operations */
56 CURLcode Curl_ssl_set_engine_default(struct SessionHandle *data);
57 struct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data);
59 /* init the SSL session ID cache */
60 CURLcode Curl_ssl_initsessions(struct SessionHandle *, size_t);
61 size_t Curl_ssl_version(char *buffer, size_t size);
62 bool Curl_ssl_data_pending(const struct connectdata *conn,
64 int Curl_ssl_check_cxn(struct connectdata *conn);
66 /* Certificate information list handling. */
68 void Curl_ssl_free_certinfo(struct SessionHandle *data);
69 int Curl_ssl_init_certinfo(struct SessionHandle * data, int num);
70 CURLcode Curl_ssl_push_certinfo_len(struct SessionHandle * data, int certnum,
71 const char * label, const char * value,
73 CURLcode Curl_ssl_push_certinfo(struct SessionHandle * data, int certnum,
74 const char * label, const char * value);
76 /* Functions to be used by SSL library adaptation functions */
78 /* extract a session ID */
79 int Curl_ssl_getsessionid(struct connectdata *conn,
81 size_t *idsize) /* set 0 if unknown */;
82 /* add a new session ID */
83 CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
86 /* Kill a single session ID entry in the cache */
87 void Curl_ssl_kill_session(struct curl_ssl_session *session);
88 /* delete a session from the cache */
89 void Curl_ssl_delsessionid(struct connectdata *conn, void *ssl_sessionid);
91 /* get N random bytes into the buffer */
92 void Curl_ssl_md5sum(unsigned char *tmp, /* input */
94 unsigned char *md5sum, /* output */
97 #define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */
99 #ifdef have_curlssl_random
100 #define HAVE_CURL_SSL_RANDOM
102 #ifdef have_curlssl_md5sum
103 #define HAVE_CURL_SSL_MD5SUM
107 /* When SSL support is not present, just define away these function calls */
108 #define Curl_ssl_init() 1
109 #define Curl_ssl_cleanup() Curl_nop_stmt
110 #define Curl_ssl_connect(x,y) CURLE_NOT_BUILT_IN
111 #define Curl_ssl_close_all(x) Curl_nop_stmt
112 #define Curl_ssl_close(x,y) Curl_nop_stmt
113 #define Curl_ssl_shutdown(x,y) CURLE_NOT_BUILT_IN
114 #define Curl_ssl_set_engine(x,y) CURLE_NOT_BUILT_IN
115 #define Curl_ssl_set_engine_default(x) CURLE_NOT_BUILT_IN
116 #define Curl_ssl_engines_list(x) NULL
117 #define Curl_ssl_send(a,b,c,d,e) -1
118 #define Curl_ssl_recv(a,b,c,d,e) -1
119 #define Curl_ssl_initsessions(x,y) CURLE_OK
120 #define Curl_ssl_version(x,y) 0
121 #define Curl_ssl_data_pending(x,y) 0
122 #define Curl_ssl_check_cxn(x) 0
123 #define Curl_ssl_free_certinfo(x) Curl_nop_stmt
124 #define Curl_ssl_connect_nonblocking(x,y,z) CURLE_NOT_BUILT_IN
125 #define Curl_ssl_kill_session(x) Curl_nop_stmt
128 #endif /* HEADER_CURL_VTLS_H */