source: UsbWattMeter/trunk/curl-7.47.1/lib/vtls/vtls.h@ 164

Last change on this file since 164 was 164, checked in by coas-nagasima, 6 years ago

TOPPERS/ECNLサンプルアプリ「USB充電器電力計」を追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 6.5 KB
Line 
1#ifndef HEADER_CURL_VTLS_H
2#define HEADER_CURL_VTLS_H
3/***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
10 * Copyright (C) 1998 - 2015, 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.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#include "openssl.h" /* OpenSSL versions */
27#include "gtls.h" /* GnuTLS versions */
28#include "nssg.h" /* NSS versions */
29#include "gskit.h" /* Global Secure ToolKit versions */
30#include "polarssl.h" /* PolarSSL versions */
31#include "axtls.h" /* axTLS versions */
32#include "cyassl.h" /* CyaSSL versions */
33#include "schannel.h" /* Schannel SSPI version */
34#include "darwinssl.h" /* SecureTransport (Darwin) version */
35#include "mbedtls.h" /* mbedTLS versions */
36
37#ifndef MAX_PINNED_PUBKEY_SIZE
38#define MAX_PINNED_PUBKEY_SIZE 1048576 /* 1MB */
39#endif
40
41#ifndef MD5_DIGEST_LENGTH
42#define MD5_DIGEST_LENGTH 16 /* fixed size */
43#endif
44
45#ifndef SHA256_DIGEST_LENGTH
46#define SHA256_DIGEST_LENGTH 32 /* fixed size */
47#endif
48
49/* see https://tools.ietf.org/html/draft-ietf-tls-applayerprotoneg-04 */
50#define ALPN_HTTP_1_1_LENGTH 8
51#define ALPN_HTTP_1_1 "http/1.1"
52
53bool Curl_ssl_config_matches(struct ssl_config_data* data,
54 struct ssl_config_data* needle);
55bool Curl_clone_ssl_config(struct ssl_config_data* source,
56 struct ssl_config_data* dest);
57void Curl_free_ssl_config(struct ssl_config_data* sslc);
58
59unsigned int Curl_rand(struct SessionHandle *);
60
61int Curl_ssl_backend(void);
62
63#ifdef USE_SSL
64int Curl_ssl_init(void);
65void Curl_ssl_cleanup(void);
66CURLcode Curl_ssl_connect(struct connectdata *conn, int sockindex);
67CURLcode Curl_ssl_connect_nonblocking(struct connectdata *conn,
68 int sockindex,
69 bool *done);
70/* tell the SSL stuff to close down all open information regarding
71 connections (and thus session ID caching etc) */
72void Curl_ssl_close_all(struct SessionHandle *data);
73void Curl_ssl_close(struct connectdata *conn, int sockindex);
74CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex);
75CURLcode Curl_ssl_set_engine(struct SessionHandle *data, const char *engine);
76/* Sets engine as default for all SSL operations */
77CURLcode Curl_ssl_set_engine_default(struct SessionHandle *data);
78struct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data);
79
80/* init the SSL session ID cache */
81CURLcode Curl_ssl_initsessions(struct SessionHandle *, size_t);
82size_t Curl_ssl_version(char *buffer, size_t size);
83bool Curl_ssl_data_pending(const struct connectdata *conn,
84 int connindex);
85int Curl_ssl_check_cxn(struct connectdata *conn);
86
87/* Certificate information list handling. */
88
89void Curl_ssl_free_certinfo(struct SessionHandle *data);
90CURLcode Curl_ssl_init_certinfo(struct SessionHandle * data, int num);
91CURLcode Curl_ssl_push_certinfo_len(struct SessionHandle * data, int certnum,
92 const char * label, const char * value,
93 size_t valuelen);
94CURLcode Curl_ssl_push_certinfo(struct SessionHandle * data, int certnum,
95 const char * label, const char * value);
96
97/* Functions to be used by SSL library adaptation functions */
98
99/* extract a session ID */
100bool Curl_ssl_getsessionid(struct connectdata *conn,
101 void **ssl_sessionid,
102 size_t *idsize) /* set 0 if unknown */;
103/* add a new session ID */
104CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
105 void *ssl_sessionid,
106 size_t idsize);
107/* Kill a single session ID entry in the cache */
108void Curl_ssl_kill_session(struct curl_ssl_session *session);
109/* delete a session from the cache */
110void Curl_ssl_delsessionid(struct connectdata *conn, void *ssl_sessionid);
111
112/* get N random bytes into the buffer, return 0 if a find random is filled
113 in */
114int Curl_ssl_random(struct SessionHandle *data, unsigned char *buffer,
115 size_t length);
116CURLcode Curl_ssl_md5sum(unsigned char *tmp, /* input */
117 size_t tmplen,
118 unsigned char *md5sum, /* output */
119 size_t md5len);
120/* Check pinned public key. */
121CURLcode Curl_pin_peer_pubkey(struct SessionHandle *data,
122 const char *pinnedpubkey,
123 const unsigned char *pubkey, size_t pubkeylen);
124
125bool Curl_ssl_cert_status_request(void);
126
127bool Curl_ssl_false_start(void);
128
129#define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */
130
131#else
132/* Set the API backend definition to none */
133#define CURL_SSL_BACKEND CURLSSLBACKEND_NONE
134
135/* When SSL support is not present, just define away these function calls */
136#define Curl_ssl_init() 1
137#define Curl_ssl_cleanup() Curl_nop_stmt
138#define Curl_ssl_connect(x,y) CURLE_NOT_BUILT_IN
139#define Curl_ssl_close_all(x) Curl_nop_stmt
140#define Curl_ssl_close(x,y) Curl_nop_stmt
141#define Curl_ssl_shutdown(x,y) CURLE_NOT_BUILT_IN
142#define Curl_ssl_set_engine(x,y) CURLE_NOT_BUILT_IN
143#define Curl_ssl_set_engine_default(x) CURLE_NOT_BUILT_IN
144#define Curl_ssl_engines_list(x) NULL
145#define Curl_ssl_send(a,b,c,d,e) -1
146#define Curl_ssl_recv(a,b,c,d,e) -1
147#define Curl_ssl_initsessions(x,y) CURLE_OK
148#define Curl_ssl_version(x,y) 0
149#define Curl_ssl_data_pending(x,y) 0
150#define Curl_ssl_check_cxn(x) 0
151#define Curl_ssl_free_certinfo(x) Curl_nop_stmt
152#define Curl_ssl_connect_nonblocking(x,y,z) CURLE_NOT_BUILT_IN
153#define Curl_ssl_kill_session(x) Curl_nop_stmt
154#define Curl_ssl_random(x,y,z) ((void)x, CURLE_NOT_BUILT_IN)
155#define Curl_ssl_cert_status_request() FALSE
156#define Curl_ssl_false_start() FALSE
157#endif
158
159#endif /* HEADER_CURL_VTLS_H */
Note: See TracBrowser for help on using the repository browser.