~ubuntu-branches/ubuntu/trusty/curl/trusty-security

« back to all changes in this revision

Viewing changes to lib/vtls/vtls.h

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2014-01-31 08:42:28 UTC
  • mfrom: (3.4.45 sid)
  • Revision ID: package-import@ubuntu.com-20140131084228-rnste9wj6fqiy9zl
Tags: 7.35.0-1ubuntu1
* Resynchronize on Debian, remaining changes:
  - Drop dependencies not in main:
    + Build-Depends: Drop stunnel4 and libssh2-1-dev.
    + Drop libssh2-1-dev from binary package Depends.
  - Add new libcurl3-udeb package.
  - Add new curl-udeb package.

Show diffs side-by-side

added added

removed removed

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