summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libssl/dtls1.h56
-rw-r--r--src/lib/libssl/src/ssl/dtls1.h56
-rw-r--r--src/lib/libssl/src/ssl/kssl.h41
-rw-r--r--src/lib/libssl/src/ssl/o_dir.h13
-rw-r--r--src/lib/libssl/src/ssl/srtp.h2
-rw-r--r--src/lib/libssl/src/ssl/ssl.h507
-rw-r--r--src/lib/libssl/src/ssl/ssl2.h31
-rw-r--r--src/lib/libssl/src/ssl/ssl23.h1
-rw-r--r--src/lib/libssl/src/ssl/ssl3.h70
-rw-r--r--src/lib/libssl/src/ssl/ssl_locl.h263
-rw-r--r--src/lib/libssl/src/ssl/tls1.h15
-rw-r--r--src/lib/libssl/srtp.h2
-rw-r--r--src/lib/libssl/ssl.h507
-rw-r--r--src/lib/libssl/ssl2.h31
-rw-r--r--src/lib/libssl/ssl23.h1
-rw-r--r--src/lib/libssl/ssl3.h70
-rw-r--r--src/lib/libssl/ssl_locl.h263
-rw-r--r--src/lib/libssl/tls1.h15
18 files changed, 945 insertions, 999 deletions
diff --git a/src/lib/libssl/dtls1.h b/src/lib/libssl/dtls1.h
index 3e0fe918a3..beb740154c 100644
--- a/src/lib/libssl/dtls1.h
+++ b/src/lib/libssl/dtls1.h
@@ -100,30 +100,27 @@ extern "C" {
100#define DTLS1_SCTP_AUTH_LABEL "EXPORTER_DTLS_OVER_SCTP" 100#define DTLS1_SCTP_AUTH_LABEL "EXPORTER_DTLS_OVER_SCTP"
101#endif 101#endif
102 102
103typedef struct dtls1_bitmap_st 103typedef struct dtls1_bitmap_st {
104 {
105 unsigned long map; /* track 32 packets on 32-bit systems 104 unsigned long map; /* track 32 packets on 32-bit systems
106 and 64 - on 64-bit systems */ 105 and 64 - on 64-bit systems */
107 unsigned char max_seq_num[8]; /* max record number seen so far, 106 unsigned char max_seq_num[8]; /* max record number seen so far,
108 64-bit value in big-endian 107 64-bit value in big-endian
109 encoding */ 108 encoding */
110 } DTLS1_BITMAP; 109} DTLS1_BITMAP;
111 110
112struct dtls1_retransmit_state 111struct dtls1_retransmit_state {
113 {
114 EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */ 112 EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */
115 EVP_MD_CTX *write_hash; /* used for mac generation */ 113 EVP_MD_CTX *write_hash; /* used for mac generation */
116#ifndef OPENSSL_NO_COMP 114#ifndef OPENSSL_NO_COMP
117 COMP_CTX *compress; /* compression */ 115 COMP_CTX *compress; /* compression */
118#else 116#else
119 char *compress; 117 char *compress;
120#endif 118#endif
121 SSL_SESSION *session; 119 SSL_SESSION *session;
122 unsigned short epoch; 120 unsigned short epoch;
123 }; 121};
124 122
125struct hm_header_st 123struct hm_header_st {
126 {
127 unsigned char type; 124 unsigned char type;
128 unsigned long msg_len; 125 unsigned long msg_len;
129 unsigned short seq; 126 unsigned short seq;
@@ -131,41 +128,36 @@ struct hm_header_st
131 unsigned long frag_len; 128 unsigned long frag_len;
132 unsigned int is_ccs; 129 unsigned int is_ccs;
133 struct dtls1_retransmit_state saved_retransmit_state; 130 struct dtls1_retransmit_state saved_retransmit_state;
134 }; 131};
135 132
136struct ccs_header_st 133struct ccs_header_st {
137 {
138 unsigned char type; 134 unsigned char type;
139 unsigned short seq; 135 unsigned short seq;
140 }; 136};
141 137
142struct dtls1_timeout_st 138struct dtls1_timeout_st {
143 {
144 /* Number of read timeouts so far */ 139 /* Number of read timeouts so far */
145 unsigned int read_timeouts; 140 unsigned int read_timeouts;
146 141
147 /* Number of write timeouts so far */ 142 /* Number of write timeouts so far */
148 unsigned int write_timeouts; 143 unsigned int write_timeouts;
149 144
150 /* Number of alerts received so far */ 145 /* Number of alerts received so far */
151 unsigned int num_alerts; 146 unsigned int num_alerts;
152 }; 147};
153 148
154typedef struct record_pqueue_st 149typedef struct record_pqueue_st {
155 {
156 unsigned short epoch; 150 unsigned short epoch;
157 pqueue q; 151 pqueue q;
158 } record_pqueue; 152} record_pqueue;
159 153
160typedef struct hm_fragment_st 154typedef struct hm_fragment_st {
161 {
162 struct hm_header_st msg_header; 155 struct hm_header_st msg_header;
163 unsigned char *fragment; 156 unsigned char *fragment;
164 unsigned char *reassembly; 157 unsigned char *reassembly;
165 } hm_fragment; 158} hm_fragment;
166 159
167typedef struct dtls1_state_st 160typedef struct dtls1_state_st {
168 {
169 unsigned int send_cookie; 161 unsigned int send_cookie;
170 unsigned char cookie[DTLS1_COOKIE_LENGTH]; 162 unsigned char cookie[DTLS1_COOKIE_LENGTH];
171 unsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH]; 163 unsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH];
@@ -244,10 +236,9 @@ typedef struct dtls1_state_st
244 int shutdown_received; 236 int shutdown_received;
245#endif 237#endif
246 238
247 } DTLS1_STATE; 239} DTLS1_STATE;
248 240
249typedef struct dtls1_record_data_st 241typedef struct dtls1_record_data_st {
250 {
251 unsigned char *packet; 242 unsigned char *packet;
252 unsigned int packet_length; 243 unsigned int packet_length;
253 SSL3_BUFFER rbuf; 244 SSL3_BUFFER rbuf;
@@ -255,7 +246,7 @@ typedef struct dtls1_record_data_st
255#ifndef OPENSSL_NO_SCTP 246#ifndef OPENSSL_NO_SCTP
256 struct bio_dgram_sctp_rcvinfo recordinfo; 247 struct bio_dgram_sctp_rcvinfo recordinfo;
257#endif 248#endif
258 } DTLS1_RECORD_DATA; 249} DTLS1_RECORD_DATA;
259 250
260#endif 251#endif
261 252
@@ -269,4 +260,3 @@ typedef struct dtls1_record_data_st
269} 260}
270#endif 261#endif
271#endif 262#endif
272
diff --git a/src/lib/libssl/src/ssl/dtls1.h b/src/lib/libssl/src/ssl/dtls1.h
index 3e0fe918a3..beb740154c 100644
--- a/src/lib/libssl/src/ssl/dtls1.h
+++ b/src/lib/libssl/src/ssl/dtls1.h
@@ -100,30 +100,27 @@ extern "C" {
100#define DTLS1_SCTP_AUTH_LABEL "EXPORTER_DTLS_OVER_SCTP" 100#define DTLS1_SCTP_AUTH_LABEL "EXPORTER_DTLS_OVER_SCTP"
101#endif 101#endif
102 102
103typedef struct dtls1_bitmap_st 103typedef struct dtls1_bitmap_st {
104 {
105 unsigned long map; /* track 32 packets on 32-bit systems 104 unsigned long map; /* track 32 packets on 32-bit systems
106 and 64 - on 64-bit systems */ 105 and 64 - on 64-bit systems */
107 unsigned char max_seq_num[8]; /* max record number seen so far, 106 unsigned char max_seq_num[8]; /* max record number seen so far,
108 64-bit value in big-endian 107 64-bit value in big-endian
109 encoding */ 108 encoding */
110 } DTLS1_BITMAP; 109} DTLS1_BITMAP;
111 110
112struct dtls1_retransmit_state 111struct dtls1_retransmit_state {
113 {
114 EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */ 112 EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */
115 EVP_MD_CTX *write_hash; /* used for mac generation */ 113 EVP_MD_CTX *write_hash; /* used for mac generation */
116#ifndef OPENSSL_NO_COMP 114#ifndef OPENSSL_NO_COMP
117 COMP_CTX *compress; /* compression */ 115 COMP_CTX *compress; /* compression */
118#else 116#else
119 char *compress; 117 char *compress;
120#endif 118#endif
121 SSL_SESSION *session; 119 SSL_SESSION *session;
122 unsigned short epoch; 120 unsigned short epoch;
123 }; 121};
124 122
125struct hm_header_st 123struct hm_header_st {
126 {
127 unsigned char type; 124 unsigned char type;
128 unsigned long msg_len; 125 unsigned long msg_len;
129 unsigned short seq; 126 unsigned short seq;
@@ -131,41 +128,36 @@ struct hm_header_st
131 unsigned long frag_len; 128 unsigned long frag_len;
132 unsigned int is_ccs; 129 unsigned int is_ccs;
133 struct dtls1_retransmit_state saved_retransmit_state; 130 struct dtls1_retransmit_state saved_retransmit_state;
134 }; 131};
135 132
136struct ccs_header_st 133struct ccs_header_st {
137 {
138 unsigned char type; 134 unsigned char type;
139 unsigned short seq; 135 unsigned short seq;
140 }; 136};
141 137
142struct dtls1_timeout_st 138struct dtls1_timeout_st {
143 {
144 /* Number of read timeouts so far */ 139 /* Number of read timeouts so far */
145 unsigned int read_timeouts; 140 unsigned int read_timeouts;
146 141
147 /* Number of write timeouts so far */ 142 /* Number of write timeouts so far */
148 unsigned int write_timeouts; 143 unsigned int write_timeouts;
149 144
150 /* Number of alerts received so far */ 145 /* Number of alerts received so far */
151 unsigned int num_alerts; 146 unsigned int num_alerts;
152 }; 147};
153 148
154typedef struct record_pqueue_st 149typedef struct record_pqueue_st {
155 {
156 unsigned short epoch; 150 unsigned short epoch;
157 pqueue q; 151 pqueue q;
158 } record_pqueue; 152} record_pqueue;
159 153
160typedef struct hm_fragment_st 154typedef struct hm_fragment_st {
161 {
162 struct hm_header_st msg_header; 155 struct hm_header_st msg_header;
163 unsigned char *fragment; 156 unsigned char *fragment;
164 unsigned char *reassembly; 157 unsigned char *reassembly;
165 } hm_fragment; 158} hm_fragment;
166 159
167typedef struct dtls1_state_st 160typedef struct dtls1_state_st {
168 {
169 unsigned int send_cookie; 161 unsigned int send_cookie;
170 unsigned char cookie[DTLS1_COOKIE_LENGTH]; 162 unsigned char cookie[DTLS1_COOKIE_LENGTH];
171 unsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH]; 163 unsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH];
@@ -244,10 +236,9 @@ typedef struct dtls1_state_st
244 int shutdown_received; 236 int shutdown_received;
245#endif 237#endif
246 238
247 } DTLS1_STATE; 239} DTLS1_STATE;
248 240
249typedef struct dtls1_record_data_st 241typedef struct dtls1_record_data_st {
250 {
251 unsigned char *packet; 242 unsigned char *packet;
252 unsigned int packet_length; 243 unsigned int packet_length;
253 SSL3_BUFFER rbuf; 244 SSL3_BUFFER rbuf;
@@ -255,7 +246,7 @@ typedef struct dtls1_record_data_st
255#ifndef OPENSSL_NO_SCTP 246#ifndef OPENSSL_NO_SCTP
256 struct bio_dgram_sctp_rcvinfo recordinfo; 247 struct bio_dgram_sctp_rcvinfo recordinfo;
257#endif 248#endif
258 } DTLS1_RECORD_DATA; 249} DTLS1_RECORD_DATA;
259 250
260#endif 251#endif
261 252
@@ -269,4 +260,3 @@ typedef struct dtls1_record_data_st
269} 260}
270#endif 261#endif
271#endif 262#endif
272
diff --git a/src/lib/libssl/src/ssl/kssl.h b/src/lib/libssl/src/ssl/kssl.h
index ca0ebac147..b61e3240c8 100644
--- a/src/lib/libssl/src/ssl/kssl.h
+++ b/src/lib/libssl/src/ssl/kssl.h
@@ -117,19 +117,18 @@ typedef unsigned char krb5_octet;
117#endif 117#endif
118 118
119#define KSSL_ERR_MAX 256 119#define KSSL_ERR_MAX 256
120typedef struct kssl_err_st { 120typedef struct kssl_err_st {
121 int reason; 121 int reason;
122 char text[KSSL_ERR_MAX]; 122 char text[KSSL_ERR_MAX];
123 } KSSL_ERR; 123} KSSL_ERR;
124 124
125 125
126/* Context for passing 126/* Context for passing
127** (1) Kerberos session key to SSL, and 127** (1) Kerberos session key to SSL, and
128** (2) Config data between application and SSL lib 128** (2) Config data between application and SSL lib
129*/ 129*/
130typedef struct kssl_ctx_st 130typedef struct kssl_ctx_st {
131 { 131 /* used by: disposition: */
132 /* used by: disposition: */
133 char *service_name; /* C,S default ok (kssl) */ 132 char *service_name; /* C,S default ok (kssl) */
134 char *service_host; /* C input, REQUIRED */ 133 char *service_host; /* C input, REQUIRED */
135 char *client_princ; /* S output from krb5 ticket */ 134 char *client_princ; /* S output from krb5 ticket */
@@ -138,7 +137,7 @@ typedef struct kssl_ctx_st
138 krb5_enctype enctype; 137 krb5_enctype enctype;
139 int length; 138 int length;
140 krb5_octet FAR *key; 139 krb5_octet FAR *key;
141 } KSSL_CTX; 140} KSSL_CTX;
142 141
143#define KSSL_CLIENT 1 142#define KSSL_CLIENT 1
144#define KSSL_SERVER 2 143#define KSSL_SERVER 2
@@ -155,25 +154,25 @@ KSSL_CTX *kssl_ctx_new(void);
155KSSL_CTX *kssl_ctx_free(KSSL_CTX *kssl_ctx); 154KSSL_CTX *kssl_ctx_free(KSSL_CTX *kssl_ctx);
156void kssl_ctx_show(KSSL_CTX *kssl_ctx); 155void kssl_ctx_show(KSSL_CTX *kssl_ctx);
157krb5_error_code kssl_ctx_setprinc(KSSL_CTX *kssl_ctx, int which, 156krb5_error_code kssl_ctx_setprinc(KSSL_CTX *kssl_ctx, int which,
158 krb5_data *realm, krb5_data *entity, int nentities); 157 krb5_data *realm, krb5_data *entity, int nentities);
159krb5_error_code kssl_cget_tkt(KSSL_CTX *kssl_ctx, krb5_data **enc_tktp, 158krb5_error_code kssl_cget_tkt(KSSL_CTX *kssl_ctx, krb5_data **enc_tktp,
160 krb5_data *authenp, KSSL_ERR *kssl_err); 159 krb5_data *authenp, KSSL_ERR *kssl_err);
161krb5_error_code kssl_sget_tkt(KSSL_CTX *kssl_ctx, krb5_data *indata, 160krb5_error_code kssl_sget_tkt(KSSL_CTX *kssl_ctx, krb5_data *indata,
162 krb5_ticket_times *ttimes, KSSL_ERR *kssl_err); 161 krb5_ticket_times *ttimes, KSSL_ERR *kssl_err);
163krb5_error_code kssl_ctx_setkey(KSSL_CTX *kssl_ctx, krb5_keyblock *session); 162krb5_error_code kssl_ctx_setkey(KSSL_CTX *kssl_ctx, krb5_keyblock *session);
164void kssl_err_set(KSSL_ERR *kssl_err, int reason, char *text); 163void kssl_err_set(KSSL_ERR *kssl_err, int reason, char *text);
165void kssl_krb5_free_data_contents(krb5_context context, krb5_data *data); 164void kssl_krb5_free_data_contents(krb5_context context, krb5_data *data);
166krb5_error_code kssl_build_principal_2(krb5_context context, 165krb5_error_code kssl_build_principal_2(krb5_context context,
167 krb5_principal *princ, int rlen, const char *realm, 166 krb5_principal *princ, int rlen, const char *realm, int slen,
168 int slen, const char *svc, int hlen, const char *host); 167 const char *svc, int hlen, const char *host);
169krb5_error_code kssl_validate_times(krb5_timestamp atime, 168krb5_error_code kssl_validate_times(krb5_timestamp atime,
170 krb5_ticket_times *ttimes); 169 krb5_ticket_times *ttimes);
171krb5_error_code kssl_check_authent(KSSL_CTX *kssl_ctx, krb5_data *authentp, 170krb5_error_code kssl_check_authent(KSSL_CTX *kssl_ctx, krb5_data *authentp,
172 krb5_timestamp *atimep, KSSL_ERR *kssl_err); 171 krb5_timestamp *atimep, KSSL_ERR *kssl_err);
173unsigned char *kssl_skip_confound(krb5_enctype enctype, unsigned char *authn); 172unsigned char *kssl_skip_confound(krb5_enctype enctype, unsigned char *authn);
174 173
175void SSL_set0_kssl_ctx(SSL *s, KSSL_CTX *kctx); 174void SSL_set0_kssl_ctx(SSL *s, KSSL_CTX *kctx);
176KSSL_CTX * SSL_get0_kssl_ctx(SSL *s); 175KSSL_CTX *SSL_get0_kssl_ctx(SSL *s);
177char *kssl_ctx_get0_client_princ(KSSL_CTX *kctx); 176char *kssl_ctx_get0_client_princ(KSSL_CTX *kctx);
178 177
179#ifdef __cplusplus 178#ifdef __cplusplus
diff --git a/src/lib/libssl/src/ssl/o_dir.h b/src/lib/libssl/src/ssl/o_dir.h
index 4b725c0312..cf4a95911a 100644
--- a/src/lib/libssl/src/ssl/o_dir.h
+++ b/src/lib/libssl/src/ssl/o_dir.h
@@ -38,13 +38,14 @@
38extern "C" { 38extern "C" {
39#endif 39#endif
40 40
41 typedef struct OPENSSL_dir_context_st OPENSSL_DIR_CTX; 41typedef struct OPENSSL_dir_context_st OPENSSL_DIR_CTX;
42 42
43 /* returns NULL on error or end-of-directory. 43/* returns NULL on error or end-of-directory.
44 If it is end-of-directory, errno will be zero */ 44 If it is end-of-directory, errno will be zero */
45 const char *OPENSSL_DIR_read(OPENSSL_DIR_CTX **ctx, const char *directory); 45const char *OPENSSL_DIR_read(OPENSSL_DIR_CTX **ctx, const char *directory);
46 /* returns 1 on success, 0 on error */ 46
47 int OPENSSL_DIR_end(OPENSSL_DIR_CTX **ctx); 47/* returns 1 on success, 0 on error */
48int OPENSSL_DIR_end(OPENSSL_DIR_CTX **ctx);
48 49
49#ifdef __cplusplus 50#ifdef __cplusplus
50} 51}
diff --git a/src/lib/libssl/src/ssl/srtp.h b/src/lib/libssl/src/ssl/srtp.h
index c0cf33ef28..06075f2c86 100644
--- a/src/lib/libssl/src/ssl/srtp.h
+++ b/src/lib/libssl/src/ssl/srtp.h
@@ -122,7 +122,6 @@
122extern "C" { 122extern "C" {
123#endif 123#endif
124 124
125
126#define SRTP_AES128_CM_SHA1_80 0x0001 125#define SRTP_AES128_CM_SHA1_80 0x0001
127#define SRTP_AES128_CM_SHA1_32 0x0002 126#define SRTP_AES128_CM_SHA1_32 0x0002
128#define SRTP_AES128_F8_SHA1_80 0x0003 127#define SRTP_AES128_F8_SHA1_80 0x0003
@@ -142,4 +141,3 @@ SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s);
142#endif 141#endif
143 142
144#endif 143#endif
145
diff --git a/src/lib/libssl/src/ssl/ssl.h b/src/lib/libssl/src/ssl/ssl.h
index bf4b2f2cb6..97e4a3f96c 100644
--- a/src/lib/libssl/src/ssl/ssl.h
+++ b/src/lib/libssl/src/ssl/ssl.h
@@ -260,9 +260,9 @@ extern "C" {
260#define SSL_TXT_aKRB5 "aKRB5" 260#define SSL_TXT_aKRB5 "aKRB5"
261#define SSL_TXT_aECDSA "aECDSA" 261#define SSL_TXT_aECDSA "aECDSA"
262#define SSL_TXT_aPSK "aPSK" 262#define SSL_TXT_aPSK "aPSK"
263#define SSL_TXT_aGOST94 "aGOST94" 263#define SSL_TXT_aGOST94 "aGOST94"
264#define SSL_TXT_aGOST01 "aGOST01" 264#define SSL_TXT_aGOST01 "aGOST01"
265#define SSL_TXT_aGOST "aGOST" 265#define SSL_TXT_aGOST "aGOST"
266 266
267#define SSL_TXT_DSS "DSS" 267#define SSL_TXT_DSS "DSS"
268#define SSL_TXT_DH "DH" 268#define SSL_TXT_DH "DH"
@@ -369,23 +369,22 @@ typedef struct ssl_session_st SSL_SESSION;
369DECLARE_STACK_OF(SSL_CIPHER) 369DECLARE_STACK_OF(SSL_CIPHER)
370 370
371/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/ 371/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/
372typedef struct srtp_protection_profile_st 372typedef struct srtp_protection_profile_st {
373 { 373 const char *name;
374 const char *name; 374 unsigned long id;
375 unsigned long id; 375} SRTP_PROTECTION_PROFILE;
376 } SRTP_PROTECTION_PROFILE;
377 376
378DECLARE_STACK_OF(SRTP_PROTECTION_PROFILE) 377DECLARE_STACK_OF(SRTP_PROTECTION_PROFILE)
379 378
380typedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *data, int len, void *arg); 379typedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *data,
381typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len, STACK_OF(SSL_CIPHER) *peer_ciphers, SSL_CIPHER **cipher, void *arg); 380 int len, void *arg);
382 381typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len,
382 STACK_OF(SSL_CIPHER) *peer_ciphers, SSL_CIPHER **cipher, void *arg);
383 383
384#ifndef OPENSSL_NO_SSL_INTERN 384#ifndef OPENSSL_NO_SSL_INTERN
385 385
386/* used to hold info on the particular ciphers used */ 386/* used to hold info on the particular ciphers used */
387struct ssl_cipher_st 387struct ssl_cipher_st {
388 {
389 int valid; 388 int valid;
390 const char *name; /* text name */ 389 const char *name; /* text name */
391 unsigned long id; /* id, 4 bytes, first is version */ 390 unsigned long id; /* id, 4 bytes, first is version */
@@ -401,34 +400,33 @@ struct ssl_cipher_st
401 unsigned long algorithm2; /* Extra flags */ 400 unsigned long algorithm2; /* Extra flags */
402 int strength_bits; /* Number of bits really used */ 401 int strength_bits; /* Number of bits really used */
403 int alg_bits; /* Number of bits for algorithm */ 402 int alg_bits; /* Number of bits for algorithm */
404 }; 403};
405 404
406 405
407/* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */ 406/* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */
408struct ssl_method_st 407struct ssl_method_st {
409 {
410 int version; 408 int version;
411 int (*ssl_new)(SSL *s); 409 int (*ssl_new)(SSL *s);
412 void (*ssl_clear)(SSL *s); 410 void (*ssl_clear)(SSL *s);
413 void (*ssl_free)(SSL *s); 411 void (*ssl_free)(SSL *s);
414 int (*ssl_accept)(SSL *s); 412 int (*ssl_accept)(SSL *s);
415 int (*ssl_connect)(SSL *s); 413 int (*ssl_connect)(SSL *s);
416 int (*ssl_read)(SSL *s,void *buf,int len); 414 int (*ssl_read)(SSL *s, void *buf, int len);
417 int (*ssl_peek)(SSL *s,void *buf,int len); 415 int (*ssl_peek)(SSL *s, void *buf, int len);
418 int (*ssl_write)(SSL *s,const void *buf,int len); 416 int (*ssl_write)(SSL *s, const void *buf, int len);
419 int (*ssl_shutdown)(SSL *s); 417 int (*ssl_shutdown)(SSL *s);
420 int (*ssl_renegotiate)(SSL *s); 418 int (*ssl_renegotiate)(SSL *s);
421 int (*ssl_renegotiate_check)(SSL *s); 419 int (*ssl_renegotiate_check)(SSL *s);
422 long (*ssl_get_message)(SSL *s, int st1, int stn, int mt, long 420 long (*ssl_get_message)(SSL *s, int st1, int stn, int mt,
423 max, int *ok); 421 long max, int *ok);
424 int (*ssl_read_bytes)(SSL *s, int type, unsigned char *buf, int len, 422 int (*ssl_read_bytes)(SSL *s, int type, unsigned char *buf,
425 int peek); 423 int len, int peek);
426 int (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len); 424 int (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len);
427 int (*ssl_dispatch_alert)(SSL *s); 425 int (*ssl_dispatch_alert)(SSL *s);
428 long (*ssl_ctrl)(SSL *s,int cmd,long larg,void *parg); 426 long (*ssl_ctrl)(SSL *s, int cmd, long larg, void *parg);
429 long (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,void *parg); 427 long (*ssl_ctx_ctrl)(SSL_CTX *ctx, int cmd, long larg, void *parg);
430 const SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr); 428 const SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr);
431 int (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr); 429 int (*put_cipher_by_char)(const SSL_CIPHER *cipher, unsigned char *ptr);
432 int (*ssl_pending)(const SSL *s); 430 int (*ssl_pending)(const SSL *s);
433 int (*num_ciphers)(void); 431 int (*num_ciphers)(void);
434 const SSL_CIPHER *(*get_cipher)(unsigned ncipher); 432 const SSL_CIPHER *(*get_cipher)(unsigned ncipher);
@@ -438,7 +436,7 @@ struct ssl_method_st
438 int (*ssl_version)(void); 436 int (*ssl_version)(void);
439 long (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)(void)); 437 long (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)(void));
440 long (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)(void)); 438 long (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)(void));
441 }; 439};
442 440
443/* Lets make this into an ASN.1 type structure as follows 441/* Lets make this into an ASN.1 type structure as follows
444 * SSL_SESSION_ID ::= SEQUENCE { 442 * SSL_SESSION_ID ::= SEQUENCE {
@@ -465,8 +463,7 @@ struct ssl_method_st
465 * Look in ssl/ssl_asn1.c for more details 463 * Look in ssl/ssl_asn1.c for more details
466 * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-). 464 * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-).
467 */ 465 */
468struct ssl_session_st 466struct ssl_session_st {
469 {
470 int ssl_version; /* what ssl version session info is 467 int ssl_version; /* what ssl version session info is
471 * being kept in here? */ 468 * being kept in here? */
472 469
@@ -485,8 +482,8 @@ struct ssl_session_st
485 unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; 482 unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
486 483
487#ifndef OPENSSL_NO_KRB5 484#ifndef OPENSSL_NO_KRB5
488 unsigned int krb5_client_princ_len; 485 unsigned int krb5_client_princ_len;
489 unsigned char krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH]; 486 unsigned char krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH];
490#endif /* OPENSSL_NO_KRB5 */ 487#endif /* OPENSSL_NO_KRB5 */
491#ifndef OPENSSL_NO_PSK 488#ifndef OPENSSL_NO_PSK
492 char *psk_identity_hint; 489 char *psk_identity_hint;
@@ -526,7 +523,7 @@ struct ssl_session_st
526 523
527 /* These are used to make removal of session-ids more 524 /* These are used to make removal of session-ids more
528 * efficient and to implement a maximum cache size. */ 525 * efficient and to implement a maximum cache size. */
529 struct ssl_session_st *prev,*next; 526 struct ssl_session_st *prev, *next;
530#ifndef OPENSSL_NO_TLSEXT 527#ifndef OPENSSL_NO_TLSEXT
531 char *tlsext_hostname; 528 char *tlsext_hostname;
532#ifndef OPENSSL_NO_EC 529#ifndef OPENSSL_NO_EC
@@ -543,7 +540,7 @@ struct ssl_session_st
543#ifndef OPENSSL_NO_SRP 540#ifndef OPENSSL_NO_SRP
544 char *srp_username; 541 char *srp_username;
545#endif 542#endif
546 }; 543};
547 544
548#endif 545#endif
549 546
@@ -684,8 +681,11 @@ struct ssl_session_st
684#define SSL_get_secure_renegotiation_support(ssl) \ 681#define SSL_get_secure_renegotiation_support(ssl) \
685 SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL) 682 SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL)
686 683
687void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); 684void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p,
688void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); 685 int version, int content_type, const void *buf, size_t len, SSL *ssl,
686 void *arg));
687void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version,
688 int content_type, const void *buf, size_t len, SSL *ssl, void *arg));
689#define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) 689#define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg))
690#define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) 690#define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg))
691 691
@@ -693,8 +693,7 @@ void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int con
693 693
694#ifndef OPENSSL_NO_SSL_INTERN 694#ifndef OPENSSL_NO_SSL_INTERN
695 695
696typedef struct srp_ctx_st 696typedef struct srp_ctx_st {
697 {
698 /* param for all the callbacks */ 697 /* param for all the callbacks */
699 void *SRP_cb_arg; 698 void *SRP_cb_arg;
700 /* set client Hello login callback */ 699 /* set client Hello login callback */
@@ -705,13 +704,13 @@ typedef struct srp_ctx_st
705 char *(*SRP_give_srp_client_pwd_callback)(SSL *, void *); 704 char *(*SRP_give_srp_client_pwd_callback)(SSL *, void *);
706 705
707 char *login; 706 char *login;
708 BIGNUM *N,*g,*s,*B,*A; 707 BIGNUM *N, *g, *s, *B, *A;
709 BIGNUM *a,*b,*v; 708 BIGNUM *a, *b, *v;
710 char *info; 709 char *info;
711 int strength; 710 int strength;
712 711
713 unsigned long srp_Mask; 712 unsigned long srp_Mask;
714 } SRP_CTX; 713} SRP_CTX;
715 714
716#endif 715#endif
717 716
@@ -721,9 +720,9 @@ int SSL_CTX_SRP_CTX_init(SSL_CTX *ctx);
721int SSL_SRP_CTX_free(SSL *ctx); 720int SSL_SRP_CTX_free(SSL *ctx);
722int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx); 721int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx);
723int SSL_srp_server_param_with_username(SSL *s, int *ad); 722int SSL_srp_server_param_with_username(SSL *s, int *ad);
724int SRP_generate_server_master_secret(SSL *s,unsigned char *master_key); 723int SRP_generate_server_master_secret(SSL *s, unsigned char *master_key);
725int SRP_Calc_A_param(SSL *s); 724int SRP_Calc_A_param(SSL *s);
726int SRP_generate_client_master_secret(SSL *s,unsigned char *master_key); 725int SRP_generate_client_master_secret(SSL *s, unsigned char *master_key);
727 726
728#endif 727#endif
729 728
@@ -745,14 +744,13 @@ int SRP_generate_client_master_secret(SSL *s,unsigned char *master_key);
745 * returns in this case. It is also an error for the callback to set the size to 744 * returns in this case. It is also an error for the callback to set the size to
746 * zero. */ 745 * zero. */
747typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id, 746typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id,
748 unsigned int *id_len); 747 unsigned int *id_len);
749 748
750typedef struct ssl_comp_st SSL_COMP; 749typedef struct ssl_comp_st SSL_COMP;
751 750
752#ifndef OPENSSL_NO_SSL_INTERN 751#ifndef OPENSSL_NO_SSL_INTERN
753 752
754struct ssl_comp_st 753struct ssl_comp_st {
755 {
756 int id; 754 int id;
757 const char *name; 755 const char *name;
758#ifndef OPENSSL_NO_COMP 756#ifndef OPENSSL_NO_COMP
@@ -760,13 +758,12 @@ struct ssl_comp_st
760#else 758#else
761 char *method; 759 char *method;
762#endif 760#endif
763 }; 761};
764 762
765DECLARE_STACK_OF(SSL_COMP) 763DECLARE_STACK_OF(SSL_COMP)
766DECLARE_LHASH_OF(SSL_SESSION); 764DECLARE_LHASH_OF(SSL_SESSION);
767 765
768struct ssl_ctx_st 766struct ssl_ctx_st {
769 {
770 const SSL_METHOD *method; 767 const SSL_METHOD *method;
771 768
772 STACK_OF(SSL_CIPHER) *cipher_list; 769 STACK_OF(SSL_CIPHER) *cipher_list;
@@ -801,13 +798,12 @@ struct ssl_ctx_st
801 * If remove_session_cb is not null, it will be called when 798 * If remove_session_cb is not null, it will be called when
802 * a session-id is removed from the cache. After the call, 799 * a session-id is removed from the cache. After the call,
803 * OpenSSL will SSL_SESSION_free() it. */ 800 * OpenSSL will SSL_SESSION_free() it. */
804 int (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess); 801 int (*new_session_cb)(struct ssl_st *ssl, SSL_SESSION *sess);
805 void (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess); 802 void (*remove_session_cb)(struct ssl_ctx_st *ctx, SSL_SESSION *sess);
806 SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, 803 SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl,
807 unsigned char *data,int len,int *copy); 804 unsigned char *data, int len, int *copy);
808 805
809 struct 806 struct {
810 {
811 int sess_connect; /* SSL new conn - started */ 807 int sess_connect; /* SSL new conn - started */
812 int sess_connect_renegotiate;/* SSL reneg - requested */ 808 int sess_connect_renegotiate;/* SSL reneg - requested */
813 int sess_connect_good; /* SSL new conne/reneg - finished */ 809 int sess_connect_good; /* SSL new conne/reneg - finished */
@@ -824,7 +820,7 @@ struct ssl_ctx_st
824 * indicates that the application is 820 * indicates that the application is
825 * supplying session-id's from other 821 * supplying session-id's from other
826 * processes - spooky :-) */ 822 * processes - spooky :-) */
827 } stats; 823 } stats;
828 824
829 int references; 825 int references;
830 826
@@ -843,19 +839,19 @@ struct ssl_ctx_st
843 /* get client cert callback */ 839 /* get client cert callback */
844 int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey); 840 int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey);
845 841
846 /* cookie generate callback */ 842 /* cookie generate callback */
847 int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie, 843 int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie,
848 unsigned int *cookie_len); 844 unsigned int *cookie_len);
849 845
850 /* verify cookie callback */ 846 /* verify cookie callback */
851 int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie, 847 int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie,
852 unsigned int cookie_len); 848 unsigned int cookie_len);
853 849
854 CRYPTO_EX_DATA ex_data; 850 CRYPTO_EX_DATA ex_data;
855 851
856 const EVP_MD *rsa_md5;/* For SSLv2 - name is 'ssl2-md5' */ 852 const EVP_MD *rsa_md5; /* For SSLv2 - name is 'ssl2-md5' */
857 const EVP_MD *md5; /* For SSLv3/TLSv1 'ssl3-md5' */ 853 const EVP_MD *md5; /* For SSLv3/TLSv1 'ssl3-md5' */
858 const EVP_MD *sha1; /* For SSLv3/TLSv1 'ssl3->sha1' */ 854 const EVP_MD *sha1; /* For SSLv3/TLSv1 'ssl3->sha1' */
859 855
860 STACK_OF(X509) *extra_certs; 856 STACK_OF(X509) *extra_certs;
861 STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */ 857 STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */
@@ -879,7 +875,8 @@ struct ssl_ctx_st
879 int read_ahead; 875 int read_ahead;
880 876
881 /* callback that allows applications to peek at protocol messages */ 877 /* callback that allows applications to peek at protocol messages */
882 void (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); 878 void (*msg_callback)(int write_p, int version, int content_type,
879 const void *buf, size_t len, SSL *ssl, void *arg);
883 void *msg_callback_arg; 880 void *msg_callback_arg;
884 881
885 int verify_mode; 882 int verify_mode;
@@ -920,10 +917,8 @@ struct ssl_ctx_st
920 unsigned char tlsext_tick_hmac_key[16]; 917 unsigned char tlsext_tick_hmac_key[16];
921 unsigned char tlsext_tick_aes_key[16]; 918 unsigned char tlsext_tick_aes_key[16];
922 /* Callback to support customisation of ticket key setting */ 919 /* Callback to support customisation of ticket key setting */
923 int (*tlsext_ticket_key_cb)(SSL *ssl, 920 int (*tlsext_ticket_key_cb)(SSL *ssl, unsigned char *name,
924 unsigned char *name, unsigned char *iv, 921 unsigned char *iv, EVP_CIPHER_CTX *ectx, HMAC_CTX *hctx, int enc);
925 EVP_CIPHER_CTX *ectx,
926 HMAC_CTX *hctx, int enc);
927 922
928 /* certificate status request info */ 923 /* certificate status request info */
929 /* Callback for status request */ 924 /* Callback for status request */
@@ -931,17 +926,18 @@ struct ssl_ctx_st
931 void *tlsext_status_arg; 926 void *tlsext_status_arg;
932 927
933 /* draft-rescorla-tls-opaque-prf-input-00.txt information */ 928 /* draft-rescorla-tls-opaque-prf-input-00.txt information */
934 int (*tlsext_opaque_prf_input_callback)(SSL *, void *peerinput, size_t len, void *arg); 929 int (*tlsext_opaque_prf_input_callback)(SSL *, void *peerinput,
930 size_t len, void *arg);
935 void *tlsext_opaque_prf_input_callback_arg; 931 void *tlsext_opaque_prf_input_callback_arg;
936#endif 932#endif
937 933
938#ifndef OPENSSL_NO_PSK 934#ifndef OPENSSL_NO_PSK
939 char *psk_identity_hint; 935 char *psk_identity_hint;
940 unsigned int (*psk_client_callback)(SSL *ssl, const char *hint, char *identity, 936 unsigned int (*psk_client_callback)(SSL *ssl, const char *hint,
941 unsigned int max_identity_len, unsigned char *psk, 937 char *identity, unsigned int max_identity_len, unsigned char *psk,
942 unsigned int max_psk_len); 938 unsigned int max_psk_len);
943 unsigned int (*psk_server_callback)(SSL *ssl, const char *identity, 939 unsigned int (*psk_server_callback)(SSL *ssl, const char *identity,
944 unsigned char *psk, unsigned int max_psk_len); 940 unsigned char *psk, unsigned int max_psk_len);
945#endif 941#endif
946 942
947#ifndef OPENSSL_NO_BUF_FREELISTS 943#ifndef OPENSSL_NO_BUF_FREELISTS
@@ -963,21 +959,20 @@ struct ssl_ctx_st
963 /* For a server, this contains a callback function by which the set of 959 /* For a server, this contains a callback function by which the set of
964 * advertised protocols can be provided. */ 960 * advertised protocols can be provided. */
965 int (*next_protos_advertised_cb)(SSL *s, const unsigned char **buf, 961 int (*next_protos_advertised_cb)(SSL *s, const unsigned char **buf,
966 unsigned int *len, void *arg); 962 unsigned int *len, void *arg);
967 void *next_protos_advertised_cb_arg; 963 void *next_protos_advertised_cb_arg;
968 /* For a client, this contains a callback function that selects the 964 /* For a client, this contains a callback function that selects the
969 * next protocol from the list provided by the server. */ 965 * next protocol from the list provided by the server. */
970 int (*next_proto_select_cb)(SSL *s, unsigned char **out, 966 int (*next_proto_select_cb)(SSL *s, unsigned char **out,
971 unsigned char *outlen, 967 unsigned char *outlen, const unsigned char *in,
972 const unsigned char *in, 968 unsigned int inlen, void *arg);
973 unsigned int inlen,
974 void *arg);
975 void *next_proto_select_cb_arg; 969 void *next_proto_select_cb_arg;
976# endif 970# endif
977 /* SRTP profiles we are willing to do from RFC 5764 */ 971 /* SRTP profiles we are willing to do from RFC 5764 */
978 STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; 972 STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles;
973
979#endif 974#endif
980 }; 975};
981 976
982#endif 977#endif
983 978
@@ -1018,42 +1013,49 @@ LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx);
1018#define SSL_CTX_sess_cache_full(ctx) \ 1013#define SSL_CTX_sess_cache_full(ctx) \
1019 SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL) 1014 SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL)
1020 1015
1021void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, int (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess)); 1016void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx,
1022int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(struct ssl_st *ssl, SSL_SESSION *sess); 1017 int (*new_session_cb)(struct ssl_st *ssl, SSL_SESSION *sess));
1023void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, void (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess)); 1018int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(struct ssl_st *ssl,
1024void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx, SSL_SESSION *sess); 1019 SSL_SESSION *sess);
1025void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, unsigned char *data,int len,int *copy)); 1020void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx,
1026SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl, unsigned char *Data, int len, int *copy); 1021 void (*remove_session_cb)(struct ssl_ctx_st *ctx, SSL_SESSION *sess));
1027void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb)(const SSL *ssl,int type,int val)); 1022void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx,
1028void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(const SSL *ssl,int type,int val); 1023 SSL_SESSION *sess);
1029void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)); 1024void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
1030int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey); 1025 SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, unsigned char *data,
1026 int len, int *copy));
1027SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl,
1028 unsigned char *Data, int len, int *copy);
1029void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb)(const SSL *ssl,
1030 int type, int val));
1031void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(const SSL *ssl, int type,
1032 int val);
1033void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx,
1034 int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey));
1035int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509,
1036 EVP_PKEY **pkey);
1031#ifndef OPENSSL_NO_ENGINE 1037#ifndef OPENSSL_NO_ENGINE
1032int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e); 1038int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e);
1033#endif 1039#endif
1034void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie, unsigned int *cookie_len)); 1040void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx,
1035void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie, unsigned int cookie_len)); 1041 int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie,
1042 unsigned int *cookie_len));
1043void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx,
1044 int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie,
1045 unsigned int cookie_len));
1036#ifndef OPENSSL_NO_NEXTPROTONEG 1046#ifndef OPENSSL_NO_NEXTPROTONEG
1037void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, 1047void
1038 int (*cb) (SSL *ssl, 1048SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, int (*cb)(SSL *ssl,
1039 const unsigned char **out, 1049 const unsigned char **out, unsigned int *outlen, void *arg), void *arg);
1040 unsigned int *outlen, 1050void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s, int (*cb)(SSL *ssl,
1041 void *arg), 1051 unsigned char **out, unsigned char *outlen, const unsigned char *in,
1042 void *arg); 1052 unsigned int inlen, void *arg), void *arg);
1043void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s,
1044 int (*cb) (SSL *ssl,
1045 unsigned char **out,
1046 unsigned char *outlen,
1047 const unsigned char *in,
1048 unsigned int inlen,
1049 void *arg),
1050 void *arg);
1051 1053
1052int SSL_select_next_proto(unsigned char **out, unsigned char *outlen, 1054int SSL_select_next_proto(unsigned char **out, unsigned char *outlen,
1053 const unsigned char *in, unsigned int inlen, 1055 const unsigned char *in, unsigned int inlen, const unsigned char *client,
1054 const unsigned char *client, unsigned int client_len); 1056 unsigned int client_len);
1055void SSL_get0_next_proto_negotiated(const SSL *s, 1057void SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data,
1056 const unsigned char **data, unsigned *len); 1058 unsigned *len);
1057 1059
1058#define OPENSSL_NPN_UNSUPPORTED 0 1060#define OPENSSL_NPN_UNSUPPORTED 0
1059#define OPENSSL_NPN_NEGOTIATED 1 1061#define OPENSSL_NPN_NEGOTIATED 1
@@ -1065,20 +1067,20 @@ void SSL_get0_next_proto_negotiated(const SSL *s,
1065 * resulting identity/psk */ 1067 * resulting identity/psk */
1066#define PSK_MAX_IDENTITY_LEN 128 1068#define PSK_MAX_IDENTITY_LEN 128
1067#define PSK_MAX_PSK_LEN 256 1069#define PSK_MAX_PSK_LEN 256
1068void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, 1070void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx,
1069 unsigned int (*psk_client_callback)(SSL *ssl, const char *hint, 1071 unsigned int (*psk_client_callback)(SSL *ssl, const char *hint,
1070 char *identity, unsigned int max_identity_len, unsigned char *psk, 1072 char *identity, unsigned int max_identity_len, unsigned char *psk,
1071 unsigned int max_psk_len)); 1073 unsigned int max_psk_len));
1072void SSL_set_psk_client_callback(SSL *ssl, 1074void SSL_set_psk_client_callback(SSL *ssl,
1073 unsigned int (*psk_client_callback)(SSL *ssl, const char *hint, 1075 unsigned int (*psk_client_callback)(SSL *ssl, const char *hint,
1074 char *identity, unsigned int max_identity_len, unsigned char *psk, 1076 char *identity, unsigned int max_identity_len, unsigned char *psk,
1075 unsigned int max_psk_len)); 1077 unsigned int max_psk_len));
1076void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, 1078void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx,
1077 unsigned int (*psk_server_callback)(SSL *ssl, const char *identity, 1079 unsigned int (*psk_server_callback)(SSL *ssl, const char *identity,
1078 unsigned char *psk, unsigned int max_psk_len)); 1080 unsigned char *psk, unsigned int max_psk_len));
1079void SSL_set_psk_server_callback(SSL *ssl, 1081void SSL_set_psk_server_callback(SSL *ssl,
1080 unsigned int (*psk_server_callback)(SSL *ssl, const char *identity, 1082 unsigned int (*psk_server_callback)(SSL *ssl, const char *identity,
1081 unsigned char *psk, unsigned int max_psk_len)); 1083 unsigned char *psk, unsigned int max_psk_len));
1082int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint); 1084int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint);
1083int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint); 1085int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint);
1084const char *SSL_get_psk_identity_hint(const SSL *s); 1086const char *SSL_get_psk_identity_hint(const SSL *s);
@@ -1101,8 +1103,7 @@ const char *SSL_get_psk_identity(const SSL *s);
1101 1103
1102#ifndef OPENSSL_NO_SSL_INTERN 1104#ifndef OPENSSL_NO_SSL_INTERN
1103 1105
1104struct ssl_st 1106struct ssl_st {
1105 {
1106 /* protocol version 1107 /* protocol version
1107 * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, DTLS1_VERSION) 1108 * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, DTLS1_VERSION)
1108 */ 1109 */
@@ -1146,9 +1147,9 @@ struct ssl_st
1146 int server; /* are we the server side? - mostly used by SSL_clear*/ 1147 int server; /* are we the server side? - mostly used by SSL_clear*/
1147 1148
1148 int new_session;/* Generate a new session or reuse an old one. 1149 int new_session;/* Generate a new session or reuse an old one.
1149 * NB: For servers, the 'new' session may actually be a previously 1150 * NB: For servers, the 'new' session may actually be a previously
1150 * cached session or even the previous session unless 1151 * cached session or even the previous session unless
1151 * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */ 1152 * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */
1152 int quiet_shutdown;/* don't send shutdown packets */ 1153 int quiet_shutdown;/* don't send shutdown packets */
1153 int shutdown; /* we have shut things down, 0x01 sent, 0x02 1154 int shutdown; /* we have shut things down, 0x01 sent, 0x02
1154 * for received */ 1155 * for received */
@@ -1156,7 +1157,7 @@ struct ssl_st
1156 int rstate; /* where we are when reading */ 1157 int rstate; /* where we are when reading */
1157 1158
1158 BUF_MEM *init_buf; /* buffer used during init */ 1159 BUF_MEM *init_buf; /* buffer used during init */
1159 void *init_msg; /* pointer to handshake message body, set by ssl3_get_message() */ 1160 void *init_msg; /* pointer to handshake message body, set by ssl3_get_message() */
1160 int init_num; /* amount read/written */ 1161 int init_num; /* amount read/written */
1161 int init_off; /* amount read/written */ 1162 int init_off; /* amount read/written */
1162 1163
@@ -1169,10 +1170,11 @@ struct ssl_st
1169 struct dtls1_state_st *d1; /* DTLSv1 variables */ 1170 struct dtls1_state_st *d1; /* DTLSv1 variables */
1170 1171
1171 int read_ahead; /* Read as many input bytes as possible 1172 int read_ahead; /* Read as many input bytes as possible
1172 * (for non-blocking reads) */ 1173 * (for non-blocking reads) */
1173 1174
1174 /* callback that allows applications to peek at protocol messages */ 1175 /* callback that allows applications to peek at protocol messages */
1175 void (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); 1176 void (*msg_callback)(int write_p, int version, int content_type,
1177 const void *buf, size_t len, SSL *ssl, void *arg);
1176 void *msg_callback_arg; 1178 void *msg_callback_arg;
1177 1179
1178 int hit; /* reusing a previous session */ 1180 int hit; /* reusing a previous session */
@@ -1190,9 +1192,10 @@ struct ssl_st
1190 1192
1191 /* These are the ones being used, the ones in SSL_SESSION are 1193 /* These are the ones being used, the ones in SSL_SESSION are
1192 * the ones to be 'copied' into these ones */ 1194 * the ones to be 'copied' into these ones */
1193 int mac_flags; 1195 int mac_flags;
1196
1194 EVP_CIPHER_CTX *enc_read_ctx; /* cryptographic state */ 1197 EVP_CIPHER_CTX *enc_read_ctx; /* cryptographic state */
1195 EVP_MD_CTX *read_hash; /* used for mac generation */ 1198 EVP_MD_CTX *read_hash; /* used for mac generation */
1196#ifndef OPENSSL_NO_COMP 1199#ifndef OPENSSL_NO_COMP
1197 COMP_CTX *expand; /* uncompress */ 1200 COMP_CTX *expand; /* uncompress */
1198#else 1201#else
@@ -1200,11 +1203,12 @@ struct ssl_st
1200#endif 1203#endif
1201 1204
1202 EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */ 1205 EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */
1203 EVP_MD_CTX *write_hash; /* used for mac generation */ 1206 EVP_MD_CTX *write_hash; /* used for mac generation */
1204#ifndef OPENSSL_NO_COMP 1207#ifndef OPENSSL_NO_COMP
1205 COMP_CTX *compress; /* compression */ 1208 COMP_CTX *compress; /* compression */
1206#else 1209#else
1207 char *compress; 1210 char *compress;
1211
1208#endif 1212#endif
1209 1213
1210 /* session info */ 1214 /* session info */
@@ -1235,21 +1239,22 @@ struct ssl_st
1235 int error_code; /* actual code */ 1239 int error_code; /* actual code */
1236 1240
1237#ifndef OPENSSL_NO_KRB5 1241#ifndef OPENSSL_NO_KRB5
1238 KSSL_CTX *kssl_ctx; /* Kerberos 5 context */ 1242 KSSL_CTX *kssl_ctx; /* Kerberos 5 context */
1239#endif /* OPENSSL_NO_KRB5 */ 1243#endif /* OPENSSL_NO_KRB5 */
1240 1244
1241#ifndef OPENSSL_NO_PSK 1245#ifndef OPENSSL_NO_PSK
1242 unsigned int (*psk_client_callback)(SSL *ssl, const char *hint, char *identity, 1246 unsigned int (*psk_client_callback)(SSL *ssl, const char *hint,
1243 unsigned int max_identity_len, unsigned char *psk, 1247 char *identity, unsigned int max_identity_len, unsigned char *psk,
1244 unsigned int max_psk_len); 1248 unsigned int max_psk_len);
1245 unsigned int (*psk_server_callback)(SSL *ssl, const char *identity, 1249 unsigned int (*psk_server_callback)(SSL *ssl, const char *identity,
1246 unsigned char *psk, unsigned int max_psk_len); 1250 unsigned char *psk, unsigned int max_psk_len);
1247#endif 1251#endif
1248 1252
1249 SSL_CTX *ctx; 1253 SSL_CTX *ctx;
1250 /* set this flag to 1 and a sleep(1) is put into all SSL_read() 1254 /* set this flag to 1 and a sleep(1) is put into all SSL_read()
1251 * and SSL_write() calls, good for nbio debuging :-) */ 1255 * and SSL_write() calls, good for nbio debuging :-) */
1252 int debug; 1256 int debug;
1257
1253 1258
1254 /* extra application data */ 1259 /* extra application data */
1255 long verify_result; 1260 long verify_result;
@@ -1269,15 +1274,14 @@ struct ssl_st
1269#ifndef OPENSSL_NO_TLSEXT 1274#ifndef OPENSSL_NO_TLSEXT
1270 /* TLS extension debug callback */ 1275 /* TLS extension debug callback */
1271 void (*tlsext_debug_cb)(SSL *s, int client_server, int type, 1276 void (*tlsext_debug_cb)(SSL *s, int client_server, int type,
1272 unsigned char *data, int len, 1277 unsigned char *data, int len, void *arg);
1273 void *arg);
1274 void *tlsext_debug_arg; 1278 void *tlsext_debug_arg;
1275 char *tlsext_hostname; 1279 char *tlsext_hostname;
1276 int servername_done; /* no further mod of servername 1280 int servername_done; /* no further mod of servername
1277 0 : call the servername extension callback. 1281 0 : call the servername extension callback.
1278 1 : prepare 2, allow last ack just after in server callback. 1282 1 : prepare 2, allow last ack just after in server callback.
1279 2 : don't call servername callback, no ack in server hello 1283 2 : don't call servername callback, no ack in server hello
1280 */ 1284 */
1281 /* certificate status request info */ 1285 /* certificate status request info */
1282 /* Status type or -1 if no status type */ 1286 /* Status type or -1 if no status type */
1283 int tlsext_status_type; 1287 int tlsext_status_type;
@@ -1330,28 +1334,28 @@ struct ssl_st
1330 1334
1331#define session_ctx initial_ctx 1335#define session_ctx initial_ctx
1332 1336
1333 STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; /* What we'll do */ 1337 STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; /* What we'll do */
1334 SRTP_PROTECTION_PROFILE *srtp_profile; /* What's been chosen */ 1338 SRTP_PROTECTION_PROFILE *srtp_profile; /* What's been chosen */
1335 1339
1336 unsigned int tlsext_heartbeat; /* Is use of the Heartbeat extension negotiated? 1340 unsigned int tlsext_heartbeat; /* Is use of the Heartbeat extension negotiated?
1337 0: disabled 1341 0: disabled
1338 1: enabled 1342 1: enabled
1339 2: enabled, but not allowed to send Requests 1343 2: enabled, but not allowed to send Requests
1340 */ 1344 */
1341 unsigned int tlsext_hb_pending; /* Indicates if a HeartbeatRequest is in flight */ 1345 unsigned int tlsext_hb_pending; /* Indicates if a HeartbeatRequest is in flight */
1342 unsigned int tlsext_hb_seq; /* HeartbeatRequest sequence number */ 1346 unsigned int tlsext_hb_seq; /* HeartbeatRequest sequence number */
1343#else 1347#else
1344#define session_ctx ctx 1348#define session_ctx ctx
1345#endif /* OPENSSL_NO_TLSEXT */ 1349#endif /* OPENSSL_NO_TLSEXT */
1346 1350
1347 int renegotiate;/* 1 if we are renegotiating. 1351 int renegotiate;/* 1 if we are renegotiating.
1348 * 2 if we are a server and are inside a handshake 1352 * 2 if we are a server and are inside a handshake
1349 * (i.e. not just sending a HelloRequest) */ 1353 * (i.e. not just sending a HelloRequest) */
1350 1354
1351#ifndef OPENSSL_NO_SRP 1355#ifndef OPENSSL_NO_SRP
1352 SRP_CTX srp_ctx; /* ctx for SRP authentication */ 1356 SRP_CTX srp_ctx; /* ctx for SRP authentication */
1353#endif 1357#endif
1354 }; 1358};
1355 1359
1356#endif 1360#endif
1357 1361
@@ -1361,10 +1365,10 @@ struct ssl_st
1361 1365
1362#include <openssl/ssl2.h> 1366#include <openssl/ssl2.h>
1363#include <openssl/ssl3.h> 1367#include <openssl/ssl3.h>
1364#include <openssl/tls1.h> /* This is mostly sslv3 with a few tweaks */ 1368#include <openssl/tls1.h> /* This is mostly sslv3 with a few tweaks */
1365#include <openssl/dtls1.h> /* Datagram TLS */ 1369#include <openssl/dtls1.h> /* Datagram TLS */
1366#include <openssl/ssl23.h> 1370#include <openssl/ssl23.h>
1367#include <openssl/srtp.h> /* Support for the use_srtp extension */ 1371#include <openssl/srtp.h> /* Support for the use_srtp extension */
1368 1372
1369#ifdef __cplusplus 1373#ifdef __cplusplus
1370extern "C" { 1374extern "C" {
@@ -1417,9 +1421,9 @@ extern "C" {
1417 1421
1418/* The following 2 states are kept in ssl->rstate when reads fail, 1422/* The following 2 states are kept in ssl->rstate when reads fail,
1419 * you should not need these */ 1423 * you should not need these */
1420#define SSL_ST_READ_HEADER 0xF0 1424#define SSL_ST_READ_HEADER 0xF0
1421#define SSL_ST_READ_BODY 0xF1 1425#define SSL_ST_READ_BODY 0xF1
1422#define SSL_ST_READ_DONE 0xF2 1426#define SSL_ST_READ_DONE 0xF2
1423 1427
1424/* Obtain latest Finished message 1428/* Obtain latest Finished message
1425 * -- that we sent (SSL_get_finished) 1429 * -- that we sent (SSL_get_finished)
@@ -1646,28 +1650,27 @@ DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION)
1646 1650
1647#ifndef OPENSSL_NO_BIO 1651#ifndef OPENSSL_NO_BIO
1648BIO_METHOD *BIO_f_ssl(void); 1652BIO_METHOD *BIO_f_ssl(void);
1649BIO *BIO_new_ssl(SSL_CTX *ctx,int client); 1653BIO *BIO_new_ssl(SSL_CTX *ctx, int client);
1650BIO *BIO_new_ssl_connect(SSL_CTX *ctx); 1654BIO *BIO_new_ssl_connect(SSL_CTX *ctx);
1651BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); 1655BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx);
1652int BIO_ssl_copy_session_id(BIO *to,BIO *from); 1656int BIO_ssl_copy_session_id(BIO *to, BIO *from);
1653void BIO_ssl_shutdown(BIO *ssl_bio); 1657void BIO_ssl_shutdown(BIO *ssl_bio);
1654
1655#endif 1658#endif
1656 1659
1657int SSL_CTX_set_cipher_list(SSL_CTX *,const char *str); 1660int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str);
1658SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth); 1661SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
1659void SSL_CTX_free(SSL_CTX *); 1662void SSL_CTX_free(SSL_CTX *);
1660long SSL_CTX_set_timeout(SSL_CTX *ctx,long t); 1663long SSL_CTX_set_timeout(SSL_CTX *ctx, long t);
1661long SSL_CTX_get_timeout(const SSL_CTX *ctx); 1664long SSL_CTX_get_timeout(const SSL_CTX *ctx);
1662X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); 1665X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *);
1663void SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *); 1666void SSL_CTX_set_cert_store(SSL_CTX *, X509_STORE *);
1664int SSL_want(const SSL *s); 1667int SSL_want(const SSL *s);
1665int SSL_clear(SSL *s); 1668int SSL_clear(SSL *s);
1666 1669
1667void SSL_CTX_flush_sessions(SSL_CTX *ctx,long tm); 1670void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm);
1668 1671
1669const SSL_CIPHER *SSL_get_current_cipher(const SSL *s); 1672const SSL_CIPHER *SSL_get_current_cipher(const SSL *s);
1670int SSL_CIPHER_get_bits(const SSL_CIPHER *c,int *alg_bits); 1673int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits);
1671char * SSL_CIPHER_get_version(const SSL_CIPHER *c); 1674char * SSL_CIPHER_get_version(const SSL_CIPHER *c);
1672const char * SSL_CIPHER_get_name(const SSL_CIPHER *c); 1675const char * SSL_CIPHER_get_name(const SSL_CIPHER *c);
1673unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c); 1676unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c);
@@ -1675,7 +1678,7 @@ unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c);
1675int SSL_get_fd(const SSL *s); 1678int SSL_get_fd(const SSL *s);
1676int SSL_get_rfd(const SSL *s); 1679int SSL_get_rfd(const SSL *s);
1677int SSL_get_wfd(const SSL *s); 1680int SSL_get_wfd(const SSL *s);
1678const char * SSL_get_cipher_list(const SSL *s,int n); 1681const char * SSL_get_cipher_list(const SSL *s, int n);
1679char * SSL_get_shared_ciphers(const SSL *s, char *buf, int len); 1682char * SSL_get_shared_ciphers(const SSL *s, char *buf, int len);
1680int SSL_get_read_ahead(const SSL * s); 1683int SSL_get_read_ahead(const SSL * s);
1681int SSL_pending(const SSL *s); 1684int SSL_pending(const SSL *s);
@@ -1685,7 +1688,7 @@ int SSL_set_rfd(SSL *s, int fd);
1685int SSL_set_wfd(SSL *s, int fd); 1688int SSL_set_wfd(SSL *s, int fd);
1686#endif 1689#endif
1687#ifndef OPENSSL_NO_BIO 1690#ifndef OPENSSL_NO_BIO
1688void SSL_set_bio(SSL *s, BIO *rbio,BIO *wbio); 1691void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio);
1689BIO * SSL_get_rbio(const SSL *s); 1692BIO * SSL_get_rbio(const SSL *s);
1690BIO * SSL_get_wbio(const SSL *s); 1693BIO * SSL_get_wbio(const SSL *s);
1691#endif 1694#endif
@@ -1693,16 +1696,16 @@ int SSL_set_cipher_list(SSL *s, const char *str);
1693void SSL_set_read_ahead(SSL *s, int yes); 1696void SSL_set_read_ahead(SSL *s, int yes);
1694int SSL_get_verify_mode(const SSL *s); 1697int SSL_get_verify_mode(const SSL *s);
1695int SSL_get_verify_depth(const SSL *s); 1698int SSL_get_verify_depth(const SSL *s);
1696int (*SSL_get_verify_callback(const SSL *s))(int,X509_STORE_CTX *); 1699int (*SSL_get_verify_callback(const SSL *s))(int, X509_STORE_CTX *);
1697void SSL_set_verify(SSL *s, int mode, 1700void SSL_set_verify(SSL *s, int mode,
1698 int (*callback)(int ok,X509_STORE_CTX *ctx)); 1701 int (*callback)(int ok, X509_STORE_CTX *ctx));
1699void SSL_set_verify_depth(SSL *s, int depth); 1702void SSL_set_verify_depth(SSL *s, int depth);
1700#ifndef OPENSSL_NO_RSA 1703#ifndef OPENSSL_NO_RSA
1701int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); 1704int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa);
1702#endif 1705#endif
1703int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len); 1706int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len);
1704int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); 1707int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey);
1705int SSL_use_PrivateKey_ASN1(int pk,SSL *ssl, const unsigned char *d, long len); 1708int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, long len);
1706int SSL_use_certificate(SSL *ssl, X509 *x); 1709int SSL_use_certificate(SSL *ssl, X509 *x);
1707int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len); 1710int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len);
1708 1711
@@ -1716,9 +1719,9 @@ int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type);
1716int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); /* PEM type */ 1719int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); /* PEM type */
1717STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); 1720STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);
1718int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, 1721int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
1719 const char *file); 1722 const char *file);
1720int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, 1723int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
1721 const char *dir); 1724 const char *dir);
1722#endif 1725#endif
1723 1726
1724void SSL_load_error_strings(void ); 1727void SSL_load_error_strings(void );
@@ -1730,32 +1733,34 @@ long SSL_SESSION_get_time(const SSL_SESSION *s);
1730long SSL_SESSION_set_time(SSL_SESSION *s, long t); 1733long SSL_SESSION_set_time(SSL_SESSION *s, long t);
1731long SSL_SESSION_get_timeout(const SSL_SESSION *s); 1734long SSL_SESSION_get_timeout(const SSL_SESSION *s);
1732long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); 1735long SSL_SESSION_set_timeout(SSL_SESSION *s, long t);
1733void SSL_copy_session_id(SSL *to,const SSL *from); 1736void SSL_copy_session_id(SSL *to, const SSL *from);
1734X509 *SSL_SESSION_get0_peer(SSL_SESSION *s); 1737X509 *SSL_SESSION_get0_peer(SSL_SESSION *s);
1735int SSL_SESSION_set1_id_context(SSL_SESSION *s,const unsigned char *sid_ctx, 1738int
1736 unsigned int sid_ctx_len); 1739SSL_SESSION_set1_id_context(SSL_SESSION *s, const unsigned char *sid_ctx,
1740unsigned int sid_ctx_len);
1737 1741
1738SSL_SESSION *SSL_SESSION_new(void); 1742SSL_SESSION *SSL_SESSION_new(void);
1739const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, 1743const unsigned char
1740 unsigned int *len); 1744*SSL_SESSION_get_id(const SSL_SESSION *s,
1745unsigned int *len);
1741unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s); 1746unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s);
1742#ifndef OPENSSL_NO_FP_API 1747#ifndef OPENSSL_NO_FP_API
1743int SSL_SESSION_print_fp(FILE *fp,const SSL_SESSION *ses); 1748int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses);
1744#endif 1749#endif
1745#ifndef OPENSSL_NO_BIO 1750#ifndef OPENSSL_NO_BIO
1746int SSL_SESSION_print(BIO *fp,const SSL_SESSION *ses); 1751int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses);
1747#endif 1752#endif
1748void SSL_SESSION_free(SSL_SESSION *ses); 1753void SSL_SESSION_free(SSL_SESSION *ses);
1749int i2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp); 1754int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp);
1750int SSL_set_session(SSL *to, SSL_SESSION *session); 1755int SSL_set_session(SSL *to, SSL_SESSION *session);
1751int SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c); 1756int SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c);
1752int SSL_CTX_remove_session(SSL_CTX *,SSL_SESSION *c); 1757int SSL_CTX_remove_session(SSL_CTX *, SSL_SESSION *c);
1753int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB); 1758int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB);
1754int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB); 1759int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB);
1755int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, 1760int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id,
1756 unsigned int id_len); 1761 unsigned int id_len);
1757SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,const unsigned char **pp, 1762SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
1758 long length); 1763 long length);
1759 1764
1760#ifdef HEADER_X509_H 1765#ifdef HEADER_X509_H
1761X509 * SSL_get_peer_certificate(const SSL *s); 1766X509 * SSL_get_peer_certificate(const SSL *s);
@@ -1765,18 +1770,17 @@ STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s);
1765 1770
1766int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); 1771int SSL_CTX_get_verify_mode(const SSL_CTX *ctx);
1767int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); 1772int SSL_CTX_get_verify_depth(const SSL_CTX *ctx);
1768int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int,X509_STORE_CTX *); 1773int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int, X509_STORE_CTX *);
1769void SSL_CTX_set_verify(SSL_CTX *ctx,int mode, 1774void SSL_CTX_set_verify(SSL_CTX *ctx, int mode,
1770 int (*callback)(int, X509_STORE_CTX *)); 1775 int (*callback)(int, X509_STORE_CTX *));
1771void SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth); 1776void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth);
1772void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*cb)(X509_STORE_CTX *,void *), void *arg); 1777void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*cb)(X509_STORE_CTX *, void *), void *arg);
1773#ifndef OPENSSL_NO_RSA 1778#ifndef OPENSSL_NO_RSA
1774int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); 1779int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);
1775#endif 1780#endif
1776int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len); 1781int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len);
1777int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); 1782int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey);
1778int SSL_CTX_use_PrivateKey_ASN1(int pk,SSL_CTX *ctx, 1783int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, const unsigned char *d, long len);
1779 const unsigned char *d, long len);
1780int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); 1784int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x);
1781int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d); 1785int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d);
1782 1786
@@ -1786,12 +1790,10 @@ void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u);
1786int SSL_CTX_check_private_key(const SSL_CTX *ctx); 1790int SSL_CTX_check_private_key(const SSL_CTX *ctx);
1787int SSL_check_private_key(const SSL *ctx); 1791int SSL_check_private_key(const SSL *ctx);
1788 1792
1789int SSL_CTX_set_session_id_context(SSL_CTX *ctx,const unsigned char *sid_ctx, 1793int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx, unsigned int sid_ctx_len);
1790 unsigned int sid_ctx_len);
1791 1794
1792SSL * SSL_new(SSL_CTX *ctx); 1795SSL *SSL_new(SSL_CTX *ctx);
1793int SSL_set_session_id_context(SSL *ssl,const unsigned char *sid_ctx, 1796int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx, unsigned int sid_ctx_len);
1794 unsigned int sid_ctx_len);
1795 1797
1796int SSL_CTX_set_purpose(SSL_CTX *s, int purpose); 1798int SSL_CTX_set_purpose(SSL_CTX *s, int purpose);
1797int SSL_set_purpose(SSL *s, int purpose); 1799int SSL_set_purpose(SSL *s, int purpose);
@@ -1802,21 +1804,16 @@ int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);
1802int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm); 1804int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm);
1803 1805
1804#ifndef OPENSSL_NO_SRP 1806#ifndef OPENSSL_NO_SRP
1805int SSL_CTX_set_srp_username(SSL_CTX *ctx,char *name); 1807int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name);
1806int SSL_CTX_set_srp_password(SSL_CTX *ctx,char *password); 1808int SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password);
1807int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength); 1809int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength);
1808int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx, 1810int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx, char *(*cb)(SSL *, void *));
1809 char *(*cb)(SSL *,void *)); 1811int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx, int (*cb)(SSL *, void *));
1810int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx, 1812int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx, int (*cb)(SSL *, int *, void *));
1811 int (*cb)(SSL *,void *));
1812int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx,
1813 int (*cb)(SSL *,int *,void *));
1814int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg); 1813int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg);
1815 1814
1816int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g, 1815int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g, BIGNUM *sa, BIGNUM *v, char *info);
1817 BIGNUM *sa, BIGNUM *v, char *info); 1816int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass, const char *grp);
1818int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass,
1819 const char *grp);
1820 1817
1821BIGNUM *SSL_get_srp_g(SSL *s); 1818BIGNUM *SSL_get_srp_g(SSL *s);
1822BIGNUM *SSL_get_srp_N(SSL *s); 1819BIGNUM *SSL_get_srp_N(SSL *s);
@@ -1828,15 +1825,15 @@ char *SSL_get_srp_userinfo(SSL *s);
1828void SSL_free(SSL *ssl); 1825void SSL_free(SSL *ssl);
1829int SSL_accept(SSL *ssl); 1826int SSL_accept(SSL *ssl);
1830int SSL_connect(SSL *ssl); 1827int SSL_connect(SSL *ssl);
1831int SSL_read(SSL *ssl,void *buf,int num); 1828int SSL_read(SSL *ssl, void *buf, int num);
1832int SSL_peek(SSL *ssl,void *buf,int num); 1829int SSL_peek(SSL *ssl, void *buf, int num);
1833int SSL_write(SSL *ssl,const void *buf,int num); 1830int SSL_write(SSL *ssl, const void *buf, int num);
1834long SSL_ctrl(SSL *ssl,int cmd, long larg, void *parg); 1831long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg);
1835long SSL_callback_ctrl(SSL *, int, void (*)(void)); 1832long SSL_callback_ctrl(SSL *, int, void (*)(void));
1836long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, void *parg); 1833long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg);
1837long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void)); 1834long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void));
1838 1835
1839int SSL_get_error(const SSL *s,int ret_code); 1836int SSL_get_error(const SSL *s, int ret_code);
1840const char *SSL_get_version(const SSL *s); 1837const char *SSL_get_version(const SSL *s);
1841 1838
1842/* This sets the 'default' SSL version that SSL_new() will create */ 1839/* This sets the 'default' SSL version that SSL_new() will create */
@@ -1852,7 +1849,7 @@ const SSL_METHOD *SSLv3_method(void); /* SSLv3 */
1852const SSL_METHOD *SSLv3_server_method(void); /* SSLv3 */ 1849const SSL_METHOD *SSLv3_server_method(void); /* SSLv3 */
1853const SSL_METHOD *SSLv3_client_method(void); /* SSLv3 */ 1850const SSL_METHOD *SSLv3_client_method(void); /* SSLv3 */
1854 1851
1855const SSL_METHOD *SSLv23_method(void); /* SSLv3 but can rollback to v2 */ 1852const SSL_METHOD *SSLv23_method(void); /* SSLv3 but can rollback to v2 */
1856const SSL_METHOD *SSLv23_server_method(void); /* SSLv3 but can rollback to v2 */ 1853const SSL_METHOD *SSLv23_server_method(void); /* SSLv3 but can rollback to v2 */
1857const SSL_METHOD *SSLv23_client_method(void); /* SSLv3 but can rollback to v2 */ 1854const SSL_METHOD *SSLv23_client_method(void); /* SSLv3 but can rollback to v2 */
1858 1855
@@ -1892,8 +1889,8 @@ void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list);
1892void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); 1889void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list);
1893STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); 1890STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s);
1894STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s); 1891STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s);
1895int SSL_add_client_CA(SSL *ssl,X509 *x); 1892int SSL_add_client_CA(SSL *ssl, X509 *x);
1896int SSL_CTX_add_client_CA(SSL_CTX *ctx,X509 *x); 1893int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x);
1897 1894
1898void SSL_set_connect_state(SSL *s); 1895void SSL_set_connect_state(SSL *s);
1899void SSL_set_accept_state(SSL *s); 1896void SSL_set_accept_state(SSL *s);
@@ -1902,7 +1899,7 @@ long SSL_get_default_timeout(const SSL *s);
1902 1899
1903int SSL_library_init(void ); 1900int SSL_library_init(void );
1904 1901
1905char *SSL_CIPHER_description(const SSL_CIPHER *,char *buf,int size); 1902char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size);
1906STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk); 1903STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk);
1907 1904
1908SSL *SSL_dup(SSL *ssl); 1905SSL *SSL_dup(SSL *ssl);
@@ -1919,35 +1916,36 @@ int SSL_get_shutdown(const SSL *ssl);
1919int SSL_version(const SSL *ssl); 1916int SSL_version(const SSL *ssl);
1920int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); 1917int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx);
1921int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, 1918int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
1922 const char *CApath); 1919 const char *CApath);
1923#define SSL_get0_session SSL_get_session /* just peek at pointer */ 1920#define SSL_get0_session SSL_get_session /* just peek at pointer */
1924SSL_SESSION *SSL_get_session(const SSL *ssl); 1921SSL_SESSION *SSL_get_session(const SSL *ssl);
1925SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ 1922SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */
1926SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); 1923SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl);
1927SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX* ctx); 1924SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX* ctx);
1928void SSL_set_info_callback(SSL *ssl, 1925void SSL_set_info_callback(SSL *ssl,
1929 void (*cb)(const SSL *ssl,int type,int val)); 1926 void (*cb)(const SSL *ssl, int type, int val));
1930void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl,int type,int val); 1927void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl, int type, int val);
1931int SSL_state(const SSL *ssl); 1928int SSL_state(const SSL *ssl);
1932void SSL_set_state(SSL *ssl, int state); 1929void SSL_set_state(SSL *ssl, int state);
1933 1930
1934void SSL_set_verify_result(SSL *ssl,long v); 1931void SSL_set_verify_result(SSL *ssl, long v);
1935long SSL_get_verify_result(const SSL *ssl); 1932long SSL_get_verify_result(const SSL *ssl);
1936 1933
1937int SSL_set_ex_data(SSL *ssl,int idx,void *data); 1934int SSL_set_ex_data(SSL *ssl, int idx, void *data);
1938void *SSL_get_ex_data(const SSL *ssl,int idx); 1935void *SSL_get_ex_data(const SSL *ssl, int idx);
1939int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 1936int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
1940 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 1937 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
1941 1938
1942int SSL_SESSION_set_ex_data(SSL_SESSION *ss,int idx,void *data); 1939int SSL_SESSION_set_ex_data(SSL_SESSION *ss, int idx, void *data);
1943void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss,int idx); 1940void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss, int idx);
1944int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 1941int SSL_SESSION_get_ex_new_index(long argl, void *argp,
1945 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 1942 CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,
1943 CRYPTO_EX_free *free_func);
1946 1944
1947int SSL_CTX_set_ex_data(SSL_CTX *ssl,int idx,void *data); 1945int SSL_CTX_set_ex_data(SSL_CTX *ssl, int idx, void *data);
1948void *SSL_CTX_get_ex_data(const SSL_CTX *ssl,int idx); 1946void *SSL_CTX_get_ex_data(const SSL_CTX *ssl, int idx);
1949int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 1947int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
1950 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 1948 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
1951 1949
1952int SSL_get_ex_data_X509_STORE_CTX_idx(void ); 1950int SSL_get_ex_data_X509_STORE_CTX_idx(void );
1953 1951
@@ -1980,31 +1978,25 @@ int SSL_get_ex_data_X509_STORE_CTX_idx(void );
1980#define SSL_set_max_send_fragment(ssl,m) \ 1978#define SSL_set_max_send_fragment(ssl,m) \
1981 SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) 1979 SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL)
1982 1980
1983 /* NB: the keylength is only applicable when is_export is true */ 1981/* NB: the keylength is only applicable when is_export is true */
1984#ifndef OPENSSL_NO_RSA 1982#ifndef OPENSSL_NO_RSA
1985void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, 1983void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,
1986 RSA *(*cb)(SSL *ssl,int is_export, 1984 RSA *(*cb)(SSL *ssl, int is_export, int keylength));
1987 int keylength));
1988 1985
1989void SSL_set_tmp_rsa_callback(SSL *ssl, 1986void SSL_set_tmp_rsa_callback(SSL *ssl,
1990 RSA *(*cb)(SSL *ssl,int is_export, 1987 RSA *(*cb)(SSL *ssl, int is_export, int keylength));
1991 int keylength));
1992#endif 1988#endif
1993#ifndef OPENSSL_NO_DH 1989#ifndef OPENSSL_NO_DH
1994void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, 1990void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,
1995 DH *(*dh)(SSL *ssl,int is_export, 1991 DH *(*dh)(SSL *ssl, int is_export, int keylength));
1996 int keylength));
1997void SSL_set_tmp_dh_callback(SSL *ssl, 1992void SSL_set_tmp_dh_callback(SSL *ssl,
1998 DH *(*dh)(SSL *ssl,int is_export, 1993 DH *(*dh)(SSL *ssl, int is_export, int keylength));
1999 int keylength));
2000#endif 1994#endif
2001#ifndef OPENSSL_NO_ECDH 1995#ifndef OPENSSL_NO_ECDH
2002void SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx, 1996void SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx,
2003 EC_KEY *(*ecdh)(SSL *ssl,int is_export, 1997 EC_KEY *(*ecdh)(SSL *ssl, int is_export, int keylength));
2004 int keylength));
2005void SSL_set_tmp_ecdh_callback(SSL *ssl, 1998void SSL_set_tmp_ecdh_callback(SSL *ssl,
2006 EC_KEY *(*ecdh)(SSL *ssl,int is_export, 1999 EC_KEY *(*ecdh)(SSL *ssl, int is_export, int keylength));
2007 int keylength));
2008#endif 2000#endif
2009 2001
2010#ifndef OPENSSL_NO_COMP 2002#ifndef OPENSSL_NO_COMP
@@ -2012,23 +2004,24 @@ const COMP_METHOD *SSL_get_current_compression(SSL *s);
2012const COMP_METHOD *SSL_get_current_expansion(SSL *s); 2004const COMP_METHOD *SSL_get_current_expansion(SSL *s);
2013const char *SSL_COMP_get_name(const COMP_METHOD *comp); 2005const char *SSL_COMP_get_name(const COMP_METHOD *comp);
2014STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void); 2006STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void);
2015int SSL_COMP_add_compression_method(int id,COMP_METHOD *cm); 2007int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm);
2016#else 2008#else
2017const void *SSL_get_current_compression(SSL *s); 2009const void *SSL_get_current_compression(SSL *s);
2018const void *SSL_get_current_expansion(SSL *s); 2010const void *SSL_get_current_expansion(SSL *s);
2019const char *SSL_COMP_get_name(const void *comp); 2011const char *SSL_COMP_get_name(const void *comp);
2020void *SSL_COMP_get_compression_methods(void); 2012void *SSL_COMP_get_compression_methods(void);
2021int SSL_COMP_add_compression_method(int id,void *cm); 2013int SSL_COMP_add_compression_method(int id, void *cm);
2022#endif 2014#endif
2023 2015
2024/* TLS extensions functions */ 2016/* TLS extensions functions */
2025int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len); 2017int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len);
2026 2018
2027int SSL_set_session_ticket_ext_cb(SSL *s, tls_session_ticket_ext_cb_fn cb, 2019int SSL_set_session_ticket_ext_cb(SSL *s,
2028 void *arg); 2020 tls_session_ticket_ext_cb_fn cb, void *arg);
2029 2021
2030/* Pre-shared secret session resumption functions */ 2022/* Pre-shared secret session resumption functions */
2031int SSL_set_session_secret_cb(SSL *s, tls_session_secret_cb_fn tls_session_secret_cb, void *arg); 2023int SSL_set_session_secret_cb(SSL *s,
2024 tls_session_secret_cb_fn tls_session_secret_cb, void *arg);
2032 2025
2033void SSL_set_debug(SSL *s, int debug); 2026void SSL_set_debug(SSL *s, int debug);
2034int SSL_cache_hit(SSL *s); 2027int SSL_cache_hit(SSL *s);
diff --git a/src/lib/libssl/src/ssl/ssl2.h b/src/lib/libssl/src/ssl/ssl2.h
index 29033c8be7..4052b11868 100644
--- a/src/lib/libssl/src/ssl/ssl2.h
+++ b/src/lib/libssl/src/ssl/ssl2.h
@@ -100,7 +100,7 @@ extern "C" {
100#define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5 0x020700c0 100#define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5 0x020700c0
101#define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA 0x020701c0 /* v3 */ 101#define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA 0x020701c0 /* v3 */
102#define SSL2_CK_RC4_64_WITH_MD5 0x02080080 /* MS hack */ 102#define SSL2_CK_RC4_64_WITH_MD5 0x02080080 /* MS hack */
103 103
104#define SSL2_CK_DES_64_CFB64_WITH_MD5_1 0x02ff0800 /* SSLeay */ 104#define SSL2_CK_DES_64_CFB64_WITH_MD5_1 0x02ff0800 /* SSLeay */
105#define SSL2_CK_NULL 0x02ff0810 /* SSLeay */ 105#define SSL2_CK_NULL 0x02ff0810 /* SSLeay */
106 106
@@ -133,8 +133,8 @@ extern "C" {
133 133
134/* Upper/Lower Bounds */ 134/* Upper/Lower Bounds */
135#define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS 256 135#define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS 256
136#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 32767u /* 2^15-1 */ 136#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 32767u /* 2^15-1 */
137#define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER 16383 /* 2^14-1 */ 137#define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER 16383 /* 2^14-1 */
138 138
139#define SSL2_CHALLENGE_LENGTH 16 139#define SSL2_CHALLENGE_LENGTH 16
140/*#define SSL2_CHALLENGE_LENGTH 32 */ 140/*#define SSL2_CHALLENGE_LENGTH 32 */
@@ -153,8 +153,7 @@ extern "C" {
153 153
154#ifndef OPENSSL_NO_SSL_INTERN 154#ifndef OPENSSL_NO_SSL_INTERN
155 155
156typedef struct ssl2_state_st 156typedef struct ssl2_state_st {
157 {
158 int three_byte_header; 157 int three_byte_header;
159 int clear_text; /* clear text */ 158 int clear_text; /* clear text */
160 int escape; /* not used in SSLv2 */ 159 int escape; /* not used in SSLv2 */
@@ -167,8 +166,8 @@ typedef struct ssl2_state_st
167 const unsigned char *wpend_buf; 166 const unsigned char *wpend_buf;
168 167
169 int wpend_off; /* offset to data to write */ 168 int wpend_off; /* offset to data to write */
170 int wpend_len; /* number of bytes passwd to write */ 169 int wpend_len; /* number of bytes passwd to write */
171 int wpend_ret; /* number of bytes to return to caller */ 170 int wpend_ret; /* number of bytes to return to caller */
172 171
173 /* buffer raw data */ 172 /* buffer raw data */
174 int rbuf_left; 173 int rbuf_left;
@@ -191,7 +190,7 @@ typedef struct ssl2_state_st
191 unsigned char *read_key; 190 unsigned char *read_key;
192 unsigned char *write_key; 191 unsigned char *write_key;
193 192
194 /* Stuff specifically to do with this SSL session */ 193 /* Stuff specifically to do with this SSL session */
195 unsigned int challenge_length; 194 unsigned int challenge_length;
196 unsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH]; 195 unsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH];
197 unsigned int conn_id_length; 196 unsigned int conn_id_length;
@@ -202,20 +201,23 @@ typedef struct ssl2_state_st
202 unsigned long read_sequence; 201 unsigned long read_sequence;
203 unsigned long write_sequence; 202 unsigned long write_sequence;
204 203
205 struct { 204 struct {
206 unsigned int conn_id_length; 205 unsigned int conn_id_length;
207 unsigned int cert_type; 206 unsigned int cert_type;
207
208 unsigned int cert_length; 208 unsigned int cert_length;
209 unsigned int csl; 209 unsigned int csl;
210
210 unsigned int clear; 211 unsigned int clear;
211 unsigned int enc; 212 unsigned int enc;
213
212 unsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH]; 214 unsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH];
213 unsigned int cipher_spec_length; 215 unsigned int cipher_spec_length;
214 unsigned int session_id_length; 216 unsigned int session_id_length;
215 unsigned int clen; 217 unsigned int clen;
216 unsigned int rlen; 218 unsigned int rlen;
217 } tmp; 219 } tmp;
218 } SSL2_STATE; 220} SSL2_STATE;
219 221
220#endif 222#endif
221 223
@@ -265,4 +267,3 @@ typedef struct ssl2_state_st
265} 267}
266#endif 268#endif
267#endif 269#endif
268
diff --git a/src/lib/libssl/src/ssl/ssl23.h b/src/lib/libssl/src/ssl/ssl23.h
index d3228983c7..4e28a06796 100644
--- a/src/lib/libssl/src/ssl/ssl23.h
+++ b/src/lib/libssl/src/ssl/ssl23.h
@@ -80,4 +80,3 @@ extern "C" {
80} 80}
81#endif 81#endif
82#endif 82#endif
83
diff --git a/src/lib/libssl/src/ssl/ssl3.h b/src/lib/libssl/src/ssl/ssl3.h
index cb8b2492ec..2b25357917 100644
--- a/src/lib/libssl/src/ssl/ssl3.h
+++ b/src/lib/libssl/src/ssl/ssl3.h
@@ -163,13 +163,13 @@ extern "C" {
163#define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B 163#define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B
164 164
165#if 0 165#if 0
166 #define SSL3_CK_FZA_DMS_NULL_SHA 0x0300001C 166#define SSL3_CK_FZA_DMS_NULL_SHA 0x0300001C
167 #define SSL3_CK_FZA_DMS_FZA_SHA 0x0300001D 167#define SSL3_CK_FZA_DMS_FZA_SHA 0x0300001D
168 #if 0 /* Because it clashes with KRB5, is never used any more, and is safe 168#if 0 /* Because it clashes with KRB5, is never used any more, and is safe
169 to remove according to David Hopwood <david.hopwood@zetnet.co.uk> 169 to remove according to David Hopwood <david.hopwood@zetnet.co.uk>
170 of the ietf-tls list */ 170 of the ietf-tls list */
171 #define SSL3_CK_FZA_DMS_RC4_SHA 0x0300001E 171#define SSL3_CK_FZA_DMS_RC4_SHA 0x0300001E
172 #endif 172#endif
173#endif 173#endif
174 174
175/* VRS Additional Kerberos5 entries 175/* VRS Additional Kerberos5 entries
@@ -222,9 +222,9 @@ extern "C" {
222#define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA" 222#define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA"
223 223
224#if 0 224#if 0
225 #define SSL3_TXT_FZA_DMS_NULL_SHA "FZA-NULL-SHA" 225#define SSL3_TXT_FZA_DMS_NULL_SHA "FZA-NULL-SHA"
226 #define SSL3_TXT_FZA_DMS_FZA_SHA "FZA-FZA-CBC-SHA" 226#define SSL3_TXT_FZA_DMS_FZA_SHA "FZA-FZA-CBC-SHA"
227 #define SSL3_TXT_FZA_DMS_RC4_SHA "FZA-RC4-SHA" 227#define SSL3_TXT_FZA_DMS_RC4_SHA "FZA-RC4-SHA"
228#endif 228#endif
229 229
230#define SSL3_TXT_KRB5_DES_64_CBC_SHA "KRB5-DES-CBC-SHA" 230#define SSL3_TXT_KRB5_DES_64_CBC_SHA "KRB5-DES-CBC-SHA"
@@ -342,11 +342,10 @@ extern "C" {
342 342
343#define TLS1_HB_REQUEST 1 343#define TLS1_HB_REQUEST 1
344#define TLS1_HB_RESPONSE 2 344#define TLS1_HB_RESPONSE 2
345 345
346#ifndef OPENSSL_NO_SSL_INTERN 346#ifndef OPENSSL_NO_SSL_INTERN
347 347
348typedef struct ssl3_record_st 348typedef struct ssl3_record_st {
349 {
350/*r */ int type; /* type of record */ 349/*r */ int type; /* type of record */
351/*rw*/ unsigned int length; /* How many bytes available */ 350/*rw*/ unsigned int length; /* How many bytes available */
352/*r */ unsigned int off; /* read/write offset into 'buf' */ 351/*r */ unsigned int off; /* read/write offset into 'buf' */
@@ -355,16 +354,15 @@ typedef struct ssl3_record_st
355/*r */ unsigned char *comp; /* only used with decompression - malloc()ed */ 354/*r */ unsigned char *comp; /* only used with decompression - malloc()ed */
356/*r */ unsigned long epoch; /* epoch number, needed by DTLS1 */ 355/*r */ unsigned long epoch; /* epoch number, needed by DTLS1 */
357/*r */ unsigned char seq_num[8]; /* sequence number, needed by DTLS1 */ 356/*r */ unsigned char seq_num[8]; /* sequence number, needed by DTLS1 */
358 } SSL3_RECORD; 357} SSL3_RECORD;
359 358
360typedef struct ssl3_buffer_st 359typedef struct ssl3_buffer_st {
361 { 360 unsigned char *buf; /* at least SSL3_RT_MAX_PACKET_SIZE bytes,
362 unsigned char *buf; /* at least SSL3_RT_MAX_PACKET_SIZE bytes,
363 * see ssl3_setup_buffers() */ 361 * see ssl3_setup_buffers() */
364 size_t len; /* buffer size */ 362 size_t len; /* buffer size */
365 int offset; /* where to 'copy from' */ 363 int offset; /* where to 'copy from' */
366 int left; /* how many bytes left */ 364 int left; /* how many bytes left */
367 } SSL3_BUFFER; 365} SSL3_BUFFER;
368 366
369#endif 367#endif
370 368
@@ -388,7 +386,7 @@ typedef struct ssl3_buffer_st
388#define TLS1_FLAGS_TLS_PADDING_BUG 0x0008 386#define TLS1_FLAGS_TLS_PADDING_BUG 0x0008
389#define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010 387#define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010
390#define TLS1_FLAGS_KEEP_HANDSHAKE 0x0020 388#define TLS1_FLAGS_KEEP_HANDSHAKE 0x0020
391 389
392/* SSL3_FLAGS_SGC_RESTART_DONE is set when we 390/* SSL3_FLAGS_SGC_RESTART_DONE is set when we
393 * restart a handshake because of MS SGC and so prevents us 391 * restart a handshake because of MS SGC and so prevents us
394 * from restarting the handshake in a loop. It's reset on a 392 * from restarting the handshake in a loop. It's reset on a
@@ -402,8 +400,7 @@ typedef struct ssl3_buffer_st
402 400
403#ifndef OPENSSL_NO_SSL_INTERN 401#ifndef OPENSSL_NO_SSL_INTERN
404 402
405typedef struct ssl3_state_st 403typedef struct ssl3_state_st {
406 {
407 long flags; 404 long flags;
408 int delay_buf_pop_ret; 405 int delay_buf_pop_ret;
409 406
@@ -471,7 +468,8 @@ typedef struct ssl3_state_st
471 468
472 /* Opaque PRF input as used for the current handshake. 469 /* Opaque PRF input as used for the current handshake.
473 * These fields are used only if TLSEXT_TYPE_opaque_prf_input is defined 470 * These fields are used only if TLSEXT_TYPE_opaque_prf_input is defined
474 * (otherwise, they are merely present to improve binary compatibility) */ 471 * (otherwise, they are merely present to improve binary compatibility)
472 */
475 void *client_opaque_prf_input; 473 void *client_opaque_prf_input;
476 size_t client_opaque_prf_input_len; 474 size_t client_opaque_prf_input_len;
477 void *server_opaque_prf_input; 475 void *server_opaque_prf_input;
@@ -501,7 +499,7 @@ typedef struct ssl3_state_st
501#endif 499#endif
502 500
503 /* used when SSL_ST_FLUSH_DATA is entered */ 501 /* used when SSL_ST_FLUSH_DATA is entered */
504 int next_state; 502 int next_state;
505 503
506 int reuse_message; 504 int reuse_message;
507 505
@@ -526,17 +524,18 @@ typedef struct ssl3_state_st
526 char *new_compression; 524 char *new_compression;
527#endif 525#endif
528 int cert_request; 526 int cert_request;
529 } tmp; 527 } tmp;
530 528
531 /* Connection binding to prevent renegotiation attacks */ 529 /* Connection binding to prevent renegotiation attacks */
532 unsigned char previous_client_finished[EVP_MAX_MD_SIZE]; 530 unsigned char previous_client_finished[EVP_MAX_MD_SIZE];
533 unsigned char previous_client_finished_len; 531 unsigned char previous_client_finished_len;
534 unsigned char previous_server_finished[EVP_MAX_MD_SIZE]; 532 unsigned char previous_server_finished[EVP_MAX_MD_SIZE];
535 unsigned char previous_server_finished_len; 533 unsigned char previous_server_finished_len;
536 int send_connection_binding; /* TODOEKR */ 534 int send_connection_binding; /* TODOEKR */
537 535
538#ifndef OPENSSL_NO_NEXTPROTONEG 536#ifndef OPENSSL_NO_NEXTPROTONEG
539 /* Set if we saw the Next Protocol Negotiation extension from our peer. */ 537 /* Set if we saw the Next Protocol Negotiation extension from our peer.
538 */
540 int next_proto_neg_seen; 539 int next_proto_neg_seen;
541#endif 540#endif
542 541
@@ -548,7 +547,7 @@ typedef struct ssl3_state_st
548 char is_probably_safari; 547 char is_probably_safari;
549#endif /* !OPENSSL_NO_EC */ 548#endif /* !OPENSSL_NO_EC */
550#endif /* !OPENSSL_NO_TLSEXT */ 549#endif /* !OPENSSL_NO_TLSEXT */
551 } SSL3_STATE; 550} SSL3_STATE;
552 551
553#endif 552#endif
554 553
@@ -690,4 +689,3 @@ typedef struct ssl3_state_st
690} 689}
691#endif 690#endif
692#endif 691#endif
693
diff --git a/src/lib/libssl/src/ssl/ssl_locl.h b/src/lib/libssl/src/ssl/ssl_locl.h
index 7311d984ae..203a47480f 100644
--- a/src/lib/libssl/src/ssl/ssl_locl.h
+++ b/src/lib/libssl/src/ssl/ssl_locl.h
@@ -480,21 +480,19 @@
480#define NAMED_CURVE_TYPE 3 480#define NAMED_CURVE_TYPE 3
481#endif /* OPENSSL_NO_EC */ 481#endif /* OPENSSL_NO_EC */
482 482
483typedef struct cert_pkey_st 483typedef struct cert_pkey_st {
484 {
485 X509 *x509; 484 X509 *x509;
486 EVP_PKEY *privatekey; 485 EVP_PKEY *privatekey;
487 /* Digest to use when signing */ 486 /* Digest to use when signing */
488 const EVP_MD *digest; 487 const EVP_MD *digest;
489 } CERT_PKEY; 488} CERT_PKEY;
490 489
491typedef struct cert_st 490typedef struct cert_st {
492 {
493 /* Current active set */ 491 /* Current active set */
494 CERT_PKEY *key; /* ALWAYS points to an element of the pkeys array 492 CERT_PKEY *key; /* ALWAYS points to an element of the pkeys array
495 * Probably it would make more sense to store 493 * Probably it would make more sense to store
496 * an index, not a pointer. */ 494 * an index, not a pointer. */
497 495
498 /* The following masks are for the key and auth 496 /* The following masks are for the key and auth
499 * algorithms that are supported by the certs below */ 497 * algorithms that are supported by the certs below */
500 int valid; 498 int valid;
@@ -504,26 +502,25 @@ typedef struct cert_st
504 unsigned long export_mask_a; 502 unsigned long export_mask_a;
505#ifndef OPENSSL_NO_RSA 503#ifndef OPENSSL_NO_RSA
506 RSA *rsa_tmp; 504 RSA *rsa_tmp;
507 RSA *(*rsa_tmp_cb)(SSL *ssl,int is_export,int keysize); 505 RSA *(*rsa_tmp_cb)(SSL *ssl, int is_export, int keysize);
508#endif 506#endif
509#ifndef OPENSSL_NO_DH 507#ifndef OPENSSL_NO_DH
510 DH *dh_tmp; 508 DH *dh_tmp;
511 DH *(*dh_tmp_cb)(SSL *ssl,int is_export,int keysize); 509 DH *(*dh_tmp_cb)(SSL *ssl, int is_export, int keysize);
512#endif 510#endif
513#ifndef OPENSSL_NO_ECDH 511#ifndef OPENSSL_NO_ECDH
514 EC_KEY *ecdh_tmp; 512 EC_KEY *ecdh_tmp;
515 /* Callback for generating ephemeral ECDH keys */ 513 /* Callback for generating ephemeral ECDH keys */
516 EC_KEY *(*ecdh_tmp_cb)(SSL *ssl,int is_export,int keysize); 514 EC_KEY *(*ecdh_tmp_cb)(SSL *ssl, int is_export, int keysize);
517#endif 515#endif
518 516
519 CERT_PKEY pkeys[SSL_PKEY_NUM]; 517 CERT_PKEY pkeys[SSL_PKEY_NUM];
520 518
521 int references; /* >1 only if SSL_copy_session_id is used */ 519 int references; /* >1 only if SSL_copy_session_id is used */
522 } CERT; 520} CERT;
523 521
524 522
525typedef struct sess_cert_st 523typedef struct sess_cert_st {
526 {
527 STACK_OF(X509) *cert_chain; /* as received from peer (not for SSL2) */ 524 STACK_OF(X509) *cert_chain; /* as received from peer (not for SSL2) */
528 525
529 /* The 'peer_...' members are used only by clients. */ 526 /* The 'peer_...' members are used only by clients. */
@@ -545,7 +542,7 @@ typedef struct sess_cert_st
545#endif 542#endif
546 543
547 int references; /* actually always 1 at the moment */ 544 int references; /* actually always 1 at the moment */
548 } SESS_CERT; 545} SESS_CERT;
549 546
550 547
551/*#define MAC_DEBUG */ 548/*#define MAC_DEBUG */
@@ -568,12 +565,12 @@ typedef struct sess_cert_st
568/* This is for the SSLv3/TLSv1.0 differences in crypto/hash stuff 565/* This is for the SSLv3/TLSv1.0 differences in crypto/hash stuff
569 * It is a bit of a mess of functions, but hell, think of it as 566 * It is a bit of a mess of functions, but hell, think of it as
570 * an opaque structure :-) */ 567 * an opaque structure :-) */
571typedef struct ssl3_enc_method 568typedef struct ssl3_enc_method {
572 {
573 int (*enc)(SSL *, int); 569 int (*enc)(SSL *, int);
574 int (*mac)(SSL *, unsigned char *, int); 570 int (*mac)(SSL *, unsigned char *, int);
575 int (*setup_key_block)(SSL *); 571 int (*setup_key_block)(SSL *);
576 int (*generate_master_secret)(SSL *, unsigned char *, unsigned char *, int); 572 int (*generate_master_secret)(SSL *, unsigned char *,
573 unsigned char *, int);
577 int (*change_cipher_state)(SSL *, int); 574 int (*change_cipher_state)(SSL *, int);
578 int (*final_finish_mac)(SSL *, const char *, int, unsigned char *); 575 int (*final_finish_mac)(SSL *, const char *, int, unsigned char *);
579 int finish_mac_length; 576 int finish_mac_length;
@@ -584,33 +581,29 @@ typedef struct ssl3_enc_method
584 int server_finished_label_len; 581 int server_finished_label_len;
585 int (*alert_value)(int); 582 int (*alert_value)(int);
586 int (*export_keying_material)(SSL *, unsigned char *, size_t, 583 int (*export_keying_material)(SSL *, unsigned char *, size_t,
587 const char *, size_t, 584 const char *, size_t, const unsigned char *, size_t,
588 const unsigned char *, size_t, 585 int use_context);
589 int use_context); 586} SSL3_ENC_METHOD;
590 } SSL3_ENC_METHOD;
591 587
592#ifndef OPENSSL_NO_COMP 588#ifndef OPENSSL_NO_COMP
593/* Used for holding the relevant compression methods loaded into SSL_CTX */ 589/* Used for holding the relevant compression methods loaded into SSL_CTX */
594typedef struct ssl3_comp_st 590typedef struct ssl3_comp_st {
595 {
596 int comp_id; /* The identifier byte for this compression type */ 591 int comp_id; /* The identifier byte for this compression type */
597 char *name; /* Text name used for the compression type */ 592 char *name; /* Text name used for the compression type */
598 COMP_METHOD *method; /* The method :-) */ 593 COMP_METHOD *method; /* The method :-) */
599 } SSL3_COMP; 594} SSL3_COMP;
600#endif 595#endif
601 596
602#ifndef OPENSSL_NO_BUF_FREELISTS 597#ifndef OPENSSL_NO_BUF_FREELISTS
603typedef struct ssl3_buf_freelist_st 598typedef struct ssl3_buf_freelist_st {
604 {
605 size_t chunklen; 599 size_t chunklen;
606 unsigned int len; 600 unsigned int len;
607 struct ssl3_buf_freelist_entry_st *head; 601 struct ssl3_buf_freelist_entry_st *head;
608 } SSL3_BUF_FREELIST; 602} SSL3_BUF_FREELIST;
609 603
610typedef struct ssl3_buf_freelist_entry_st 604typedef struct ssl3_buf_freelist_entry_st {
611 {
612 struct ssl3_buf_freelist_entry_st *next; 605 struct ssl3_buf_freelist_entry_st *next;
613 } SSL3_BUF_FREELIST_ENTRY; 606} SSL3_BUF_FREELIST_ENTRY;
614#endif 607#endif
615 608
616extern SSL3_ENC_METHOD ssl3_undef_enc_method; 609extern SSL3_ENC_METHOD ssl3_undef_enc_method;
@@ -822,32 +815,33 @@ SESS_CERT *ssl_sess_cert_new(void);
822void ssl_sess_cert_free(SESS_CERT *sc); 815void ssl_sess_cert_free(SESS_CERT *sc);
823int ssl_set_peer_cert_type(SESS_CERT *c, int type); 816int ssl_set_peer_cert_type(SESS_CERT *c, int type);
824int ssl_get_new_session(SSL *s, int session); 817int ssl_get_new_session(SSL *s, int session);
825int ssl_get_prev_session(SSL *s, unsigned char *session,int len, const unsigned char *limit); 818int ssl_get_prev_session(SSL *s, unsigned char *session, int len,
826int ssl_cipher_id_cmp(const SSL_CIPHER *a,const SSL_CIPHER *b); 819 const unsigned char *limit);
827DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, 820int ssl_cipher_id_cmp(const SSL_CIPHER *a, const SSL_CIPHER *b);
828 ssl_cipher_id); 821DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, ssl_cipher_id);
829int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap, 822int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap,
830 const SSL_CIPHER * const *bp); 823 const SSL_CIPHER * const *bp);
831STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num, 824STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, unsigned char *p,
832 STACK_OF(SSL_CIPHER) **skp); 825 int num, STACK_OF(SSL_CIPHER) **skp);
833int ssl_cipher_list_to_bytes(SSL *s,STACK_OF(SSL_CIPHER) *sk,unsigned char *p, 826int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk,
834 int (*put_cb)(const SSL_CIPHER *, unsigned char *)); 827 unsigned char *p, int (*put_cb)(const SSL_CIPHER *, unsigned char *));
835STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth, 828STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth,
836 STACK_OF(SSL_CIPHER) **pref, 829 STACK_OF(SSL_CIPHER) **pref, STACK_OF(SSL_CIPHER) **sorted,
837 STACK_OF(SSL_CIPHER) **sorted, 830 const char *rule_str);
838 const char *rule_str);
839void ssl_update_cache(SSL *s, int mode); 831void ssl_update_cache(SSL *s, int mode);
840int ssl_cipher_get_evp(const SSL_SESSION *s,const EVP_CIPHER **enc, 832int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc,
841 const EVP_MD **md,int *mac_pkey_type,int *mac_secret_size, SSL_COMP **comp); 833 const EVP_MD **md, int *mac_pkey_type, int *mac_secret_size,
842int ssl_get_handshake_digest(int i,long *mask,const EVP_MD **md); 834 SSL_COMP **comp);
843int ssl_verify_cert_chain(SSL *s,STACK_OF(X509) *sk); 835int ssl_get_handshake_digest(int i, long *mask, const EVP_MD **md);
836
837int ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk);
844int ssl_undefined_function(SSL *s); 838int ssl_undefined_function(SSL *s);
845int ssl_undefined_void_function(void); 839int ssl_undefined_void_function(void);
846int ssl_undefined_const_function(const SSL *s); 840int ssl_undefined_const_function(const SSL *s);
847CERT_PKEY *ssl_get_server_send_pkey(const SSL *s); 841CERT_PKEY *ssl_get_server_send_pkey(const SSL *s);
848X509 *ssl_get_server_send_cert(const SSL *); 842X509 *ssl_get_server_send_cert(const SSL *);
849EVP_PKEY *ssl_get_sign_pkey(SSL *s,const SSL_CIPHER *c, const EVP_MD **pmd); 843EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *c, const EVP_MD **pmd);
850int ssl_cert_type(X509 *x,EVP_PKEY *pkey); 844int ssl_cert_type(X509 *x, EVP_PKEY *pkey);
851void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher); 845void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher);
852STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s); 846STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s);
853int ssl_verify_alarm_type(long type); 847int ssl_verify_alarm_type(long type);
@@ -856,14 +850,14 @@ int ssl_fill_hello_random(SSL *s, int server, unsigned char *field, int len);
856 850
857int ssl2_enc_init(SSL *s, int client); 851int ssl2_enc_init(SSL *s, int client);
858int ssl2_generate_key_material(SSL *s); 852int ssl2_generate_key_material(SSL *s);
859void ssl2_enc(SSL *s,int send_data); 853void ssl2_enc(SSL *s, int send_data);
860void ssl2_mac(SSL *s,unsigned char *mac,int send_data); 854void ssl2_mac(SSL *s, unsigned char *mac, int send_data);
861const SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p); 855const SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p);
862int ssl2_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p); 856int ssl2_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
863int ssl2_part_read(SSL *s, unsigned long f, int i); 857int ssl2_part_read(SSL *s, unsigned long f, int i);
864int ssl2_do_write(SSL *s); 858int ssl2_do_write(SSL *s);
865int ssl2_set_certificate(SSL *s, int type, int len, const unsigned char *data); 859int ssl2_set_certificate(SSL *s, int type, int len, const unsigned char *data);
866void ssl2_return_error(SSL *s,int reason); 860void ssl2_return_error(SSL *s, int reason);
867void ssl2_write_error(SSL *s); 861void ssl2_write_error(SSL *s);
868int ssl2_num_ciphers(void); 862int ssl2_num_ciphers(void);
869const SSL_CIPHER *ssl2_get_cipher(unsigned int u); 863const SSL_CIPHER *ssl2_get_cipher(unsigned int u);
@@ -876,47 +870,50 @@ int ssl2_peek(SSL *s, void *buf, int len);
876int ssl2_write(SSL *s, const void *buf, int len); 870int ssl2_write(SSL *s, const void *buf, int len);
877int ssl2_shutdown(SSL *s); 871int ssl2_shutdown(SSL *s);
878void ssl2_clear(SSL *s); 872void ssl2_clear(SSL *s);
879long ssl2_ctrl(SSL *s,int cmd, long larg, void *parg); 873long ssl2_ctrl(SSL *s, int cmd, long larg, void *parg);
880long ssl2_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg); 874long ssl2_ctx_ctrl(SSL_CTX *s, int cmd, long larg, void *parg);
881long ssl2_callback_ctrl(SSL *s,int cmd, void (*fp)(void)); 875long ssl2_callback_ctrl(SSL *s, int cmd, void (*fp)(void));
882long ssl2_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)(void)); 876long ssl2_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp)(void));
883int ssl2_pending(const SSL *s); 877int ssl2_pending(const SSL *s);
884long ssl2_default_timeout(void ); 878long ssl2_default_timeout(void );
885 879
886const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p); 880const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p);
887int ssl3_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p); 881int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
888void ssl3_init_finished_mac(SSL *s); 882void ssl3_init_finished_mac(SSL *s);
889int ssl3_send_server_certificate(SSL *s); 883int ssl3_send_server_certificate(SSL *s);
890int ssl3_send_newsession_ticket(SSL *s); 884int ssl3_send_newsession_ticket(SSL *s);
891int ssl3_send_cert_status(SSL *s); 885int ssl3_send_cert_status(SSL *s);
892int ssl3_get_finished(SSL *s,int state_a,int state_b); 886int ssl3_get_finished(SSL *s, int state_a, int state_b);
893int ssl3_setup_key_block(SSL *s); 887int ssl3_setup_key_block(SSL *s);
894int ssl3_send_change_cipher_spec(SSL *s,int state_a,int state_b); 888int ssl3_send_change_cipher_spec(SSL *s, int state_a, int state_b);
895int ssl3_change_cipher_state(SSL *s,int which); 889int ssl3_change_cipher_state(SSL *s, int which);
896void ssl3_cleanup_key_block(SSL *s); 890void ssl3_cleanup_key_block(SSL *s);
897int ssl3_do_write(SSL *s,int type); 891int ssl3_do_write(SSL *s, int type);
898int ssl3_send_alert(SSL *s,int level, int desc); 892int ssl3_send_alert(SSL *s, int level, int desc);
899int ssl3_generate_master_secret(SSL *s, unsigned char *out, 893int ssl3_generate_master_secret(SSL *s, unsigned char *out,
900 unsigned char *p, int len); 894 unsigned char *p, int len);
901int ssl3_get_req_cert_type(SSL *s,unsigned char *p); 895int ssl3_get_req_cert_type(SSL *s, unsigned char *p);
902long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok); 896long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok);
903int ssl3_send_finished(SSL *s, int a, int b, const char *sender,int slen); 897int ssl3_send_finished(SSL *s, int a, int b, const char *sender, int slen);
904int ssl3_num_ciphers(void); 898int ssl3_num_ciphers(void);
905const SSL_CIPHER *ssl3_get_cipher(unsigned int u); 899const SSL_CIPHER *ssl3_get_cipher(unsigned int u);
906int ssl3_renegotiate(SSL *ssl); 900int ssl3_renegotiate(SSL *ssl);
907int ssl3_renegotiate_check(SSL *ssl); 901
902int ssl3_renegotiate_check(SSL *ssl);
903
908int ssl3_dispatch_alert(SSL *s); 904int ssl3_dispatch_alert(SSL *s);
909int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); 905int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek);
910int ssl3_write_bytes(SSL *s, int type, const void *buf, int len); 906int ssl3_write_bytes(SSL *s, int type, const void *buf, int len);
911int ssl3_final_finish_mac(SSL *s, const char *sender, int slen,unsigned char *p); 907int ssl3_final_finish_mac(SSL *s, const char *sender, int slen,
908 unsigned char *p);
912int ssl3_cert_verify_mac(SSL *s, int md_nid, unsigned char *p); 909int ssl3_cert_verify_mac(SSL *s, int md_nid, unsigned char *p);
913void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len); 910void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len);
914int ssl3_enc(SSL *s, int send_data); 911int ssl3_enc(SSL *s, int send_data);
915int n_ssl3_mac(SSL *ssl, unsigned char *md, int send_data); 912int n_ssl3_mac(SSL *ssl, unsigned char *md, int send_data);
916void ssl3_free_digest_list(SSL *s); 913void ssl3_free_digest_list(SSL *s);
917unsigned long ssl3_output_cert_chain(SSL *s, X509 *x); 914unsigned long ssl3_output_cert_chain(SSL *s, X509 *x);
918SSL_CIPHER *ssl3_choose_cipher(SSL *ssl,STACK_OF(SSL_CIPHER) *clnt, 915SSL_CIPHER *ssl3_choose_cipher(SSL *ssl, STACK_OF(SSL_CIPHER) *clnt,
919 STACK_OF(SSL_CIPHER) *srvr); 916 STACK_OF(SSL_CIPHER) *srvr);
920int ssl3_setup_buffers(SSL *s); 917int ssl3_setup_buffers(SSL *s);
921int ssl3_setup_read_buffer(SSL *s); 918int ssl3_setup_read_buffer(SSL *s);
922int ssl3_setup_write_buffer(SSL *s); 919int ssl3_setup_write_buffer(SSL *s);
@@ -932,10 +929,10 @@ int ssl3_peek(SSL *s, void *buf, int len);
932int ssl3_write(SSL *s, const void *buf, int len); 929int ssl3_write(SSL *s, const void *buf, int len);
933int ssl3_shutdown(SSL *s); 930int ssl3_shutdown(SSL *s);
934void ssl3_clear(SSL *s); 931void ssl3_clear(SSL *s);
935long ssl3_ctrl(SSL *s,int cmd, long larg, void *parg); 932long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg);
936long ssl3_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg); 933long ssl3_ctx_ctrl(SSL_CTX *s, int cmd, long larg, void *parg);
937long ssl3_callback_ctrl(SSL *s,int cmd, void (*fp)(void)); 934long ssl3_callback_ctrl(SSL *s, int cmd, void (*fp)(void));
938long ssl3_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)(void)); 935long ssl3_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp)(void));
939int ssl3_pending(const SSL *s); 936int ssl3_pending(const SSL *s);
940 937
941void ssl3_record_sequence_update(unsigned char *seq); 938void ssl3_record_sequence_update(unsigned char *seq);
@@ -952,16 +949,16 @@ const SSL_CIPHER *ssl23_get_cipher_by_char(const unsigned char *p);
952long ssl23_default_timeout(void ); 949long ssl23_default_timeout(void );
953 950
954long tls1_default_timeout(void); 951long tls1_default_timeout(void);
955int dtls1_do_write(SSL *s,int type); 952int dtls1_do_write(SSL *s, int type);
956int ssl3_read_n(SSL *s, int n, int max, int extend); 953int ssl3_read_n(SSL *s, int n, int max, int extend);
957int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); 954int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek);
958int ssl3_do_compress(SSL *ssl); 955int ssl3_do_compress(SSL *ssl);
959int ssl3_do_uncompress(SSL *ssl); 956int ssl3_do_uncompress(SSL *ssl);
960int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, 957int ssl3_write_pending(SSL *s, int type, const unsigned char *buf,
961 unsigned int len); 958 unsigned int len);
962unsigned char *dtls1_set_message_header(SSL *s, 959unsigned char *dtls1_set_message_header(SSL *s, unsigned char *p,
963 unsigned char *p, unsigned char mt, unsigned long len, 960 unsigned char mt, unsigned long len, unsigned long frag_off,
964 unsigned long frag_off, unsigned long frag_len); 961 unsigned long frag_len);
965 962
966int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf, int len); 963int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf, int len);
967int dtls1_write_bytes(SSL *s, int type, const void *buf, int len); 964int dtls1_write_bytes(SSL *s, int type, const void *buf, int len);
@@ -971,8 +968,8 @@ int dtls1_send_finished(SSL *s, int a, int b, const char *sender, int slen);
971unsigned long dtls1_output_cert_chain(SSL *s, X509 *x); 968unsigned long dtls1_output_cert_chain(SSL *s, X509 *x);
972int dtls1_read_failed(SSL *s, int code); 969int dtls1_read_failed(SSL *s, int code);
973int dtls1_buffer_message(SSL *s, int ccs); 970int dtls1_buffer_message(SSL *s, int ccs);
974int dtls1_retransmit_message(SSL *s, unsigned short seq, 971int dtls1_retransmit_message(SSL *s, unsigned short seq,
975 unsigned long frag_off, int *found); 972 unsigned long frag_off, int *found);
976int dtls1_get_queue_priority(unsigned short seq, int is_ccs); 973int dtls1_get_queue_priority(unsigned short seq, int is_ccs);
977int dtls1_retransmit_buffered_messages(SSL *s); 974int dtls1_retransmit_buffered_messages(SSL *s);
978void dtls1_clear_record_buffer(SSL *s); 975void dtls1_clear_record_buffer(SSL *s);
@@ -1049,21 +1046,21 @@ int ssl23_write_bytes(SSL *s);
1049int tls1_new(SSL *s); 1046int tls1_new(SSL *s);
1050void tls1_free(SSL *s); 1047void tls1_free(SSL *s);
1051void tls1_clear(SSL *s); 1048void tls1_clear(SSL *s);
1052long tls1_ctrl(SSL *s,int cmd, long larg, void *parg); 1049long tls1_ctrl(SSL *s, int cmd, long larg, void *parg);
1053long tls1_callback_ctrl(SSL *s,int cmd, void (*fp)(void)); 1050long tls1_callback_ctrl(SSL *s, int cmd, void (*fp)(void));
1054 1051
1055int dtls1_new(SSL *s); 1052int dtls1_new(SSL *s);
1056int dtls1_accept(SSL *s); 1053int dtls1_accept(SSL *s);
1057int dtls1_connect(SSL *s); 1054int dtls1_connect(SSL *s);
1058void dtls1_free(SSL *s); 1055void dtls1_free(SSL *s);
1059void dtls1_clear(SSL *s); 1056void dtls1_clear(SSL *s);
1060long dtls1_ctrl(SSL *s,int cmd, long larg, void *parg); 1057long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg);
1061int dtls1_shutdown(SSL *s); 1058int dtls1_shutdown(SSL *s);
1062 1059
1063long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok); 1060long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok);
1064int dtls1_get_record(SSL *s); 1061int dtls1_get_record(SSL *s);
1065int do_dtls1_write(SSL *s, int type, const unsigned char *buf, 1062int do_dtls1_write(SSL *s, int type, const unsigned char *buf,
1066 unsigned int len, int create_empty_fragement); 1063 unsigned int len, int create_empty_fragement);
1067int dtls1_dispatch_alert(SSL *s); 1064int dtls1_dispatch_alert(SSL *s);
1068int dtls1_enc(SSL *s, int snd); 1065int dtls1_enc(SSL *s, int snd);
1069 1066
@@ -1073,15 +1070,14 @@ void ssl_free_wbio_buffer(SSL *s);
1073int tls1_change_cipher_state(SSL *s, int which); 1070int tls1_change_cipher_state(SSL *s, int which);
1074int tls1_setup_key_block(SSL *s); 1071int tls1_setup_key_block(SSL *s);
1075int tls1_enc(SSL *s, int snd); 1072int tls1_enc(SSL *s, int snd);
1076int tls1_final_finish_mac(SSL *s, 1073int tls1_final_finish_mac(SSL *s, const char *str, int slen, unsigned char *p);
1077 const char *str, int slen, unsigned char *p);
1078int tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *p); 1074int tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *p);
1079int tls1_mac(SSL *ssl, unsigned char *md, int snd); 1075int tls1_mac(SSL *ssl, unsigned char *md, int snd);
1080int tls1_generate_master_secret(SSL *s, unsigned char *out, 1076int tls1_generate_master_secret(SSL *s, unsigned char *out,
1081 unsigned char *p, int len); 1077 unsigned char *p, int len);
1082int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, 1078int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen,
1083 const char *label, size_t llen, 1079 const char *label, size_t llen, const unsigned char *p, size_t plen,
1084 const unsigned char *p, size_t plen, int use_context); 1080 int use_context);
1085int tls1_alert_code(int code); 1081int tls1_alert_code(int code);
1086int ssl3_alert_code(int code); 1082int ssl3_alert_code(int code);
1087int ssl_ok(SSL *s); 1083int ssl_ok(SSL *s);
@@ -1098,10 +1094,16 @@ int tls1_ec_nid2curve_id(int nid);
1098#endif /* OPENSSL_NO_EC */ 1094#endif /* OPENSSL_NO_EC */
1099 1095
1100#ifndef OPENSSL_NO_TLSEXT 1096#ifndef OPENSSL_NO_TLSEXT
1101unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned char *limit); 1097unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p,
1102unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, unsigned char *limit); 1098 unsigned char *limit);
1103int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **data, unsigned char *d, int n, int *al); 1099
1104int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **data, unsigned char *d, int n, int *al); 1100unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p,
1101 unsigned char *limit);
1102
1103int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **data,
1104 unsigned char *d, int n, int *al);
1105int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **data,
1106 unsigned char *d, int n, int *al);
1105int ssl_prepare_clienthello_tlsext(SSL *s); 1107int ssl_prepare_clienthello_tlsext(SSL *s);
1106int ssl_prepare_serverhello_tlsext(SSL *s); 1108int ssl_prepare_serverhello_tlsext(SSL *s);
1107int ssl_check_clienthello_tlsext_early(SSL *s); 1109int ssl_check_clienthello_tlsext_early(SSL *s);
@@ -1114,60 +1116,53 @@ int ssl_check_serverhello_tlsext(SSL *s);
1114#define tlsext_tick_md EVP_sha256 1116#define tlsext_tick_md EVP_sha256
1115#endif 1117#endif
1116int tls1_process_ticket(SSL *s, unsigned char *session_id, int len, 1118int tls1_process_ticket(SSL *s, unsigned char *session_id, int len,
1117 const unsigned char *limit, SSL_SESSION **ret); 1119 const unsigned char *limit, SSL_SESSION **ret);
1118 1120
1119int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk, 1121int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk,
1120 const EVP_MD *md); 1122 const EVP_MD *md);
1121int tls12_get_sigid(const EVP_PKEY *pk); 1123int tls12_get_sigid(const EVP_PKEY *pk);
1122const EVP_MD *tls12_get_hash(unsigned char hash_alg); 1124const EVP_MD *tls12_get_hash(unsigned char hash_alg);
1123 1125
1124#endif 1126#endif
1125EVP_MD_CTX* ssl_replace_hash(EVP_MD_CTX **hash,const EVP_MD *md) ; 1127EVP_MD_CTX* ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md);
1126void ssl_clear_hash_ctx(EVP_MD_CTX **hash); 1128void ssl_clear_hash_ctx(EVP_MD_CTX **hash);
1127int ssl_add_serverhello_renegotiate_ext(SSL *s, unsigned char *p, int *len, 1129int ssl_add_serverhello_renegotiate_ext(SSL *s, unsigned char *p,
1128 int maxlen); 1130 int *len, int maxlen);
1129int ssl_parse_serverhello_renegotiate_ext(SSL *s, unsigned char *d, int len, 1131int ssl_parse_serverhello_renegotiate_ext(SSL *s, unsigned char *d,
1130 int *al); 1132 int len, int *al);
1131int ssl_add_clienthello_renegotiate_ext(SSL *s, unsigned char *p, int *len, 1133int ssl_add_clienthello_renegotiate_ext(SSL *s, unsigned char *p,
1132 int maxlen); 1134 int *len, int maxlen);
1133int ssl_parse_clienthello_renegotiate_ext(SSL *s, unsigned char *d, int len, 1135int ssl_parse_clienthello_renegotiate_ext(SSL *s, unsigned char *d,
1134 int *al); 1136 int len, int *al);
1135long ssl_get_algorithm2(SSL *s); 1137long ssl_get_algorithm2(SSL *s);
1136int tls1_process_sigalgs(SSL *s, const unsigned char *data, int dsize); 1138int tls1_process_sigalgs(SSL *s, const unsigned char *data, int dsize);
1137int tls12_get_req_sig_algs(SSL *s, unsigned char *p); 1139int tls12_get_req_sig_algs(SSL *s, unsigned char *p);
1138 1140
1139int ssl_add_clienthello_use_srtp_ext(SSL *s, unsigned char *p, int *len, int maxlen); 1141int ssl_add_clienthello_use_srtp_ext(SSL *s, unsigned char *p,
1140int ssl_parse_clienthello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al); 1142 int *len, int maxlen);
1141int ssl_add_serverhello_use_srtp_ext(SSL *s, unsigned char *p, int *len, int maxlen); 1143int ssl_parse_clienthello_use_srtp_ext(SSL *s, unsigned char *d,
1142int ssl_parse_serverhello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al); 1144 int len, int *al);
1145int ssl_add_serverhello_use_srtp_ext(SSL *s, unsigned char *p,
1146 int *len, int maxlen);
1147int ssl_parse_serverhello_use_srtp_ext(SSL *s, unsigned char *d,
1148 int len, int *al);
1143 1149
1144/* s3_cbc.c */ 1150/* s3_cbc.c */
1145void ssl3_cbc_copy_mac(unsigned char* out, 1151void ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec,
1146 const SSL3_RECORD *rec, 1152 unsigned md_size, unsigned orig_len);
1147 unsigned md_size,unsigned orig_len); 1153int ssl3_cbc_remove_padding(const SSL *s, SSL3_RECORD *rec,
1148int ssl3_cbc_remove_padding(const SSL* s, 1154 unsigned block_size, unsigned mac_size);
1149 SSL3_RECORD *rec, 1155int tls1_cbc_remove_padding(const SSL *s, SSL3_RECORD *rec,
1150 unsigned block_size, 1156 unsigned block_size, unsigned mac_size);
1151 unsigned mac_size);
1152int tls1_cbc_remove_padding(const SSL* s,
1153 SSL3_RECORD *rec,
1154 unsigned block_size,
1155 unsigned mac_size);
1156char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx); 1157char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx);
1157void ssl3_cbc_digest_record( 1158void ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, unsigned char *md_out,
1158 const EVP_MD_CTX *ctx, 1159 size_t *md_out_size, const unsigned char header[13],
1159 unsigned char* md_out, 1160 const unsigned char *data, size_t data_plus_mac_size,
1160 size_t* md_out_size, 1161 size_t data_plus_mac_plus_padding_size, const unsigned char *mac_secret,
1161 const unsigned char header[13], 1162 unsigned mac_secret_length, char is_sslv3);
1162 const unsigned char *data, 1163
1163 size_t data_plus_mac_size, 1164void tls_fips_digest_extra(const EVP_CIPHER_CTX *cipher_ctx,
1164 size_t data_plus_mac_plus_padding_size, 1165 EVP_MD_CTX *mac_ctx, const unsigned char *data, size_t data_len,
1165 const unsigned char *mac_secret, 1166 size_t orig_len);
1166 unsigned mac_secret_length,
1167 char is_sslv3);
1168
1169void tls_fips_digest_extra(
1170 const EVP_CIPHER_CTX *cipher_ctx, EVP_MD_CTX *mac_ctx,
1171 const unsigned char *data, size_t data_len, size_t orig_len);
1172 1167
1173#endif 1168#endif
diff --git a/src/lib/libssl/src/ssl/tls1.h b/src/lib/libssl/src/ssl/tls1.h
index 7e35f13849..95d6660ac3 100644
--- a/src/lib/libssl/src/ssl/tls1.h
+++ b/src/lib/libssl/src/ssl/tls1.h
@@ -240,9 +240,9 @@ extern "C" {
240#define TLSEXT_TYPE_session_ticket 35 240#define TLSEXT_TYPE_session_ticket 35
241 241
242/* ExtensionType value from draft-rescorla-tls-opaque-prf-input-00.txt */ 242/* ExtensionType value from draft-rescorla-tls-opaque-prf-input-00.txt */
243#if 0 /* will have to be provided externally for now , 243#if 0 /* will have to be provided externally for now ,
244 * i.e. build with -DTLSEXT_TYPE_opaque_prf_input=38183 244 * i.e. build with - DTLSEXT_TYPE_opaque_prf_input = 38183
245 * using whatever extension number you'd like to try */ 245 * using whatever extension number you'd like to try */
246# define TLSEXT_TYPE_opaque_prf_input ?? */ 246# define TLSEXT_TYPE_opaque_prf_input ?? */
247#endif 247#endif
248 248
@@ -295,8 +295,8 @@ int SSL_get_servername_type(const SSL *s);
295 * It returns 1 on success and zero otherwise. 295 * It returns 1 on success and zero otherwise.
296 */ 296 */
297int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen, 297int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen,
298 const char *label, size_t llen, const unsigned char *p, size_t plen, 298 const char *label, size_t llen, const unsigned char *p, size_t plen,
299 int use_context); 299 int use_context);
300 300
301#define SSL_set_tlsext_host_name(s,name) \ 301#define SSL_set_tlsext_host_name(s,name) \
302SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,(char *)name) 302SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,(char *)name)
@@ -719,11 +719,10 @@ SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,(void (*)(void))cb)
719#endif 719#endif
720 720
721/* TLS Session Ticket extension struct */ 721/* TLS Session Ticket extension struct */
722struct tls_session_ticket_ext_st 722struct tls_session_ticket_ext_st {
723 {
724 unsigned short length; 723 unsigned short length;
725 void *data; 724 void *data;
726 }; 725};
727 726
728#ifdef __cplusplus 727#ifdef __cplusplus
729} 728}
diff --git a/src/lib/libssl/srtp.h b/src/lib/libssl/srtp.h
index c0cf33ef28..06075f2c86 100644
--- a/src/lib/libssl/srtp.h
+++ b/src/lib/libssl/srtp.h
@@ -122,7 +122,6 @@
122extern "C" { 122extern "C" {
123#endif 123#endif
124 124
125
126#define SRTP_AES128_CM_SHA1_80 0x0001 125#define SRTP_AES128_CM_SHA1_80 0x0001
127#define SRTP_AES128_CM_SHA1_32 0x0002 126#define SRTP_AES128_CM_SHA1_32 0x0002
128#define SRTP_AES128_F8_SHA1_80 0x0003 127#define SRTP_AES128_F8_SHA1_80 0x0003
@@ -142,4 +141,3 @@ SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s);
142#endif 141#endif
143 142
144#endif 143#endif
145
diff --git a/src/lib/libssl/ssl.h b/src/lib/libssl/ssl.h
index bf4b2f2cb6..97e4a3f96c 100644
--- a/src/lib/libssl/ssl.h
+++ b/src/lib/libssl/ssl.h
@@ -260,9 +260,9 @@ extern "C" {
260#define SSL_TXT_aKRB5 "aKRB5" 260#define SSL_TXT_aKRB5 "aKRB5"
261#define SSL_TXT_aECDSA "aECDSA" 261#define SSL_TXT_aECDSA "aECDSA"
262#define SSL_TXT_aPSK "aPSK" 262#define SSL_TXT_aPSK "aPSK"
263#define SSL_TXT_aGOST94 "aGOST94" 263#define SSL_TXT_aGOST94 "aGOST94"
264#define SSL_TXT_aGOST01 "aGOST01" 264#define SSL_TXT_aGOST01 "aGOST01"
265#define SSL_TXT_aGOST "aGOST" 265#define SSL_TXT_aGOST "aGOST"
266 266
267#define SSL_TXT_DSS "DSS" 267#define SSL_TXT_DSS "DSS"
268#define SSL_TXT_DH "DH" 268#define SSL_TXT_DH "DH"
@@ -369,23 +369,22 @@ typedef struct ssl_session_st SSL_SESSION;
369DECLARE_STACK_OF(SSL_CIPHER) 369DECLARE_STACK_OF(SSL_CIPHER)
370 370
371/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/ 371/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/
372typedef struct srtp_protection_profile_st 372typedef struct srtp_protection_profile_st {
373 { 373 const char *name;
374 const char *name; 374 unsigned long id;
375 unsigned long id; 375} SRTP_PROTECTION_PROFILE;
376 } SRTP_PROTECTION_PROFILE;
377 376
378DECLARE_STACK_OF(SRTP_PROTECTION_PROFILE) 377DECLARE_STACK_OF(SRTP_PROTECTION_PROFILE)
379 378
380typedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *data, int len, void *arg); 379typedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *data,
381typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len, STACK_OF(SSL_CIPHER) *peer_ciphers, SSL_CIPHER **cipher, void *arg); 380 int len, void *arg);
382 381typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len,
382 STACK_OF(SSL_CIPHER) *peer_ciphers, SSL_CIPHER **cipher, void *arg);
383 383
384#ifndef OPENSSL_NO_SSL_INTERN 384#ifndef OPENSSL_NO_SSL_INTERN
385 385
386/* used to hold info on the particular ciphers used */ 386/* used to hold info on the particular ciphers used */
387struct ssl_cipher_st 387struct ssl_cipher_st {
388 {
389 int valid; 388 int valid;
390 const char *name; /* text name */ 389 const char *name; /* text name */
391 unsigned long id; /* id, 4 bytes, first is version */ 390 unsigned long id; /* id, 4 bytes, first is version */
@@ -401,34 +400,33 @@ struct ssl_cipher_st
401 unsigned long algorithm2; /* Extra flags */ 400 unsigned long algorithm2; /* Extra flags */
402 int strength_bits; /* Number of bits really used */ 401 int strength_bits; /* Number of bits really used */
403 int alg_bits; /* Number of bits for algorithm */ 402 int alg_bits; /* Number of bits for algorithm */
404 }; 403};
405 404
406 405
407/* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */ 406/* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */
408struct ssl_method_st 407struct ssl_method_st {
409 {
410 int version; 408 int version;
411 int (*ssl_new)(SSL *s); 409 int (*ssl_new)(SSL *s);
412 void (*ssl_clear)(SSL *s); 410 void (*ssl_clear)(SSL *s);
413 void (*ssl_free)(SSL *s); 411 void (*ssl_free)(SSL *s);
414 int (*ssl_accept)(SSL *s); 412 int (*ssl_accept)(SSL *s);
415 int (*ssl_connect)(SSL *s); 413 int (*ssl_connect)(SSL *s);
416 int (*ssl_read)(SSL *s,void *buf,int len); 414 int (*ssl_read)(SSL *s, void *buf, int len);
417 int (*ssl_peek)(SSL *s,void *buf,int len); 415 int (*ssl_peek)(SSL *s, void *buf, int len);
418 int (*ssl_write)(SSL *s,const void *buf,int len); 416 int (*ssl_write)(SSL *s, const void *buf, int len);
419 int (*ssl_shutdown)(SSL *s); 417 int (*ssl_shutdown)(SSL *s);
420 int (*ssl_renegotiate)(SSL *s); 418 int (*ssl_renegotiate)(SSL *s);
421 int (*ssl_renegotiate_check)(SSL *s); 419 int (*ssl_renegotiate_check)(SSL *s);
422 long (*ssl_get_message)(SSL *s, int st1, int stn, int mt, long 420 long (*ssl_get_message)(SSL *s, int st1, int stn, int mt,
423 max, int *ok); 421 long max, int *ok);
424 int (*ssl_read_bytes)(SSL *s, int type, unsigned char *buf, int len, 422 int (*ssl_read_bytes)(SSL *s, int type, unsigned char *buf,
425 int peek); 423 int len, int peek);
426 int (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len); 424 int (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len);
427 int (*ssl_dispatch_alert)(SSL *s); 425 int (*ssl_dispatch_alert)(SSL *s);
428 long (*ssl_ctrl)(SSL *s,int cmd,long larg,void *parg); 426 long (*ssl_ctrl)(SSL *s, int cmd, long larg, void *parg);
429 long (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,void *parg); 427 long (*ssl_ctx_ctrl)(SSL_CTX *ctx, int cmd, long larg, void *parg);
430 const SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr); 428 const SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr);
431 int (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr); 429 int (*put_cipher_by_char)(const SSL_CIPHER *cipher, unsigned char *ptr);
432 int (*ssl_pending)(const SSL *s); 430 int (*ssl_pending)(const SSL *s);
433 int (*num_ciphers)(void); 431 int (*num_ciphers)(void);
434 const SSL_CIPHER *(*get_cipher)(unsigned ncipher); 432 const SSL_CIPHER *(*get_cipher)(unsigned ncipher);
@@ -438,7 +436,7 @@ struct ssl_method_st
438 int (*ssl_version)(void); 436 int (*ssl_version)(void);
439 long (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)(void)); 437 long (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)(void));
440 long (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)(void)); 438 long (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)(void));
441 }; 439};
442 440
443/* Lets make this into an ASN.1 type structure as follows 441/* Lets make this into an ASN.1 type structure as follows
444 * SSL_SESSION_ID ::= SEQUENCE { 442 * SSL_SESSION_ID ::= SEQUENCE {
@@ -465,8 +463,7 @@ struct ssl_method_st
465 * Look in ssl/ssl_asn1.c for more details 463 * Look in ssl/ssl_asn1.c for more details
466 * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-). 464 * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-).
467 */ 465 */
468struct ssl_session_st 466struct ssl_session_st {
469 {
470 int ssl_version; /* what ssl version session info is 467 int ssl_version; /* what ssl version session info is
471 * being kept in here? */ 468 * being kept in here? */
472 469
@@ -485,8 +482,8 @@ struct ssl_session_st
485 unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; 482 unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
486 483
487#ifndef OPENSSL_NO_KRB5 484#ifndef OPENSSL_NO_KRB5
488 unsigned int krb5_client_princ_len; 485 unsigned int krb5_client_princ_len;
489 unsigned char krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH]; 486 unsigned char krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH];
490#endif /* OPENSSL_NO_KRB5 */ 487#endif /* OPENSSL_NO_KRB5 */
491#ifndef OPENSSL_NO_PSK 488#ifndef OPENSSL_NO_PSK
492 char *psk_identity_hint; 489 char *psk_identity_hint;
@@ -526,7 +523,7 @@ struct ssl_session_st
526 523
527 /* These are used to make removal of session-ids more 524 /* These are used to make removal of session-ids more
528 * efficient and to implement a maximum cache size. */ 525 * efficient and to implement a maximum cache size. */
529 struct ssl_session_st *prev,*next; 526 struct ssl_session_st *prev, *next;
530#ifndef OPENSSL_NO_TLSEXT 527#ifndef OPENSSL_NO_TLSEXT
531 char *tlsext_hostname; 528 char *tlsext_hostname;
532#ifndef OPENSSL_NO_EC 529#ifndef OPENSSL_NO_EC
@@ -543,7 +540,7 @@ struct ssl_session_st
543#ifndef OPENSSL_NO_SRP 540#ifndef OPENSSL_NO_SRP
544 char *srp_username; 541 char *srp_username;
545#endif 542#endif
546 }; 543};
547 544
548#endif 545#endif
549 546
@@ -684,8 +681,11 @@ struct ssl_session_st
684#define SSL_get_secure_renegotiation_support(ssl) \ 681#define SSL_get_secure_renegotiation_support(ssl) \
685 SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL) 682 SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL)
686 683
687void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); 684void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p,
688void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); 685 int version, int content_type, const void *buf, size_t len, SSL *ssl,
686 void *arg));
687void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version,
688 int content_type, const void *buf, size_t len, SSL *ssl, void *arg));
689#define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) 689#define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg))
690#define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) 690#define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg))
691 691
@@ -693,8 +693,7 @@ void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int con
693 693
694#ifndef OPENSSL_NO_SSL_INTERN 694#ifndef OPENSSL_NO_SSL_INTERN
695 695
696typedef struct srp_ctx_st 696typedef struct srp_ctx_st {
697 {
698 /* param for all the callbacks */ 697 /* param for all the callbacks */
699 void *SRP_cb_arg; 698 void *SRP_cb_arg;
700 /* set client Hello login callback */ 699 /* set client Hello login callback */
@@ -705,13 +704,13 @@ typedef struct srp_ctx_st
705 char *(*SRP_give_srp_client_pwd_callback)(SSL *, void *); 704 char *(*SRP_give_srp_client_pwd_callback)(SSL *, void *);
706 705
707 char *login; 706 char *login;
708 BIGNUM *N,*g,*s,*B,*A; 707 BIGNUM *N, *g, *s, *B, *A;
709 BIGNUM *a,*b,*v; 708 BIGNUM *a, *b, *v;
710 char *info; 709 char *info;
711 int strength; 710 int strength;
712 711
713 unsigned long srp_Mask; 712 unsigned long srp_Mask;
714 } SRP_CTX; 713} SRP_CTX;
715 714
716#endif 715#endif
717 716
@@ -721,9 +720,9 @@ int SSL_CTX_SRP_CTX_init(SSL_CTX *ctx);
721int SSL_SRP_CTX_free(SSL *ctx); 720int SSL_SRP_CTX_free(SSL *ctx);
722int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx); 721int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx);
723int SSL_srp_server_param_with_username(SSL *s, int *ad); 722int SSL_srp_server_param_with_username(SSL *s, int *ad);
724int SRP_generate_server_master_secret(SSL *s,unsigned char *master_key); 723int SRP_generate_server_master_secret(SSL *s, unsigned char *master_key);
725int SRP_Calc_A_param(SSL *s); 724int SRP_Calc_A_param(SSL *s);
726int SRP_generate_client_master_secret(SSL *s,unsigned char *master_key); 725int SRP_generate_client_master_secret(SSL *s, unsigned char *master_key);
727 726
728#endif 727#endif
729 728
@@ -745,14 +744,13 @@ int SRP_generate_client_master_secret(SSL *s,unsigned char *master_key);
745 * returns in this case. It is also an error for the callback to set the size to 744 * returns in this case. It is also an error for the callback to set the size to
746 * zero. */ 745 * zero. */
747typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id, 746typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id,
748 unsigned int *id_len); 747 unsigned int *id_len);
749 748
750typedef struct ssl_comp_st SSL_COMP; 749typedef struct ssl_comp_st SSL_COMP;
751 750
752#ifndef OPENSSL_NO_SSL_INTERN 751#ifndef OPENSSL_NO_SSL_INTERN
753 752
754struct ssl_comp_st 753struct ssl_comp_st {
755 {
756 int id; 754 int id;
757 const char *name; 755 const char *name;
758#ifndef OPENSSL_NO_COMP 756#ifndef OPENSSL_NO_COMP
@@ -760,13 +758,12 @@ struct ssl_comp_st
760#else 758#else
761 char *method; 759 char *method;
762#endif 760#endif
763 }; 761};
764 762
765DECLARE_STACK_OF(SSL_COMP) 763DECLARE_STACK_OF(SSL_COMP)
766DECLARE_LHASH_OF(SSL_SESSION); 764DECLARE_LHASH_OF(SSL_SESSION);
767 765
768struct ssl_ctx_st 766struct ssl_ctx_st {
769 {
770 const SSL_METHOD *method; 767 const SSL_METHOD *method;
771 768
772 STACK_OF(SSL_CIPHER) *cipher_list; 769 STACK_OF(SSL_CIPHER) *cipher_list;
@@ -801,13 +798,12 @@ struct ssl_ctx_st
801 * If remove_session_cb is not null, it will be called when 798 * If remove_session_cb is not null, it will be called when
802 * a session-id is removed from the cache. After the call, 799 * a session-id is removed from the cache. After the call,
803 * OpenSSL will SSL_SESSION_free() it. */ 800 * OpenSSL will SSL_SESSION_free() it. */
804 int (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess); 801 int (*new_session_cb)(struct ssl_st *ssl, SSL_SESSION *sess);
805 void (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess); 802 void (*remove_session_cb)(struct ssl_ctx_st *ctx, SSL_SESSION *sess);
806 SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, 803 SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl,
807 unsigned char *data,int len,int *copy); 804 unsigned char *data, int len, int *copy);
808 805
809 struct 806 struct {
810 {
811 int sess_connect; /* SSL new conn - started */ 807 int sess_connect; /* SSL new conn - started */
812 int sess_connect_renegotiate;/* SSL reneg - requested */ 808 int sess_connect_renegotiate;/* SSL reneg - requested */
813 int sess_connect_good; /* SSL new conne/reneg - finished */ 809 int sess_connect_good; /* SSL new conne/reneg - finished */
@@ -824,7 +820,7 @@ struct ssl_ctx_st
824 * indicates that the application is 820 * indicates that the application is
825 * supplying session-id's from other 821 * supplying session-id's from other
826 * processes - spooky :-) */ 822 * processes - spooky :-) */
827 } stats; 823 } stats;
828 824
829 int references; 825 int references;
830 826
@@ -843,19 +839,19 @@ struct ssl_ctx_st
843 /* get client cert callback */ 839 /* get client cert callback */
844 int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey); 840 int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey);
845 841
846 /* cookie generate callback */ 842 /* cookie generate callback */
847 int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie, 843 int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie,
848 unsigned int *cookie_len); 844 unsigned int *cookie_len);
849 845
850 /* verify cookie callback */ 846 /* verify cookie callback */
851 int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie, 847 int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie,
852 unsigned int cookie_len); 848 unsigned int cookie_len);
853 849
854 CRYPTO_EX_DATA ex_data; 850 CRYPTO_EX_DATA ex_data;
855 851
856 const EVP_MD *rsa_md5;/* For SSLv2 - name is 'ssl2-md5' */ 852 const EVP_MD *rsa_md5; /* For SSLv2 - name is 'ssl2-md5' */
857 const EVP_MD *md5; /* For SSLv3/TLSv1 'ssl3-md5' */ 853 const EVP_MD *md5; /* For SSLv3/TLSv1 'ssl3-md5' */
858 const EVP_MD *sha1; /* For SSLv3/TLSv1 'ssl3->sha1' */ 854 const EVP_MD *sha1; /* For SSLv3/TLSv1 'ssl3->sha1' */
859 855
860 STACK_OF(X509) *extra_certs; 856 STACK_OF(X509) *extra_certs;
861 STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */ 857 STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */
@@ -879,7 +875,8 @@ struct ssl_ctx_st
879 int read_ahead; 875 int read_ahead;
880 876
881 /* callback that allows applications to peek at protocol messages */ 877 /* callback that allows applications to peek at protocol messages */
882 void (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); 878 void (*msg_callback)(int write_p, int version, int content_type,
879 const void *buf, size_t len, SSL *ssl, void *arg);
883 void *msg_callback_arg; 880 void *msg_callback_arg;
884 881
885 int verify_mode; 882 int verify_mode;
@@ -920,10 +917,8 @@ struct ssl_ctx_st
920 unsigned char tlsext_tick_hmac_key[16]; 917 unsigned char tlsext_tick_hmac_key[16];
921 unsigned char tlsext_tick_aes_key[16]; 918 unsigned char tlsext_tick_aes_key[16];
922 /* Callback to support customisation of ticket key setting */ 919 /* Callback to support customisation of ticket key setting */
923 int (*tlsext_ticket_key_cb)(SSL *ssl, 920 int (*tlsext_ticket_key_cb)(SSL *ssl, unsigned char *name,
924 unsigned char *name, unsigned char *iv, 921 unsigned char *iv, EVP_CIPHER_CTX *ectx, HMAC_CTX *hctx, int enc);
925 EVP_CIPHER_CTX *ectx,
926 HMAC_CTX *hctx, int enc);
927 922
928 /* certificate status request info */ 923 /* certificate status request info */
929 /* Callback for status request */ 924 /* Callback for status request */
@@ -931,17 +926,18 @@ struct ssl_ctx_st
931 void *tlsext_status_arg; 926 void *tlsext_status_arg;
932 927
933 /* draft-rescorla-tls-opaque-prf-input-00.txt information */ 928 /* draft-rescorla-tls-opaque-prf-input-00.txt information */
934 int (*tlsext_opaque_prf_input_callback)(SSL *, void *peerinput, size_t len, void *arg); 929 int (*tlsext_opaque_prf_input_callback)(SSL *, void *peerinput,
930 size_t len, void *arg);
935 void *tlsext_opaque_prf_input_callback_arg; 931 void *tlsext_opaque_prf_input_callback_arg;
936#endif 932#endif
937 933
938#ifndef OPENSSL_NO_PSK 934#ifndef OPENSSL_NO_PSK
939 char *psk_identity_hint; 935 char *psk_identity_hint;
940 unsigned int (*psk_client_callback)(SSL *ssl, const char *hint, char *identity, 936 unsigned int (*psk_client_callback)(SSL *ssl, const char *hint,
941 unsigned int max_identity_len, unsigned char *psk, 937 char *identity, unsigned int max_identity_len, unsigned char *psk,
942 unsigned int max_psk_len); 938 unsigned int max_psk_len);
943 unsigned int (*psk_server_callback)(SSL *ssl, const char *identity, 939 unsigned int (*psk_server_callback)(SSL *ssl, const char *identity,
944 unsigned char *psk, unsigned int max_psk_len); 940 unsigned char *psk, unsigned int max_psk_len);
945#endif 941#endif
946 942
947#ifndef OPENSSL_NO_BUF_FREELISTS 943#ifndef OPENSSL_NO_BUF_FREELISTS
@@ -963,21 +959,20 @@ struct ssl_ctx_st
963 /* For a server, this contains a callback function by which the set of 959 /* For a server, this contains a callback function by which the set of
964 * advertised protocols can be provided. */ 960 * advertised protocols can be provided. */
965 int (*next_protos_advertised_cb)(SSL *s, const unsigned char **buf, 961 int (*next_protos_advertised_cb)(SSL *s, const unsigned char **buf,
966 unsigned int *len, void *arg); 962 unsigned int *len, void *arg);
967 void *next_protos_advertised_cb_arg; 963 void *next_protos_advertised_cb_arg;
968 /* For a client, this contains a callback function that selects the 964 /* For a client, this contains a callback function that selects the
969 * next protocol from the list provided by the server. */ 965 * next protocol from the list provided by the server. */
970 int (*next_proto_select_cb)(SSL *s, unsigned char **out, 966 int (*next_proto_select_cb)(SSL *s, unsigned char **out,
971 unsigned char *outlen, 967 unsigned char *outlen, const unsigned char *in,
972 const unsigned char *in, 968 unsigned int inlen, void *arg);
973 unsigned int inlen,
974 void *arg);
975 void *next_proto_select_cb_arg; 969 void *next_proto_select_cb_arg;
976# endif 970# endif
977 /* SRTP profiles we are willing to do from RFC 5764 */ 971 /* SRTP profiles we are willing to do from RFC 5764 */
978 STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; 972 STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles;
973
979#endif 974#endif
980 }; 975};
981 976
982#endif 977#endif
983 978
@@ -1018,42 +1013,49 @@ LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx);
1018#define SSL_CTX_sess_cache_full(ctx) \ 1013#define SSL_CTX_sess_cache_full(ctx) \
1019 SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL) 1014 SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL)
1020 1015
1021void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, int (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess)); 1016void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx,
1022int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(struct ssl_st *ssl, SSL_SESSION *sess); 1017 int (*new_session_cb)(struct ssl_st *ssl, SSL_SESSION *sess));
1023void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, void (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess)); 1018int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(struct ssl_st *ssl,
1024void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx, SSL_SESSION *sess); 1019 SSL_SESSION *sess);
1025void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, unsigned char *data,int len,int *copy)); 1020void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx,
1026SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl, unsigned char *Data, int len, int *copy); 1021 void (*remove_session_cb)(struct ssl_ctx_st *ctx, SSL_SESSION *sess));
1027void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb)(const SSL *ssl,int type,int val)); 1022void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx,
1028void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(const SSL *ssl,int type,int val); 1023 SSL_SESSION *sess);
1029void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)); 1024void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
1030int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey); 1025 SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, unsigned char *data,
1026 int len, int *copy));
1027SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl,
1028 unsigned char *Data, int len, int *copy);
1029void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb)(const SSL *ssl,
1030 int type, int val));
1031void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(const SSL *ssl, int type,
1032 int val);
1033void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx,
1034 int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey));
1035int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509,
1036 EVP_PKEY **pkey);
1031#ifndef OPENSSL_NO_ENGINE 1037#ifndef OPENSSL_NO_ENGINE
1032int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e); 1038int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e);
1033#endif 1039#endif
1034void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie, unsigned int *cookie_len)); 1040void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx,
1035void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie, unsigned int cookie_len)); 1041 int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie,
1042 unsigned int *cookie_len));
1043void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx,
1044 int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie,
1045 unsigned int cookie_len));
1036#ifndef OPENSSL_NO_NEXTPROTONEG 1046#ifndef OPENSSL_NO_NEXTPROTONEG
1037void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, 1047void
1038 int (*cb) (SSL *ssl, 1048SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, int (*cb)(SSL *ssl,
1039 const unsigned char **out, 1049 const unsigned char **out, unsigned int *outlen, void *arg), void *arg);
1040 unsigned int *outlen, 1050void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s, int (*cb)(SSL *ssl,
1041 void *arg), 1051 unsigned char **out, unsigned char *outlen, const unsigned char *in,
1042 void *arg); 1052 unsigned int inlen, void *arg), void *arg);
1043void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s,
1044 int (*cb) (SSL *ssl,
1045 unsigned char **out,
1046 unsigned char *outlen,
1047 const unsigned char *in,
1048 unsigned int inlen,
1049 void *arg),
1050 void *arg);
1051 1053
1052int SSL_select_next_proto(unsigned char **out, unsigned char *outlen, 1054int SSL_select_next_proto(unsigned char **out, unsigned char *outlen,
1053 const unsigned char *in, unsigned int inlen, 1055 const unsigned char *in, unsigned int inlen, const unsigned char *client,
1054 const unsigned char *client, unsigned int client_len); 1056 unsigned int client_len);
1055void SSL_get0_next_proto_negotiated(const SSL *s, 1057void SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data,
1056 const unsigned char **data, unsigned *len); 1058 unsigned *len);
1057 1059
1058#define OPENSSL_NPN_UNSUPPORTED 0 1060#define OPENSSL_NPN_UNSUPPORTED 0
1059#define OPENSSL_NPN_NEGOTIATED 1 1061#define OPENSSL_NPN_NEGOTIATED 1
@@ -1065,20 +1067,20 @@ void SSL_get0_next_proto_negotiated(const SSL *s,
1065 * resulting identity/psk */ 1067 * resulting identity/psk */
1066#define PSK_MAX_IDENTITY_LEN 128 1068#define PSK_MAX_IDENTITY_LEN 128
1067#define PSK_MAX_PSK_LEN 256 1069#define PSK_MAX_PSK_LEN 256
1068void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, 1070void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx,
1069 unsigned int (*psk_client_callback)(SSL *ssl, const char *hint, 1071 unsigned int (*psk_client_callback)(SSL *ssl, const char *hint,
1070 char *identity, unsigned int max_identity_len, unsigned char *psk, 1072 char *identity, unsigned int max_identity_len, unsigned char *psk,
1071 unsigned int max_psk_len)); 1073 unsigned int max_psk_len));
1072void SSL_set_psk_client_callback(SSL *ssl, 1074void SSL_set_psk_client_callback(SSL *ssl,
1073 unsigned int (*psk_client_callback)(SSL *ssl, const char *hint, 1075 unsigned int (*psk_client_callback)(SSL *ssl, const char *hint,
1074 char *identity, unsigned int max_identity_len, unsigned char *psk, 1076 char *identity, unsigned int max_identity_len, unsigned char *psk,
1075 unsigned int max_psk_len)); 1077 unsigned int max_psk_len));
1076void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, 1078void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx,
1077 unsigned int (*psk_server_callback)(SSL *ssl, const char *identity, 1079 unsigned int (*psk_server_callback)(SSL *ssl, const char *identity,
1078 unsigned char *psk, unsigned int max_psk_len)); 1080 unsigned char *psk, unsigned int max_psk_len));
1079void SSL_set_psk_server_callback(SSL *ssl, 1081void SSL_set_psk_server_callback(SSL *ssl,
1080 unsigned int (*psk_server_callback)(SSL *ssl, const char *identity, 1082 unsigned int (*psk_server_callback)(SSL *ssl, const char *identity,
1081 unsigned char *psk, unsigned int max_psk_len)); 1083 unsigned char *psk, unsigned int max_psk_len));
1082int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint); 1084int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint);
1083int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint); 1085int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint);
1084const char *SSL_get_psk_identity_hint(const SSL *s); 1086const char *SSL_get_psk_identity_hint(const SSL *s);
@@ -1101,8 +1103,7 @@ const char *SSL_get_psk_identity(const SSL *s);
1101 1103
1102#ifndef OPENSSL_NO_SSL_INTERN 1104#ifndef OPENSSL_NO_SSL_INTERN
1103 1105
1104struct ssl_st 1106struct ssl_st {
1105 {
1106 /* protocol version 1107 /* protocol version
1107 * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, DTLS1_VERSION) 1108 * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, DTLS1_VERSION)
1108 */ 1109 */
@@ -1146,9 +1147,9 @@ struct ssl_st
1146 int server; /* are we the server side? - mostly used by SSL_clear*/ 1147 int server; /* are we the server side? - mostly used by SSL_clear*/
1147 1148
1148 int new_session;/* Generate a new session or reuse an old one. 1149 int new_session;/* Generate a new session or reuse an old one.
1149 * NB: For servers, the 'new' session may actually be a previously 1150 * NB: For servers, the 'new' session may actually be a previously
1150 * cached session or even the previous session unless 1151 * cached session or even the previous session unless
1151 * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */ 1152 * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */
1152 int quiet_shutdown;/* don't send shutdown packets */ 1153 int quiet_shutdown;/* don't send shutdown packets */
1153 int shutdown; /* we have shut things down, 0x01 sent, 0x02 1154 int shutdown; /* we have shut things down, 0x01 sent, 0x02
1154 * for received */ 1155 * for received */
@@ -1156,7 +1157,7 @@ struct ssl_st
1156 int rstate; /* where we are when reading */ 1157 int rstate; /* where we are when reading */
1157 1158
1158 BUF_MEM *init_buf; /* buffer used during init */ 1159 BUF_MEM *init_buf; /* buffer used during init */
1159 void *init_msg; /* pointer to handshake message body, set by ssl3_get_message() */ 1160 void *init_msg; /* pointer to handshake message body, set by ssl3_get_message() */
1160 int init_num; /* amount read/written */ 1161 int init_num; /* amount read/written */
1161 int init_off; /* amount read/written */ 1162 int init_off; /* amount read/written */
1162 1163
@@ -1169,10 +1170,11 @@ struct ssl_st
1169 struct dtls1_state_st *d1; /* DTLSv1 variables */ 1170 struct dtls1_state_st *d1; /* DTLSv1 variables */
1170 1171
1171 int read_ahead; /* Read as many input bytes as possible 1172 int read_ahead; /* Read as many input bytes as possible
1172 * (for non-blocking reads) */ 1173 * (for non-blocking reads) */
1173 1174
1174 /* callback that allows applications to peek at protocol messages */ 1175 /* callback that allows applications to peek at protocol messages */
1175 void (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); 1176 void (*msg_callback)(int write_p, int version, int content_type,
1177 const void *buf, size_t len, SSL *ssl, void *arg);
1176 void *msg_callback_arg; 1178 void *msg_callback_arg;
1177 1179
1178 int hit; /* reusing a previous session */ 1180 int hit; /* reusing a previous session */
@@ -1190,9 +1192,10 @@ struct ssl_st
1190 1192
1191 /* These are the ones being used, the ones in SSL_SESSION are 1193 /* These are the ones being used, the ones in SSL_SESSION are
1192 * the ones to be 'copied' into these ones */ 1194 * the ones to be 'copied' into these ones */
1193 int mac_flags; 1195 int mac_flags;
1196
1194 EVP_CIPHER_CTX *enc_read_ctx; /* cryptographic state */ 1197 EVP_CIPHER_CTX *enc_read_ctx; /* cryptographic state */
1195 EVP_MD_CTX *read_hash; /* used for mac generation */ 1198 EVP_MD_CTX *read_hash; /* used for mac generation */
1196#ifndef OPENSSL_NO_COMP 1199#ifndef OPENSSL_NO_COMP
1197 COMP_CTX *expand; /* uncompress */ 1200 COMP_CTX *expand; /* uncompress */
1198#else 1201#else
@@ -1200,11 +1203,12 @@ struct ssl_st
1200#endif 1203#endif
1201 1204
1202 EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */ 1205 EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */
1203 EVP_MD_CTX *write_hash; /* used for mac generation */ 1206 EVP_MD_CTX *write_hash; /* used for mac generation */
1204#ifndef OPENSSL_NO_COMP 1207#ifndef OPENSSL_NO_COMP
1205 COMP_CTX *compress; /* compression */ 1208 COMP_CTX *compress; /* compression */
1206#else 1209#else
1207 char *compress; 1210 char *compress;
1211
1208#endif 1212#endif
1209 1213
1210 /* session info */ 1214 /* session info */
@@ -1235,21 +1239,22 @@ struct ssl_st
1235 int error_code; /* actual code */ 1239 int error_code; /* actual code */
1236 1240
1237#ifndef OPENSSL_NO_KRB5 1241#ifndef OPENSSL_NO_KRB5
1238 KSSL_CTX *kssl_ctx; /* Kerberos 5 context */ 1242 KSSL_CTX *kssl_ctx; /* Kerberos 5 context */
1239#endif /* OPENSSL_NO_KRB5 */ 1243#endif /* OPENSSL_NO_KRB5 */
1240 1244
1241#ifndef OPENSSL_NO_PSK 1245#ifndef OPENSSL_NO_PSK
1242 unsigned int (*psk_client_callback)(SSL *ssl, const char *hint, char *identity, 1246 unsigned int (*psk_client_callback)(SSL *ssl, const char *hint,
1243 unsigned int max_identity_len, unsigned char *psk, 1247 char *identity, unsigned int max_identity_len, unsigned char *psk,
1244 unsigned int max_psk_len); 1248 unsigned int max_psk_len);
1245 unsigned int (*psk_server_callback)(SSL *ssl, const char *identity, 1249 unsigned int (*psk_server_callback)(SSL *ssl, const char *identity,
1246 unsigned char *psk, unsigned int max_psk_len); 1250 unsigned char *psk, unsigned int max_psk_len);
1247#endif 1251#endif
1248 1252
1249 SSL_CTX *ctx; 1253 SSL_CTX *ctx;
1250 /* set this flag to 1 and a sleep(1) is put into all SSL_read() 1254 /* set this flag to 1 and a sleep(1) is put into all SSL_read()
1251 * and SSL_write() calls, good for nbio debuging :-) */ 1255 * and SSL_write() calls, good for nbio debuging :-) */
1252 int debug; 1256 int debug;
1257
1253 1258
1254 /* extra application data */ 1259 /* extra application data */
1255 long verify_result; 1260 long verify_result;
@@ -1269,15 +1274,14 @@ struct ssl_st
1269#ifndef OPENSSL_NO_TLSEXT 1274#ifndef OPENSSL_NO_TLSEXT
1270 /* TLS extension debug callback */ 1275 /* TLS extension debug callback */
1271 void (*tlsext_debug_cb)(SSL *s, int client_server, int type, 1276 void (*tlsext_debug_cb)(SSL *s, int client_server, int type,
1272 unsigned char *data, int len, 1277 unsigned char *data, int len, void *arg);
1273 void *arg);
1274 void *tlsext_debug_arg; 1278 void *tlsext_debug_arg;
1275 char *tlsext_hostname; 1279 char *tlsext_hostname;
1276 int servername_done; /* no further mod of servername 1280 int servername_done; /* no further mod of servername
1277 0 : call the servername extension callback. 1281 0 : call the servername extension callback.
1278 1 : prepare 2, allow last ack just after in server callback. 1282 1 : prepare 2, allow last ack just after in server callback.
1279 2 : don't call servername callback, no ack in server hello 1283 2 : don't call servername callback, no ack in server hello
1280 */ 1284 */
1281 /* certificate status request info */ 1285 /* certificate status request info */
1282 /* Status type or -1 if no status type */ 1286 /* Status type or -1 if no status type */
1283 int tlsext_status_type; 1287 int tlsext_status_type;
@@ -1330,28 +1334,28 @@ struct ssl_st
1330 1334
1331#define session_ctx initial_ctx 1335#define session_ctx initial_ctx
1332 1336
1333 STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; /* What we'll do */ 1337 STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; /* What we'll do */
1334 SRTP_PROTECTION_PROFILE *srtp_profile; /* What's been chosen */ 1338 SRTP_PROTECTION_PROFILE *srtp_profile; /* What's been chosen */
1335 1339
1336 unsigned int tlsext_heartbeat; /* Is use of the Heartbeat extension negotiated? 1340 unsigned int tlsext_heartbeat; /* Is use of the Heartbeat extension negotiated?
1337 0: disabled 1341 0: disabled
1338 1: enabled 1342 1: enabled
1339 2: enabled, but not allowed to send Requests 1343 2: enabled, but not allowed to send Requests
1340 */ 1344 */
1341 unsigned int tlsext_hb_pending; /* Indicates if a HeartbeatRequest is in flight */ 1345 unsigned int tlsext_hb_pending; /* Indicates if a HeartbeatRequest is in flight */
1342 unsigned int tlsext_hb_seq; /* HeartbeatRequest sequence number */ 1346 unsigned int tlsext_hb_seq; /* HeartbeatRequest sequence number */
1343#else 1347#else
1344#define session_ctx ctx 1348#define session_ctx ctx
1345#endif /* OPENSSL_NO_TLSEXT */ 1349#endif /* OPENSSL_NO_TLSEXT */
1346 1350
1347 int renegotiate;/* 1 if we are renegotiating. 1351 int renegotiate;/* 1 if we are renegotiating.
1348 * 2 if we are a server and are inside a handshake 1352 * 2 if we are a server and are inside a handshake
1349 * (i.e. not just sending a HelloRequest) */ 1353 * (i.e. not just sending a HelloRequest) */
1350 1354
1351#ifndef OPENSSL_NO_SRP 1355#ifndef OPENSSL_NO_SRP
1352 SRP_CTX srp_ctx; /* ctx for SRP authentication */ 1356 SRP_CTX srp_ctx; /* ctx for SRP authentication */
1353#endif 1357#endif
1354 }; 1358};
1355 1359
1356#endif 1360#endif
1357 1361
@@ -1361,10 +1365,10 @@ struct ssl_st
1361 1365
1362#include <openssl/ssl2.h> 1366#include <openssl/ssl2.h>
1363#include <openssl/ssl3.h> 1367#include <openssl/ssl3.h>
1364#include <openssl/tls1.h> /* This is mostly sslv3 with a few tweaks */ 1368#include <openssl/tls1.h> /* This is mostly sslv3 with a few tweaks */
1365#include <openssl/dtls1.h> /* Datagram TLS */ 1369#include <openssl/dtls1.h> /* Datagram TLS */
1366#include <openssl/ssl23.h> 1370#include <openssl/ssl23.h>
1367#include <openssl/srtp.h> /* Support for the use_srtp extension */ 1371#include <openssl/srtp.h> /* Support for the use_srtp extension */
1368 1372
1369#ifdef __cplusplus 1373#ifdef __cplusplus
1370extern "C" { 1374extern "C" {
@@ -1417,9 +1421,9 @@ extern "C" {
1417 1421
1418/* The following 2 states are kept in ssl->rstate when reads fail, 1422/* The following 2 states are kept in ssl->rstate when reads fail,
1419 * you should not need these */ 1423 * you should not need these */
1420#define SSL_ST_READ_HEADER 0xF0 1424#define SSL_ST_READ_HEADER 0xF0
1421#define SSL_ST_READ_BODY 0xF1 1425#define SSL_ST_READ_BODY 0xF1
1422#define SSL_ST_READ_DONE 0xF2 1426#define SSL_ST_READ_DONE 0xF2
1423 1427
1424/* Obtain latest Finished message 1428/* Obtain latest Finished message
1425 * -- that we sent (SSL_get_finished) 1429 * -- that we sent (SSL_get_finished)
@@ -1646,28 +1650,27 @@ DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION)
1646 1650
1647#ifndef OPENSSL_NO_BIO 1651#ifndef OPENSSL_NO_BIO
1648BIO_METHOD *BIO_f_ssl(void); 1652BIO_METHOD *BIO_f_ssl(void);
1649BIO *BIO_new_ssl(SSL_CTX *ctx,int client); 1653BIO *BIO_new_ssl(SSL_CTX *ctx, int client);
1650BIO *BIO_new_ssl_connect(SSL_CTX *ctx); 1654BIO *BIO_new_ssl_connect(SSL_CTX *ctx);
1651BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); 1655BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx);
1652int BIO_ssl_copy_session_id(BIO *to,BIO *from); 1656int BIO_ssl_copy_session_id(BIO *to, BIO *from);
1653void BIO_ssl_shutdown(BIO *ssl_bio); 1657void BIO_ssl_shutdown(BIO *ssl_bio);
1654
1655#endif 1658#endif
1656 1659
1657int SSL_CTX_set_cipher_list(SSL_CTX *,const char *str); 1660int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str);
1658SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth); 1661SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
1659void SSL_CTX_free(SSL_CTX *); 1662void SSL_CTX_free(SSL_CTX *);
1660long SSL_CTX_set_timeout(SSL_CTX *ctx,long t); 1663long SSL_CTX_set_timeout(SSL_CTX *ctx, long t);
1661long SSL_CTX_get_timeout(const SSL_CTX *ctx); 1664long SSL_CTX_get_timeout(const SSL_CTX *ctx);
1662X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); 1665X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *);
1663void SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *); 1666void SSL_CTX_set_cert_store(SSL_CTX *, X509_STORE *);
1664int SSL_want(const SSL *s); 1667int SSL_want(const SSL *s);
1665int SSL_clear(SSL *s); 1668int SSL_clear(SSL *s);
1666 1669
1667void SSL_CTX_flush_sessions(SSL_CTX *ctx,long tm); 1670void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm);
1668 1671
1669const SSL_CIPHER *SSL_get_current_cipher(const SSL *s); 1672const SSL_CIPHER *SSL_get_current_cipher(const SSL *s);
1670int SSL_CIPHER_get_bits(const SSL_CIPHER *c,int *alg_bits); 1673int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits);
1671char * SSL_CIPHER_get_version(const SSL_CIPHER *c); 1674char * SSL_CIPHER_get_version(const SSL_CIPHER *c);
1672const char * SSL_CIPHER_get_name(const SSL_CIPHER *c); 1675const char * SSL_CIPHER_get_name(const SSL_CIPHER *c);
1673unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c); 1676unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c);
@@ -1675,7 +1678,7 @@ unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c);
1675int SSL_get_fd(const SSL *s); 1678int SSL_get_fd(const SSL *s);
1676int SSL_get_rfd(const SSL *s); 1679int SSL_get_rfd(const SSL *s);
1677int SSL_get_wfd(const SSL *s); 1680int SSL_get_wfd(const SSL *s);
1678const char * SSL_get_cipher_list(const SSL *s,int n); 1681const char * SSL_get_cipher_list(const SSL *s, int n);
1679char * SSL_get_shared_ciphers(const SSL *s, char *buf, int len); 1682char * SSL_get_shared_ciphers(const SSL *s, char *buf, int len);
1680int SSL_get_read_ahead(const SSL * s); 1683int SSL_get_read_ahead(const SSL * s);
1681int SSL_pending(const SSL *s); 1684int SSL_pending(const SSL *s);
@@ -1685,7 +1688,7 @@ int SSL_set_rfd(SSL *s, int fd);
1685int SSL_set_wfd(SSL *s, int fd); 1688int SSL_set_wfd(SSL *s, int fd);
1686#endif 1689#endif
1687#ifndef OPENSSL_NO_BIO 1690#ifndef OPENSSL_NO_BIO
1688void SSL_set_bio(SSL *s, BIO *rbio,BIO *wbio); 1691void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio);
1689BIO * SSL_get_rbio(const SSL *s); 1692BIO * SSL_get_rbio(const SSL *s);
1690BIO * SSL_get_wbio(const SSL *s); 1693BIO * SSL_get_wbio(const SSL *s);
1691#endif 1694#endif
@@ -1693,16 +1696,16 @@ int SSL_set_cipher_list(SSL *s, const char *str);
1693void SSL_set_read_ahead(SSL *s, int yes); 1696void SSL_set_read_ahead(SSL *s, int yes);
1694int SSL_get_verify_mode(const SSL *s); 1697int SSL_get_verify_mode(const SSL *s);
1695int SSL_get_verify_depth(const SSL *s); 1698int SSL_get_verify_depth(const SSL *s);
1696int (*SSL_get_verify_callback(const SSL *s))(int,X509_STORE_CTX *); 1699int (*SSL_get_verify_callback(const SSL *s))(int, X509_STORE_CTX *);
1697void SSL_set_verify(SSL *s, int mode, 1700void SSL_set_verify(SSL *s, int mode,
1698 int (*callback)(int ok,X509_STORE_CTX *ctx)); 1701 int (*callback)(int ok, X509_STORE_CTX *ctx));
1699void SSL_set_verify_depth(SSL *s, int depth); 1702void SSL_set_verify_depth(SSL *s, int depth);
1700#ifndef OPENSSL_NO_RSA 1703#ifndef OPENSSL_NO_RSA
1701int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); 1704int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa);
1702#endif 1705#endif
1703int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len); 1706int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len);
1704int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); 1707int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey);
1705int SSL_use_PrivateKey_ASN1(int pk,SSL *ssl, const unsigned char *d, long len); 1708int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, long len);
1706int SSL_use_certificate(SSL *ssl, X509 *x); 1709int SSL_use_certificate(SSL *ssl, X509 *x);
1707int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len); 1710int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len);
1708 1711
@@ -1716,9 +1719,9 @@ int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type);
1716int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); /* PEM type */ 1719int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); /* PEM type */
1717STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); 1720STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);
1718int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, 1721int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
1719 const char *file); 1722 const char *file);
1720int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, 1723int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
1721 const char *dir); 1724 const char *dir);
1722#endif 1725#endif
1723 1726
1724void SSL_load_error_strings(void ); 1727void SSL_load_error_strings(void );
@@ -1730,32 +1733,34 @@ long SSL_SESSION_get_time(const SSL_SESSION *s);
1730long SSL_SESSION_set_time(SSL_SESSION *s, long t); 1733long SSL_SESSION_set_time(SSL_SESSION *s, long t);
1731long SSL_SESSION_get_timeout(const SSL_SESSION *s); 1734long SSL_SESSION_get_timeout(const SSL_SESSION *s);
1732long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); 1735long SSL_SESSION_set_timeout(SSL_SESSION *s, long t);
1733void SSL_copy_session_id(SSL *to,const SSL *from); 1736void SSL_copy_session_id(SSL *to, const SSL *from);
1734X509 *SSL_SESSION_get0_peer(SSL_SESSION *s); 1737X509 *SSL_SESSION_get0_peer(SSL_SESSION *s);
1735int SSL_SESSION_set1_id_context(SSL_SESSION *s,const unsigned char *sid_ctx, 1738int
1736 unsigned int sid_ctx_len); 1739SSL_SESSION_set1_id_context(SSL_SESSION *s, const unsigned char *sid_ctx,
1740unsigned int sid_ctx_len);
1737 1741
1738SSL_SESSION *SSL_SESSION_new(void); 1742SSL_SESSION *SSL_SESSION_new(void);
1739const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, 1743const unsigned char
1740 unsigned int *len); 1744*SSL_SESSION_get_id(const SSL_SESSION *s,
1745unsigned int *len);
1741unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s); 1746unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s);
1742#ifndef OPENSSL_NO_FP_API 1747#ifndef OPENSSL_NO_FP_API
1743int SSL_SESSION_print_fp(FILE *fp,const SSL_SESSION *ses); 1748int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses);
1744#endif 1749#endif
1745#ifndef OPENSSL_NO_BIO 1750#ifndef OPENSSL_NO_BIO
1746int SSL_SESSION_print(BIO *fp,const SSL_SESSION *ses); 1751int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses);
1747#endif 1752#endif
1748void SSL_SESSION_free(SSL_SESSION *ses); 1753void SSL_SESSION_free(SSL_SESSION *ses);
1749int i2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp); 1754int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp);
1750int SSL_set_session(SSL *to, SSL_SESSION *session); 1755int SSL_set_session(SSL *to, SSL_SESSION *session);
1751int SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c); 1756int SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c);
1752int SSL_CTX_remove_session(SSL_CTX *,SSL_SESSION *c); 1757int SSL_CTX_remove_session(SSL_CTX *, SSL_SESSION *c);
1753int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB); 1758int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB);
1754int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB); 1759int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB);
1755int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, 1760int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id,
1756 unsigned int id_len); 1761 unsigned int id_len);
1757SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,const unsigned char **pp, 1762SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
1758 long length); 1763 long length);
1759 1764
1760#ifdef HEADER_X509_H 1765#ifdef HEADER_X509_H
1761X509 * SSL_get_peer_certificate(const SSL *s); 1766X509 * SSL_get_peer_certificate(const SSL *s);
@@ -1765,18 +1770,17 @@ STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s);
1765 1770
1766int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); 1771int SSL_CTX_get_verify_mode(const SSL_CTX *ctx);
1767int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); 1772int SSL_CTX_get_verify_depth(const SSL_CTX *ctx);
1768int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int,X509_STORE_CTX *); 1773int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int, X509_STORE_CTX *);
1769void SSL_CTX_set_verify(SSL_CTX *ctx,int mode, 1774void SSL_CTX_set_verify(SSL_CTX *ctx, int mode,
1770 int (*callback)(int, X509_STORE_CTX *)); 1775 int (*callback)(int, X509_STORE_CTX *));
1771void SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth); 1776void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth);
1772void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*cb)(X509_STORE_CTX *,void *), void *arg); 1777void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*cb)(X509_STORE_CTX *, void *), void *arg);
1773#ifndef OPENSSL_NO_RSA 1778#ifndef OPENSSL_NO_RSA
1774int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); 1779int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);
1775#endif 1780#endif
1776int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len); 1781int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len);
1777int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); 1782int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey);
1778int SSL_CTX_use_PrivateKey_ASN1(int pk,SSL_CTX *ctx, 1783int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, const unsigned char *d, long len);
1779 const unsigned char *d, long len);
1780int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); 1784int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x);
1781int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d); 1785int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d);
1782 1786
@@ -1786,12 +1790,10 @@ void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u);
1786int SSL_CTX_check_private_key(const SSL_CTX *ctx); 1790int SSL_CTX_check_private_key(const SSL_CTX *ctx);
1787int SSL_check_private_key(const SSL *ctx); 1791int SSL_check_private_key(const SSL *ctx);
1788 1792
1789int SSL_CTX_set_session_id_context(SSL_CTX *ctx,const unsigned char *sid_ctx, 1793int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx, unsigned int sid_ctx_len);
1790 unsigned int sid_ctx_len);
1791 1794
1792SSL * SSL_new(SSL_CTX *ctx); 1795SSL *SSL_new(SSL_CTX *ctx);
1793int SSL_set_session_id_context(SSL *ssl,const unsigned char *sid_ctx, 1796int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx, unsigned int sid_ctx_len);
1794 unsigned int sid_ctx_len);
1795 1797
1796int SSL_CTX_set_purpose(SSL_CTX *s, int purpose); 1798int SSL_CTX_set_purpose(SSL_CTX *s, int purpose);
1797int SSL_set_purpose(SSL *s, int purpose); 1799int SSL_set_purpose(SSL *s, int purpose);
@@ -1802,21 +1804,16 @@ int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);
1802int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm); 1804int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm);
1803 1805
1804#ifndef OPENSSL_NO_SRP 1806#ifndef OPENSSL_NO_SRP
1805int SSL_CTX_set_srp_username(SSL_CTX *ctx,char *name); 1807int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name);
1806int SSL_CTX_set_srp_password(SSL_CTX *ctx,char *password); 1808int SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password);
1807int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength); 1809int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength);
1808int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx, 1810int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx, char *(*cb)(SSL *, void *));
1809 char *(*cb)(SSL *,void *)); 1811int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx, int (*cb)(SSL *, void *));
1810int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx, 1812int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx, int (*cb)(SSL *, int *, void *));
1811 int (*cb)(SSL *,void *));
1812int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx,
1813 int (*cb)(SSL *,int *,void *));
1814int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg); 1813int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg);
1815 1814
1816int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g, 1815int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g, BIGNUM *sa, BIGNUM *v, char *info);
1817 BIGNUM *sa, BIGNUM *v, char *info); 1816int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass, const char *grp);
1818int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass,
1819 const char *grp);
1820 1817
1821BIGNUM *SSL_get_srp_g(SSL *s); 1818BIGNUM *SSL_get_srp_g(SSL *s);
1822BIGNUM *SSL_get_srp_N(SSL *s); 1819BIGNUM *SSL_get_srp_N(SSL *s);
@@ -1828,15 +1825,15 @@ char *SSL_get_srp_userinfo(SSL *s);
1828void SSL_free(SSL *ssl); 1825void SSL_free(SSL *ssl);
1829int SSL_accept(SSL *ssl); 1826int SSL_accept(SSL *ssl);
1830int SSL_connect(SSL *ssl); 1827int SSL_connect(SSL *ssl);
1831int SSL_read(SSL *ssl,void *buf,int num); 1828int SSL_read(SSL *ssl, void *buf, int num);
1832int SSL_peek(SSL *ssl,void *buf,int num); 1829int SSL_peek(SSL *ssl, void *buf, int num);
1833int SSL_write(SSL *ssl,const void *buf,int num); 1830int SSL_write(SSL *ssl, const void *buf, int num);
1834long SSL_ctrl(SSL *ssl,int cmd, long larg, void *parg); 1831long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg);
1835long SSL_callback_ctrl(SSL *, int, void (*)(void)); 1832long SSL_callback_ctrl(SSL *, int, void (*)(void));
1836long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, void *parg); 1833long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg);
1837long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void)); 1834long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void));
1838 1835
1839int SSL_get_error(const SSL *s,int ret_code); 1836int SSL_get_error(const SSL *s, int ret_code);
1840const char *SSL_get_version(const SSL *s); 1837const char *SSL_get_version(const SSL *s);
1841 1838
1842/* This sets the 'default' SSL version that SSL_new() will create */ 1839/* This sets the 'default' SSL version that SSL_new() will create */
@@ -1852,7 +1849,7 @@ const SSL_METHOD *SSLv3_method(void); /* SSLv3 */
1852const SSL_METHOD *SSLv3_server_method(void); /* SSLv3 */ 1849const SSL_METHOD *SSLv3_server_method(void); /* SSLv3 */
1853const SSL_METHOD *SSLv3_client_method(void); /* SSLv3 */ 1850const SSL_METHOD *SSLv3_client_method(void); /* SSLv3 */
1854 1851
1855const SSL_METHOD *SSLv23_method(void); /* SSLv3 but can rollback to v2 */ 1852const SSL_METHOD *SSLv23_method(void); /* SSLv3 but can rollback to v2 */
1856const SSL_METHOD *SSLv23_server_method(void); /* SSLv3 but can rollback to v2 */ 1853const SSL_METHOD *SSLv23_server_method(void); /* SSLv3 but can rollback to v2 */
1857const SSL_METHOD *SSLv23_client_method(void); /* SSLv3 but can rollback to v2 */ 1854const SSL_METHOD *SSLv23_client_method(void); /* SSLv3 but can rollback to v2 */
1858 1855
@@ -1892,8 +1889,8 @@ void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list);
1892void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); 1889void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list);
1893STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); 1890STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s);
1894STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s); 1891STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s);
1895int SSL_add_client_CA(SSL *ssl,X509 *x); 1892int SSL_add_client_CA(SSL *ssl, X509 *x);
1896int SSL_CTX_add_client_CA(SSL_CTX *ctx,X509 *x); 1893int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x);
1897 1894
1898void SSL_set_connect_state(SSL *s); 1895void SSL_set_connect_state(SSL *s);
1899void SSL_set_accept_state(SSL *s); 1896void SSL_set_accept_state(SSL *s);
@@ -1902,7 +1899,7 @@ long SSL_get_default_timeout(const SSL *s);
1902 1899
1903int SSL_library_init(void ); 1900int SSL_library_init(void );
1904 1901
1905char *SSL_CIPHER_description(const SSL_CIPHER *,char *buf,int size); 1902char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size);
1906STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk); 1903STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk);
1907 1904
1908SSL *SSL_dup(SSL *ssl); 1905SSL *SSL_dup(SSL *ssl);
@@ -1919,35 +1916,36 @@ int SSL_get_shutdown(const SSL *ssl);
1919int SSL_version(const SSL *ssl); 1916int SSL_version(const SSL *ssl);
1920int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); 1917int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx);
1921int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, 1918int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
1922 const char *CApath); 1919 const char *CApath);
1923#define SSL_get0_session SSL_get_session /* just peek at pointer */ 1920#define SSL_get0_session SSL_get_session /* just peek at pointer */
1924SSL_SESSION *SSL_get_session(const SSL *ssl); 1921SSL_SESSION *SSL_get_session(const SSL *ssl);
1925SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ 1922SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */
1926SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); 1923SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl);
1927SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX* ctx); 1924SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX* ctx);
1928void SSL_set_info_callback(SSL *ssl, 1925void SSL_set_info_callback(SSL *ssl,
1929 void (*cb)(const SSL *ssl,int type,int val)); 1926 void (*cb)(const SSL *ssl, int type, int val));
1930void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl,int type,int val); 1927void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl, int type, int val);
1931int SSL_state(const SSL *ssl); 1928int SSL_state(const SSL *ssl);
1932void SSL_set_state(SSL *ssl, int state); 1929void SSL_set_state(SSL *ssl, int state);
1933 1930
1934void SSL_set_verify_result(SSL *ssl,long v); 1931void SSL_set_verify_result(SSL *ssl, long v);
1935long SSL_get_verify_result(const SSL *ssl); 1932long SSL_get_verify_result(const SSL *ssl);
1936 1933
1937int SSL_set_ex_data(SSL *ssl,int idx,void *data); 1934int SSL_set_ex_data(SSL *ssl, int idx, void *data);
1938void *SSL_get_ex_data(const SSL *ssl,int idx); 1935void *SSL_get_ex_data(const SSL *ssl, int idx);
1939int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 1936int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
1940 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 1937 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
1941 1938
1942int SSL_SESSION_set_ex_data(SSL_SESSION *ss,int idx,void *data); 1939int SSL_SESSION_set_ex_data(SSL_SESSION *ss, int idx, void *data);
1943void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss,int idx); 1940void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss, int idx);
1944int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 1941int SSL_SESSION_get_ex_new_index(long argl, void *argp,
1945 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 1942 CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,
1943 CRYPTO_EX_free *free_func);
1946 1944
1947int SSL_CTX_set_ex_data(SSL_CTX *ssl,int idx,void *data); 1945int SSL_CTX_set_ex_data(SSL_CTX *ssl, int idx, void *data);
1948void *SSL_CTX_get_ex_data(const SSL_CTX *ssl,int idx); 1946void *SSL_CTX_get_ex_data(const SSL_CTX *ssl, int idx);
1949int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 1947int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
1950 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 1948 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
1951 1949
1952int SSL_get_ex_data_X509_STORE_CTX_idx(void ); 1950int SSL_get_ex_data_X509_STORE_CTX_idx(void );
1953 1951
@@ -1980,31 +1978,25 @@ int SSL_get_ex_data_X509_STORE_CTX_idx(void );
1980#define SSL_set_max_send_fragment(ssl,m) \ 1978#define SSL_set_max_send_fragment(ssl,m) \
1981 SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) 1979 SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL)
1982 1980
1983 /* NB: the keylength is only applicable when is_export is true */ 1981/* NB: the keylength is only applicable when is_export is true */
1984#ifndef OPENSSL_NO_RSA 1982#ifndef OPENSSL_NO_RSA
1985void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, 1983void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,
1986 RSA *(*cb)(SSL *ssl,int is_export, 1984 RSA *(*cb)(SSL *ssl, int is_export, int keylength));
1987 int keylength));
1988 1985
1989void SSL_set_tmp_rsa_callback(SSL *ssl, 1986void SSL_set_tmp_rsa_callback(SSL *ssl,
1990 RSA *(*cb)(SSL *ssl,int is_export, 1987 RSA *(*cb)(SSL *ssl, int is_export, int keylength));
1991 int keylength));
1992#endif 1988#endif
1993#ifndef OPENSSL_NO_DH 1989#ifndef OPENSSL_NO_DH
1994void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, 1990void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,
1995 DH *(*dh)(SSL *ssl,int is_export, 1991 DH *(*dh)(SSL *ssl, int is_export, int keylength));
1996 int keylength));
1997void SSL_set_tmp_dh_callback(SSL *ssl, 1992void SSL_set_tmp_dh_callback(SSL *ssl,
1998 DH *(*dh)(SSL *ssl,int is_export, 1993 DH *(*dh)(SSL *ssl, int is_export, int keylength));
1999 int keylength));
2000#endif 1994#endif
2001#ifndef OPENSSL_NO_ECDH 1995#ifndef OPENSSL_NO_ECDH
2002void SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx, 1996void SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx,
2003 EC_KEY *(*ecdh)(SSL *ssl,int is_export, 1997 EC_KEY *(*ecdh)(SSL *ssl, int is_export, int keylength));
2004 int keylength));
2005void SSL_set_tmp_ecdh_callback(SSL *ssl, 1998void SSL_set_tmp_ecdh_callback(SSL *ssl,
2006 EC_KEY *(*ecdh)(SSL *ssl,int is_export, 1999 EC_KEY *(*ecdh)(SSL *ssl, int is_export, int keylength));
2007 int keylength));
2008#endif 2000#endif
2009 2001
2010#ifndef OPENSSL_NO_COMP 2002#ifndef OPENSSL_NO_COMP
@@ -2012,23 +2004,24 @@ const COMP_METHOD *SSL_get_current_compression(SSL *s);
2012const COMP_METHOD *SSL_get_current_expansion(SSL *s); 2004const COMP_METHOD *SSL_get_current_expansion(SSL *s);
2013const char *SSL_COMP_get_name(const COMP_METHOD *comp); 2005const char *SSL_COMP_get_name(const COMP_METHOD *comp);
2014STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void); 2006STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void);
2015int SSL_COMP_add_compression_method(int id,COMP_METHOD *cm); 2007int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm);
2016#else 2008#else
2017const void *SSL_get_current_compression(SSL *s); 2009const void *SSL_get_current_compression(SSL *s);
2018const void *SSL_get_current_expansion(SSL *s); 2010const void *SSL_get_current_expansion(SSL *s);
2019const char *SSL_COMP_get_name(const void *comp); 2011const char *SSL_COMP_get_name(const void *comp);
2020void *SSL_COMP_get_compression_methods(void); 2012void *SSL_COMP_get_compression_methods(void);
2021int SSL_COMP_add_compression_method(int id,void *cm); 2013int SSL_COMP_add_compression_method(int id, void *cm);
2022#endif 2014#endif
2023 2015
2024/* TLS extensions functions */ 2016/* TLS extensions functions */
2025int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len); 2017int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len);
2026 2018
2027int SSL_set_session_ticket_ext_cb(SSL *s, tls_session_ticket_ext_cb_fn cb, 2019int SSL_set_session_ticket_ext_cb(SSL *s,
2028 void *arg); 2020 tls_session_ticket_ext_cb_fn cb, void *arg);
2029 2021
2030/* Pre-shared secret session resumption functions */ 2022/* Pre-shared secret session resumption functions */
2031int SSL_set_session_secret_cb(SSL *s, tls_session_secret_cb_fn tls_session_secret_cb, void *arg); 2023int SSL_set_session_secret_cb(SSL *s,
2024 tls_session_secret_cb_fn tls_session_secret_cb, void *arg);
2032 2025
2033void SSL_set_debug(SSL *s, int debug); 2026void SSL_set_debug(SSL *s, int debug);
2034int SSL_cache_hit(SSL *s); 2027int SSL_cache_hit(SSL *s);
diff --git a/src/lib/libssl/ssl2.h b/src/lib/libssl/ssl2.h
index 29033c8be7..4052b11868 100644
--- a/src/lib/libssl/ssl2.h
+++ b/src/lib/libssl/ssl2.h
@@ -100,7 +100,7 @@ extern "C" {
100#define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5 0x020700c0 100#define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5 0x020700c0
101#define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA 0x020701c0 /* v3 */ 101#define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA 0x020701c0 /* v3 */
102#define SSL2_CK_RC4_64_WITH_MD5 0x02080080 /* MS hack */ 102#define SSL2_CK_RC4_64_WITH_MD5 0x02080080 /* MS hack */
103 103
104#define SSL2_CK_DES_64_CFB64_WITH_MD5_1 0x02ff0800 /* SSLeay */ 104#define SSL2_CK_DES_64_CFB64_WITH_MD5_1 0x02ff0800 /* SSLeay */
105#define SSL2_CK_NULL 0x02ff0810 /* SSLeay */ 105#define SSL2_CK_NULL 0x02ff0810 /* SSLeay */
106 106
@@ -133,8 +133,8 @@ extern "C" {
133 133
134/* Upper/Lower Bounds */ 134/* Upper/Lower Bounds */
135#define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS 256 135#define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS 256
136#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 32767u /* 2^15-1 */ 136#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 32767u /* 2^15-1 */
137#define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER 16383 /* 2^14-1 */ 137#define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER 16383 /* 2^14-1 */
138 138
139#define SSL2_CHALLENGE_LENGTH 16 139#define SSL2_CHALLENGE_LENGTH 16
140/*#define SSL2_CHALLENGE_LENGTH 32 */ 140/*#define SSL2_CHALLENGE_LENGTH 32 */
@@ -153,8 +153,7 @@ extern "C" {
153 153
154#ifndef OPENSSL_NO_SSL_INTERN 154#ifndef OPENSSL_NO_SSL_INTERN
155 155
156typedef struct ssl2_state_st 156typedef struct ssl2_state_st {
157 {
158 int three_byte_header; 157 int three_byte_header;
159 int clear_text; /* clear text */ 158 int clear_text; /* clear text */
160 int escape; /* not used in SSLv2 */ 159 int escape; /* not used in SSLv2 */
@@ -167,8 +166,8 @@ typedef struct ssl2_state_st
167 const unsigned char *wpend_buf; 166 const unsigned char *wpend_buf;
168 167
169 int wpend_off; /* offset to data to write */ 168 int wpend_off; /* offset to data to write */
170 int wpend_len; /* number of bytes passwd to write */ 169 int wpend_len; /* number of bytes passwd to write */
171 int wpend_ret; /* number of bytes to return to caller */ 170 int wpend_ret; /* number of bytes to return to caller */
172 171
173 /* buffer raw data */ 172 /* buffer raw data */
174 int rbuf_left; 173 int rbuf_left;
@@ -191,7 +190,7 @@ typedef struct ssl2_state_st
191 unsigned char *read_key; 190 unsigned char *read_key;
192 unsigned char *write_key; 191 unsigned char *write_key;
193 192
194 /* Stuff specifically to do with this SSL session */ 193 /* Stuff specifically to do with this SSL session */
195 unsigned int challenge_length; 194 unsigned int challenge_length;
196 unsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH]; 195 unsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH];
197 unsigned int conn_id_length; 196 unsigned int conn_id_length;
@@ -202,20 +201,23 @@ typedef struct ssl2_state_st
202 unsigned long read_sequence; 201 unsigned long read_sequence;
203 unsigned long write_sequence; 202 unsigned long write_sequence;
204 203
205 struct { 204 struct {
206 unsigned int conn_id_length; 205 unsigned int conn_id_length;
207 unsigned int cert_type; 206 unsigned int cert_type;
207
208 unsigned int cert_length; 208 unsigned int cert_length;
209 unsigned int csl; 209 unsigned int csl;
210
210 unsigned int clear; 211 unsigned int clear;
211 unsigned int enc; 212 unsigned int enc;
213
212 unsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH]; 214 unsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH];
213 unsigned int cipher_spec_length; 215 unsigned int cipher_spec_length;
214 unsigned int session_id_length; 216 unsigned int session_id_length;
215 unsigned int clen; 217 unsigned int clen;
216 unsigned int rlen; 218 unsigned int rlen;
217 } tmp; 219 } tmp;
218 } SSL2_STATE; 220} SSL2_STATE;
219 221
220#endif 222#endif
221 223
@@ -265,4 +267,3 @@ typedef struct ssl2_state_st
265} 267}
266#endif 268#endif
267#endif 269#endif
268
diff --git a/src/lib/libssl/ssl23.h b/src/lib/libssl/ssl23.h
index d3228983c7..4e28a06796 100644
--- a/src/lib/libssl/ssl23.h
+++ b/src/lib/libssl/ssl23.h
@@ -80,4 +80,3 @@ extern "C" {
80} 80}
81#endif 81#endif
82#endif 82#endif
83
diff --git a/src/lib/libssl/ssl3.h b/src/lib/libssl/ssl3.h
index cb8b2492ec..2b25357917 100644
--- a/src/lib/libssl/ssl3.h
+++ b/src/lib/libssl/ssl3.h
@@ -163,13 +163,13 @@ extern "C" {
163#define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B 163#define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B
164 164
165#if 0 165#if 0
166 #define SSL3_CK_FZA_DMS_NULL_SHA 0x0300001C 166#define SSL3_CK_FZA_DMS_NULL_SHA 0x0300001C
167 #define SSL3_CK_FZA_DMS_FZA_SHA 0x0300001D 167#define SSL3_CK_FZA_DMS_FZA_SHA 0x0300001D
168 #if 0 /* Because it clashes with KRB5, is never used any more, and is safe 168#if 0 /* Because it clashes with KRB5, is never used any more, and is safe
169 to remove according to David Hopwood <david.hopwood@zetnet.co.uk> 169 to remove according to David Hopwood <david.hopwood@zetnet.co.uk>
170 of the ietf-tls list */ 170 of the ietf-tls list */
171 #define SSL3_CK_FZA_DMS_RC4_SHA 0x0300001E 171#define SSL3_CK_FZA_DMS_RC4_SHA 0x0300001E
172 #endif 172#endif
173#endif 173#endif
174 174
175/* VRS Additional Kerberos5 entries 175/* VRS Additional Kerberos5 entries
@@ -222,9 +222,9 @@ extern "C" {
222#define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA" 222#define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA"
223 223
224#if 0 224#if 0
225 #define SSL3_TXT_FZA_DMS_NULL_SHA "FZA-NULL-SHA" 225#define SSL3_TXT_FZA_DMS_NULL_SHA "FZA-NULL-SHA"
226 #define SSL3_TXT_FZA_DMS_FZA_SHA "FZA-FZA-CBC-SHA" 226#define SSL3_TXT_FZA_DMS_FZA_SHA "FZA-FZA-CBC-SHA"
227 #define SSL3_TXT_FZA_DMS_RC4_SHA "FZA-RC4-SHA" 227#define SSL3_TXT_FZA_DMS_RC4_SHA "FZA-RC4-SHA"
228#endif 228#endif
229 229
230#define SSL3_TXT_KRB5_DES_64_CBC_SHA "KRB5-DES-CBC-SHA" 230#define SSL3_TXT_KRB5_DES_64_CBC_SHA "KRB5-DES-CBC-SHA"
@@ -342,11 +342,10 @@ extern "C" {
342 342
343#define TLS1_HB_REQUEST 1 343#define TLS1_HB_REQUEST 1
344#define TLS1_HB_RESPONSE 2 344#define TLS1_HB_RESPONSE 2
345 345
346#ifndef OPENSSL_NO_SSL_INTERN 346#ifndef OPENSSL_NO_SSL_INTERN
347 347
348typedef struct ssl3_record_st 348typedef struct ssl3_record_st {
349 {
350/*r */ int type; /* type of record */ 349/*r */ int type; /* type of record */
351/*rw*/ unsigned int length; /* How many bytes available */ 350/*rw*/ unsigned int length; /* How many bytes available */
352/*r */ unsigned int off; /* read/write offset into 'buf' */ 351/*r */ unsigned int off; /* read/write offset into 'buf' */
@@ -355,16 +354,15 @@ typedef struct ssl3_record_st
355/*r */ unsigned char *comp; /* only used with decompression - malloc()ed */ 354/*r */ unsigned char *comp; /* only used with decompression - malloc()ed */
356/*r */ unsigned long epoch; /* epoch number, needed by DTLS1 */ 355/*r */ unsigned long epoch; /* epoch number, needed by DTLS1 */
357/*r */ unsigned char seq_num[8]; /* sequence number, needed by DTLS1 */ 356/*r */ unsigned char seq_num[8]; /* sequence number, needed by DTLS1 */
358 } SSL3_RECORD; 357} SSL3_RECORD;
359 358
360typedef struct ssl3_buffer_st 359typedef struct ssl3_buffer_st {
361 { 360 unsigned char *buf; /* at least SSL3_RT_MAX_PACKET_SIZE bytes,
362 unsigned char *buf; /* at least SSL3_RT_MAX_PACKET_SIZE bytes,
363 * see ssl3_setup_buffers() */ 361 * see ssl3_setup_buffers() */
364 size_t len; /* buffer size */ 362 size_t len; /* buffer size */
365 int offset; /* where to 'copy from' */ 363 int offset; /* where to 'copy from' */
366 int left; /* how many bytes left */ 364 int left; /* how many bytes left */
367 } SSL3_BUFFER; 365} SSL3_BUFFER;
368 366
369#endif 367#endif
370 368
@@ -388,7 +386,7 @@ typedef struct ssl3_buffer_st
388#define TLS1_FLAGS_TLS_PADDING_BUG 0x0008 386#define TLS1_FLAGS_TLS_PADDING_BUG 0x0008
389#define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010 387#define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010
390#define TLS1_FLAGS_KEEP_HANDSHAKE 0x0020 388#define TLS1_FLAGS_KEEP_HANDSHAKE 0x0020
391 389
392/* SSL3_FLAGS_SGC_RESTART_DONE is set when we 390/* SSL3_FLAGS_SGC_RESTART_DONE is set when we
393 * restart a handshake because of MS SGC and so prevents us 391 * restart a handshake because of MS SGC and so prevents us
394 * from restarting the handshake in a loop. It's reset on a 392 * from restarting the handshake in a loop. It's reset on a
@@ -402,8 +400,7 @@ typedef struct ssl3_buffer_st
402 400
403#ifndef OPENSSL_NO_SSL_INTERN 401#ifndef OPENSSL_NO_SSL_INTERN
404 402
405typedef struct ssl3_state_st 403typedef struct ssl3_state_st {
406 {
407 long flags; 404 long flags;
408 int delay_buf_pop_ret; 405 int delay_buf_pop_ret;
409 406
@@ -471,7 +468,8 @@ typedef struct ssl3_state_st
471 468
472 /* Opaque PRF input as used for the current handshake. 469 /* Opaque PRF input as used for the current handshake.
473 * These fields are used only if TLSEXT_TYPE_opaque_prf_input is defined 470 * These fields are used only if TLSEXT_TYPE_opaque_prf_input is defined
474 * (otherwise, they are merely present to improve binary compatibility) */ 471 * (otherwise, they are merely present to improve binary compatibility)
472 */
475 void *client_opaque_prf_input; 473 void *client_opaque_prf_input;
476 size_t client_opaque_prf_input_len; 474 size_t client_opaque_prf_input_len;
477 void *server_opaque_prf_input; 475 void *server_opaque_prf_input;
@@ -501,7 +499,7 @@ typedef struct ssl3_state_st
501#endif 499#endif
502 500
503 /* used when SSL_ST_FLUSH_DATA is entered */ 501 /* used when SSL_ST_FLUSH_DATA is entered */
504 int next_state; 502 int next_state;
505 503
506 int reuse_message; 504 int reuse_message;
507 505
@@ -526,17 +524,18 @@ typedef struct ssl3_state_st
526 char *new_compression; 524 char *new_compression;
527#endif 525#endif
528 int cert_request; 526 int cert_request;
529 } tmp; 527 } tmp;
530 528
531 /* Connection binding to prevent renegotiation attacks */ 529 /* Connection binding to prevent renegotiation attacks */
532 unsigned char previous_client_finished[EVP_MAX_MD_SIZE]; 530 unsigned char previous_client_finished[EVP_MAX_MD_SIZE];
533 unsigned char previous_client_finished_len; 531 unsigned char previous_client_finished_len;
534 unsigned char previous_server_finished[EVP_MAX_MD_SIZE]; 532 unsigned char previous_server_finished[EVP_MAX_MD_SIZE];
535 unsigned char previous_server_finished_len; 533 unsigned char previous_server_finished_len;
536 int send_connection_binding; /* TODOEKR */ 534 int send_connection_binding; /* TODOEKR */
537 535
538#ifndef OPENSSL_NO_NEXTPROTONEG 536#ifndef OPENSSL_NO_NEXTPROTONEG
539 /* Set if we saw the Next Protocol Negotiation extension from our peer. */ 537 /* Set if we saw the Next Protocol Negotiation extension from our peer.
538 */
540 int next_proto_neg_seen; 539 int next_proto_neg_seen;
541#endif 540#endif
542 541
@@ -548,7 +547,7 @@ typedef struct ssl3_state_st
548 char is_probably_safari; 547 char is_probably_safari;
549#endif /* !OPENSSL_NO_EC */ 548#endif /* !OPENSSL_NO_EC */
550#endif /* !OPENSSL_NO_TLSEXT */ 549#endif /* !OPENSSL_NO_TLSEXT */
551 } SSL3_STATE; 550} SSL3_STATE;
552 551
553#endif 552#endif
554 553
@@ -690,4 +689,3 @@ typedef struct ssl3_state_st
690} 689}
691#endif 690#endif
692#endif 691#endif
693
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h
index 7311d984ae..203a47480f 100644
--- a/src/lib/libssl/ssl_locl.h
+++ b/src/lib/libssl/ssl_locl.h
@@ -480,21 +480,19 @@
480#define NAMED_CURVE_TYPE 3 480#define NAMED_CURVE_TYPE 3
481#endif /* OPENSSL_NO_EC */ 481#endif /* OPENSSL_NO_EC */
482 482
483typedef struct cert_pkey_st 483typedef struct cert_pkey_st {
484 {
485 X509 *x509; 484 X509 *x509;
486 EVP_PKEY *privatekey; 485 EVP_PKEY *privatekey;
487 /* Digest to use when signing */ 486 /* Digest to use when signing */
488 const EVP_MD *digest; 487 const EVP_MD *digest;
489 } CERT_PKEY; 488} CERT_PKEY;
490 489
491typedef struct cert_st 490typedef struct cert_st {
492 {
493 /* Current active set */ 491 /* Current active set */
494 CERT_PKEY *key; /* ALWAYS points to an element of the pkeys array 492 CERT_PKEY *key; /* ALWAYS points to an element of the pkeys array
495 * Probably it would make more sense to store 493 * Probably it would make more sense to store
496 * an index, not a pointer. */ 494 * an index, not a pointer. */
497 495
498 /* The following masks are for the key and auth 496 /* The following masks are for the key and auth
499 * algorithms that are supported by the certs below */ 497 * algorithms that are supported by the certs below */
500 int valid; 498 int valid;
@@ -504,26 +502,25 @@ typedef struct cert_st
504 unsigned long export_mask_a; 502 unsigned long export_mask_a;
505#ifndef OPENSSL_NO_RSA 503#ifndef OPENSSL_NO_RSA
506 RSA *rsa_tmp; 504 RSA *rsa_tmp;
507 RSA *(*rsa_tmp_cb)(SSL *ssl,int is_export,int keysize); 505 RSA *(*rsa_tmp_cb)(SSL *ssl, int is_export, int keysize);
508#endif 506#endif
509#ifndef OPENSSL_NO_DH 507#ifndef OPENSSL_NO_DH
510 DH *dh_tmp; 508 DH *dh_tmp;
511 DH *(*dh_tmp_cb)(SSL *ssl,int is_export,int keysize); 509 DH *(*dh_tmp_cb)(SSL *ssl, int is_export, int keysize);
512#endif 510#endif
513#ifndef OPENSSL_NO_ECDH 511#ifndef OPENSSL_NO_ECDH
514 EC_KEY *ecdh_tmp; 512 EC_KEY *ecdh_tmp;
515 /* Callback for generating ephemeral ECDH keys */ 513 /* Callback for generating ephemeral ECDH keys */
516 EC_KEY *(*ecdh_tmp_cb)(SSL *ssl,int is_export,int keysize); 514 EC_KEY *(*ecdh_tmp_cb)(SSL *ssl, int is_export, int keysize);
517#endif 515#endif
518 516
519 CERT_PKEY pkeys[SSL_PKEY_NUM]; 517 CERT_PKEY pkeys[SSL_PKEY_NUM];
520 518
521 int references; /* >1 only if SSL_copy_session_id is used */ 519 int references; /* >1 only if SSL_copy_session_id is used */
522 } CERT; 520} CERT;
523 521
524 522
525typedef struct sess_cert_st 523typedef struct sess_cert_st {
526 {
527 STACK_OF(X509) *cert_chain; /* as received from peer (not for SSL2) */ 524 STACK_OF(X509) *cert_chain; /* as received from peer (not for SSL2) */
528 525
529 /* The 'peer_...' members are used only by clients. */ 526 /* The 'peer_...' members are used only by clients. */
@@ -545,7 +542,7 @@ typedef struct sess_cert_st
545#endif 542#endif
546 543
547 int references; /* actually always 1 at the moment */ 544 int references; /* actually always 1 at the moment */
548 } SESS_CERT; 545} SESS_CERT;
549 546
550 547
551/*#define MAC_DEBUG */ 548/*#define MAC_DEBUG */
@@ -568,12 +565,12 @@ typedef struct sess_cert_st
568/* This is for the SSLv3/TLSv1.0 differences in crypto/hash stuff 565/* This is for the SSLv3/TLSv1.0 differences in crypto/hash stuff
569 * It is a bit of a mess of functions, but hell, think of it as 566 * It is a bit of a mess of functions, but hell, think of it as
570 * an opaque structure :-) */ 567 * an opaque structure :-) */
571typedef struct ssl3_enc_method 568typedef struct ssl3_enc_method {
572 {
573 int (*enc)(SSL *, int); 569 int (*enc)(SSL *, int);
574 int (*mac)(SSL *, unsigned char *, int); 570 int (*mac)(SSL *, unsigned char *, int);
575 int (*setup_key_block)(SSL *); 571 int (*setup_key_block)(SSL *);
576 int (*generate_master_secret)(SSL *, unsigned char *, unsigned char *, int); 572 int (*generate_master_secret)(SSL *, unsigned char *,
573 unsigned char *, int);
577 int (*change_cipher_state)(SSL *, int); 574 int (*change_cipher_state)(SSL *, int);
578 int (*final_finish_mac)(SSL *, const char *, int, unsigned char *); 575 int (*final_finish_mac)(SSL *, const char *, int, unsigned char *);
579 int finish_mac_length; 576 int finish_mac_length;
@@ -584,33 +581,29 @@ typedef struct ssl3_enc_method
584 int server_finished_label_len; 581 int server_finished_label_len;
585 int (*alert_value)(int); 582 int (*alert_value)(int);
586 int (*export_keying_material)(SSL *, unsigned char *, size_t, 583 int (*export_keying_material)(SSL *, unsigned char *, size_t,
587 const char *, size_t, 584 const char *, size_t, const unsigned char *, size_t,
588 const unsigned char *, size_t, 585 int use_context);
589 int use_context); 586} SSL3_ENC_METHOD;
590 } SSL3_ENC_METHOD;
591 587
592#ifndef OPENSSL_NO_COMP 588#ifndef OPENSSL_NO_COMP
593/* Used for holding the relevant compression methods loaded into SSL_CTX */ 589/* Used for holding the relevant compression methods loaded into SSL_CTX */
594typedef struct ssl3_comp_st 590typedef struct ssl3_comp_st {
595 {
596 int comp_id; /* The identifier byte for this compression type */ 591 int comp_id; /* The identifier byte for this compression type */
597 char *name; /* Text name used for the compression type */ 592 char *name; /* Text name used for the compression type */
598 COMP_METHOD *method; /* The method :-) */ 593 COMP_METHOD *method; /* The method :-) */
599 } SSL3_COMP; 594} SSL3_COMP;
600#endif 595#endif
601 596
602#ifndef OPENSSL_NO_BUF_FREELISTS 597#ifndef OPENSSL_NO_BUF_FREELISTS
603typedef struct ssl3_buf_freelist_st 598typedef struct ssl3_buf_freelist_st {
604 {
605 size_t chunklen; 599 size_t chunklen;
606 unsigned int len; 600 unsigned int len;
607 struct ssl3_buf_freelist_entry_st *head; 601 struct ssl3_buf_freelist_entry_st *head;
608 } SSL3_BUF_FREELIST; 602} SSL3_BUF_FREELIST;
609 603
610typedef struct ssl3_buf_freelist_entry_st 604typedef struct ssl3_buf_freelist_entry_st {
611 {
612 struct ssl3_buf_freelist_entry_st *next; 605 struct ssl3_buf_freelist_entry_st *next;
613 } SSL3_BUF_FREELIST_ENTRY; 606} SSL3_BUF_FREELIST_ENTRY;
614#endif 607#endif
615 608
616extern SSL3_ENC_METHOD ssl3_undef_enc_method; 609extern SSL3_ENC_METHOD ssl3_undef_enc_method;
@@ -822,32 +815,33 @@ SESS_CERT *ssl_sess_cert_new(void);
822void ssl_sess_cert_free(SESS_CERT *sc); 815void ssl_sess_cert_free(SESS_CERT *sc);
823int ssl_set_peer_cert_type(SESS_CERT *c, int type); 816int ssl_set_peer_cert_type(SESS_CERT *c, int type);
824int ssl_get_new_session(SSL *s, int session); 817int ssl_get_new_session(SSL *s, int session);
825int ssl_get_prev_session(SSL *s, unsigned char *session,int len, const unsigned char *limit); 818int ssl_get_prev_session(SSL *s, unsigned char *session, int len,
826int ssl_cipher_id_cmp(const SSL_CIPHER *a,const SSL_CIPHER *b); 819 const unsigned char *limit);
827DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, 820int ssl_cipher_id_cmp(const SSL_CIPHER *a, const SSL_CIPHER *b);
828 ssl_cipher_id); 821DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, ssl_cipher_id);
829int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap, 822int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap,
830 const SSL_CIPHER * const *bp); 823 const SSL_CIPHER * const *bp);
831STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num, 824STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, unsigned char *p,
832 STACK_OF(SSL_CIPHER) **skp); 825 int num, STACK_OF(SSL_CIPHER) **skp);
833int ssl_cipher_list_to_bytes(SSL *s,STACK_OF(SSL_CIPHER) *sk,unsigned char *p, 826int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk,
834 int (*put_cb)(const SSL_CIPHER *, unsigned char *)); 827 unsigned char *p, int (*put_cb)(const SSL_CIPHER *, unsigned char *));
835STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth, 828STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth,
836 STACK_OF(SSL_CIPHER) **pref, 829 STACK_OF(SSL_CIPHER) **pref, STACK_OF(SSL_CIPHER) **sorted,
837 STACK_OF(SSL_CIPHER) **sorted, 830 const char *rule_str);
838 const char *rule_str);
839void ssl_update_cache(SSL *s, int mode); 831void ssl_update_cache(SSL *s, int mode);
840int ssl_cipher_get_evp(const SSL_SESSION *s,const EVP_CIPHER **enc, 832int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc,
841 const EVP_MD **md,int *mac_pkey_type,int *mac_secret_size, SSL_COMP **comp); 833 const EVP_MD **md, int *mac_pkey_type, int *mac_secret_size,
842int ssl_get_handshake_digest(int i,long *mask,const EVP_MD **md); 834 SSL_COMP **comp);
843int ssl_verify_cert_chain(SSL *s,STACK_OF(X509) *sk); 835int ssl_get_handshake_digest(int i, long *mask, const EVP_MD **md);
836
837int ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk);
844int ssl_undefined_function(SSL *s); 838int ssl_undefined_function(SSL *s);
845int ssl_undefined_void_function(void); 839int ssl_undefined_void_function(void);
846int ssl_undefined_const_function(const SSL *s); 840int ssl_undefined_const_function(const SSL *s);
847CERT_PKEY *ssl_get_server_send_pkey(const SSL *s); 841CERT_PKEY *ssl_get_server_send_pkey(const SSL *s);
848X509 *ssl_get_server_send_cert(const SSL *); 842X509 *ssl_get_server_send_cert(const SSL *);
849EVP_PKEY *ssl_get_sign_pkey(SSL *s,const SSL_CIPHER *c, const EVP_MD **pmd); 843EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *c, const EVP_MD **pmd);
850int ssl_cert_type(X509 *x,EVP_PKEY *pkey); 844int ssl_cert_type(X509 *x, EVP_PKEY *pkey);
851void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher); 845void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher);
852STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s); 846STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s);
853int ssl_verify_alarm_type(long type); 847int ssl_verify_alarm_type(long type);
@@ -856,14 +850,14 @@ int ssl_fill_hello_random(SSL *s, int server, unsigned char *field, int len);
856 850
857int ssl2_enc_init(SSL *s, int client); 851int ssl2_enc_init(SSL *s, int client);
858int ssl2_generate_key_material(SSL *s); 852int ssl2_generate_key_material(SSL *s);
859void ssl2_enc(SSL *s,int send_data); 853void ssl2_enc(SSL *s, int send_data);
860void ssl2_mac(SSL *s,unsigned char *mac,int send_data); 854void ssl2_mac(SSL *s, unsigned char *mac, int send_data);
861const SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p); 855const SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p);
862int ssl2_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p); 856int ssl2_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
863int ssl2_part_read(SSL *s, unsigned long f, int i); 857int ssl2_part_read(SSL *s, unsigned long f, int i);
864int ssl2_do_write(SSL *s); 858int ssl2_do_write(SSL *s);
865int ssl2_set_certificate(SSL *s, int type, int len, const unsigned char *data); 859int ssl2_set_certificate(SSL *s, int type, int len, const unsigned char *data);
866void ssl2_return_error(SSL *s,int reason); 860void ssl2_return_error(SSL *s, int reason);
867void ssl2_write_error(SSL *s); 861void ssl2_write_error(SSL *s);
868int ssl2_num_ciphers(void); 862int ssl2_num_ciphers(void);
869const SSL_CIPHER *ssl2_get_cipher(unsigned int u); 863const SSL_CIPHER *ssl2_get_cipher(unsigned int u);
@@ -876,47 +870,50 @@ int ssl2_peek(SSL *s, void *buf, int len);
876int ssl2_write(SSL *s, const void *buf, int len); 870int ssl2_write(SSL *s, const void *buf, int len);
877int ssl2_shutdown(SSL *s); 871int ssl2_shutdown(SSL *s);
878void ssl2_clear(SSL *s); 872void ssl2_clear(SSL *s);
879long ssl2_ctrl(SSL *s,int cmd, long larg, void *parg); 873long ssl2_ctrl(SSL *s, int cmd, long larg, void *parg);
880long ssl2_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg); 874long ssl2_ctx_ctrl(SSL_CTX *s, int cmd, long larg, void *parg);
881long ssl2_callback_ctrl(SSL *s,int cmd, void (*fp)(void)); 875long ssl2_callback_ctrl(SSL *s, int cmd, void (*fp)(void));
882long ssl2_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)(void)); 876long ssl2_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp)(void));
883int ssl2_pending(const SSL *s); 877int ssl2_pending(const SSL *s);
884long ssl2_default_timeout(void ); 878long ssl2_default_timeout(void );
885 879
886const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p); 880const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p);
887int ssl3_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p); 881int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
888void ssl3_init_finished_mac(SSL *s); 882void ssl3_init_finished_mac(SSL *s);
889int ssl3_send_server_certificate(SSL *s); 883int ssl3_send_server_certificate(SSL *s);
890int ssl3_send_newsession_ticket(SSL *s); 884int ssl3_send_newsession_ticket(SSL *s);
891int ssl3_send_cert_status(SSL *s); 885int ssl3_send_cert_status(SSL *s);
892int ssl3_get_finished(SSL *s,int state_a,int state_b); 886int ssl3_get_finished(SSL *s, int state_a, int state_b);
893int ssl3_setup_key_block(SSL *s); 887int ssl3_setup_key_block(SSL *s);
894int ssl3_send_change_cipher_spec(SSL *s,int state_a,int state_b); 888int ssl3_send_change_cipher_spec(SSL *s, int state_a, int state_b);
895int ssl3_change_cipher_state(SSL *s,int which); 889int ssl3_change_cipher_state(SSL *s, int which);
896void ssl3_cleanup_key_block(SSL *s); 890void ssl3_cleanup_key_block(SSL *s);
897int ssl3_do_write(SSL *s,int type); 891int ssl3_do_write(SSL *s, int type);
898int ssl3_send_alert(SSL *s,int level, int desc); 892int ssl3_send_alert(SSL *s, int level, int desc);
899int ssl3_generate_master_secret(SSL *s, unsigned char *out, 893int ssl3_generate_master_secret(SSL *s, unsigned char *out,
900 unsigned char *p, int len); 894 unsigned char *p, int len);
901int ssl3_get_req_cert_type(SSL *s,unsigned char *p); 895int ssl3_get_req_cert_type(SSL *s, unsigned char *p);
902long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok); 896long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok);
903int ssl3_send_finished(SSL *s, int a, int b, const char *sender,int slen); 897int ssl3_send_finished(SSL *s, int a, int b, const char *sender, int slen);
904int ssl3_num_ciphers(void); 898int ssl3_num_ciphers(void);
905const SSL_CIPHER *ssl3_get_cipher(unsigned int u); 899const SSL_CIPHER *ssl3_get_cipher(unsigned int u);
906int ssl3_renegotiate(SSL *ssl); 900int ssl3_renegotiate(SSL *ssl);
907int ssl3_renegotiate_check(SSL *ssl); 901
902int ssl3_renegotiate_check(SSL *ssl);
903
908int ssl3_dispatch_alert(SSL *s); 904int ssl3_dispatch_alert(SSL *s);
909int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); 905int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek);
910int ssl3_write_bytes(SSL *s, int type, const void *buf, int len); 906int ssl3_write_bytes(SSL *s, int type, const void *buf, int len);
911int ssl3_final_finish_mac(SSL *s, const char *sender, int slen,unsigned char *p); 907int ssl3_final_finish_mac(SSL *s, const char *sender, int slen,
908 unsigned char *p);
912int ssl3_cert_verify_mac(SSL *s, int md_nid, unsigned char *p); 909int ssl3_cert_verify_mac(SSL *s, int md_nid, unsigned char *p);
913void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len); 910void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len);
914int ssl3_enc(SSL *s, int send_data); 911int ssl3_enc(SSL *s, int send_data);
915int n_ssl3_mac(SSL *ssl, unsigned char *md, int send_data); 912int n_ssl3_mac(SSL *ssl, unsigned char *md, int send_data);
916void ssl3_free_digest_list(SSL *s); 913void ssl3_free_digest_list(SSL *s);
917unsigned long ssl3_output_cert_chain(SSL *s, X509 *x); 914unsigned long ssl3_output_cert_chain(SSL *s, X509 *x);
918SSL_CIPHER *ssl3_choose_cipher(SSL *ssl,STACK_OF(SSL_CIPHER) *clnt, 915SSL_CIPHER *ssl3_choose_cipher(SSL *ssl, STACK_OF(SSL_CIPHER) *clnt,
919 STACK_OF(SSL_CIPHER) *srvr); 916 STACK_OF(SSL_CIPHER) *srvr);
920int ssl3_setup_buffers(SSL *s); 917int ssl3_setup_buffers(SSL *s);
921int ssl3_setup_read_buffer(SSL *s); 918int ssl3_setup_read_buffer(SSL *s);
922int ssl3_setup_write_buffer(SSL *s); 919int ssl3_setup_write_buffer(SSL *s);
@@ -932,10 +929,10 @@ int ssl3_peek(SSL *s, void *buf, int len);
932int ssl3_write(SSL *s, const void *buf, int len); 929int ssl3_write(SSL *s, const void *buf, int len);
933int ssl3_shutdown(SSL *s); 930int ssl3_shutdown(SSL *s);
934void ssl3_clear(SSL *s); 931void ssl3_clear(SSL *s);
935long ssl3_ctrl(SSL *s,int cmd, long larg, void *parg); 932long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg);
936long ssl3_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg); 933long ssl3_ctx_ctrl(SSL_CTX *s, int cmd, long larg, void *parg);
937long ssl3_callback_ctrl(SSL *s,int cmd, void (*fp)(void)); 934long ssl3_callback_ctrl(SSL *s, int cmd, void (*fp)(void));
938long ssl3_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)(void)); 935long ssl3_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp)(void));
939int ssl3_pending(const SSL *s); 936int ssl3_pending(const SSL *s);
940 937
941void ssl3_record_sequence_update(unsigned char *seq); 938void ssl3_record_sequence_update(unsigned char *seq);
@@ -952,16 +949,16 @@ const SSL_CIPHER *ssl23_get_cipher_by_char(const unsigned char *p);
952long ssl23_default_timeout(void ); 949long ssl23_default_timeout(void );
953 950
954long tls1_default_timeout(void); 951long tls1_default_timeout(void);
955int dtls1_do_write(SSL *s,int type); 952int dtls1_do_write(SSL *s, int type);
956int ssl3_read_n(SSL *s, int n, int max, int extend); 953int ssl3_read_n(SSL *s, int n, int max, int extend);
957int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); 954int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek);
958int ssl3_do_compress(SSL *ssl); 955int ssl3_do_compress(SSL *ssl);
959int ssl3_do_uncompress(SSL *ssl); 956int ssl3_do_uncompress(SSL *ssl);
960int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, 957int ssl3_write_pending(SSL *s, int type, const unsigned char *buf,
961 unsigned int len); 958 unsigned int len);
962unsigned char *dtls1_set_message_header(SSL *s, 959unsigned char *dtls1_set_message_header(SSL *s, unsigned char *p,
963 unsigned char *p, unsigned char mt, unsigned long len, 960 unsigned char mt, unsigned long len, unsigned long frag_off,
964 unsigned long frag_off, unsigned long frag_len); 961 unsigned long frag_len);
965 962
966int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf, int len); 963int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf, int len);
967int dtls1_write_bytes(SSL *s, int type, const void *buf, int len); 964int dtls1_write_bytes(SSL *s, int type, const void *buf, int len);
@@ -971,8 +968,8 @@ int dtls1_send_finished(SSL *s, int a, int b, const char *sender, int slen);
971unsigned long dtls1_output_cert_chain(SSL *s, X509 *x); 968unsigned long dtls1_output_cert_chain(SSL *s, X509 *x);
972int dtls1_read_failed(SSL *s, int code); 969int dtls1_read_failed(SSL *s, int code);
973int dtls1_buffer_message(SSL *s, int ccs); 970int dtls1_buffer_message(SSL *s, int ccs);
974int dtls1_retransmit_message(SSL *s, unsigned short seq, 971int dtls1_retransmit_message(SSL *s, unsigned short seq,
975 unsigned long frag_off, int *found); 972 unsigned long frag_off, int *found);
976int dtls1_get_queue_priority(unsigned short seq, int is_ccs); 973int dtls1_get_queue_priority(unsigned short seq, int is_ccs);
977int dtls1_retransmit_buffered_messages(SSL *s); 974int dtls1_retransmit_buffered_messages(SSL *s);
978void dtls1_clear_record_buffer(SSL *s); 975void dtls1_clear_record_buffer(SSL *s);
@@ -1049,21 +1046,21 @@ int ssl23_write_bytes(SSL *s);
1049int tls1_new(SSL *s); 1046int tls1_new(SSL *s);
1050void tls1_free(SSL *s); 1047void tls1_free(SSL *s);
1051void tls1_clear(SSL *s); 1048void tls1_clear(SSL *s);
1052long tls1_ctrl(SSL *s,int cmd, long larg, void *parg); 1049long tls1_ctrl(SSL *s, int cmd, long larg, void *parg);
1053long tls1_callback_ctrl(SSL *s,int cmd, void (*fp)(void)); 1050long tls1_callback_ctrl(SSL *s, int cmd, void (*fp)(void));
1054 1051
1055int dtls1_new(SSL *s); 1052int dtls1_new(SSL *s);
1056int dtls1_accept(SSL *s); 1053int dtls1_accept(SSL *s);
1057int dtls1_connect(SSL *s); 1054int dtls1_connect(SSL *s);
1058void dtls1_free(SSL *s); 1055void dtls1_free(SSL *s);
1059void dtls1_clear(SSL *s); 1056void dtls1_clear(SSL *s);
1060long dtls1_ctrl(SSL *s,int cmd, long larg, void *parg); 1057long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg);
1061int dtls1_shutdown(SSL *s); 1058int dtls1_shutdown(SSL *s);
1062 1059
1063long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok); 1060long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok);
1064int dtls1_get_record(SSL *s); 1061int dtls1_get_record(SSL *s);
1065int do_dtls1_write(SSL *s, int type, const unsigned char *buf, 1062int do_dtls1_write(SSL *s, int type, const unsigned char *buf,
1066 unsigned int len, int create_empty_fragement); 1063 unsigned int len, int create_empty_fragement);
1067int dtls1_dispatch_alert(SSL *s); 1064int dtls1_dispatch_alert(SSL *s);
1068int dtls1_enc(SSL *s, int snd); 1065int dtls1_enc(SSL *s, int snd);
1069 1066
@@ -1073,15 +1070,14 @@ void ssl_free_wbio_buffer(SSL *s);
1073int tls1_change_cipher_state(SSL *s, int which); 1070int tls1_change_cipher_state(SSL *s, int which);
1074int tls1_setup_key_block(SSL *s); 1071int tls1_setup_key_block(SSL *s);
1075int tls1_enc(SSL *s, int snd); 1072int tls1_enc(SSL *s, int snd);
1076int tls1_final_finish_mac(SSL *s, 1073int tls1_final_finish_mac(SSL *s, const char *str, int slen, unsigned char *p);
1077 const char *str, int slen, unsigned char *p);
1078int tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *p); 1074int tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *p);
1079int tls1_mac(SSL *ssl, unsigned char *md, int snd); 1075int tls1_mac(SSL *ssl, unsigned char *md, int snd);
1080int tls1_generate_master_secret(SSL *s, unsigned char *out, 1076int tls1_generate_master_secret(SSL *s, unsigned char *out,
1081 unsigned char *p, int len); 1077 unsigned char *p, int len);
1082int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, 1078int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen,
1083 const char *label, size_t llen, 1079 const char *label, size_t llen, const unsigned char *p, size_t plen,
1084 const unsigned char *p, size_t plen, int use_context); 1080 int use_context);
1085int tls1_alert_code(int code); 1081int tls1_alert_code(int code);
1086int ssl3_alert_code(int code); 1082int ssl3_alert_code(int code);
1087int ssl_ok(SSL *s); 1083int ssl_ok(SSL *s);
@@ -1098,10 +1094,16 @@ int tls1_ec_nid2curve_id(int nid);
1098#endif /* OPENSSL_NO_EC */ 1094#endif /* OPENSSL_NO_EC */
1099 1095
1100#ifndef OPENSSL_NO_TLSEXT 1096#ifndef OPENSSL_NO_TLSEXT
1101unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned char *limit); 1097unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p,
1102unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, unsigned char *limit); 1098 unsigned char *limit);
1103int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **data, unsigned char *d, int n, int *al); 1099
1104int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **data, unsigned char *d, int n, int *al); 1100unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p,
1101 unsigned char *limit);
1102
1103int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **data,
1104 unsigned char *d, int n, int *al);
1105int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **data,
1106 unsigned char *d, int n, int *al);
1105int ssl_prepare_clienthello_tlsext(SSL *s); 1107int ssl_prepare_clienthello_tlsext(SSL *s);
1106int ssl_prepare_serverhello_tlsext(SSL *s); 1108int ssl_prepare_serverhello_tlsext(SSL *s);
1107int ssl_check_clienthello_tlsext_early(SSL *s); 1109int ssl_check_clienthello_tlsext_early(SSL *s);
@@ -1114,60 +1116,53 @@ int ssl_check_serverhello_tlsext(SSL *s);
1114#define tlsext_tick_md EVP_sha256 1116#define tlsext_tick_md EVP_sha256
1115#endif 1117#endif
1116int tls1_process_ticket(SSL *s, unsigned char *session_id, int len, 1118int tls1_process_ticket(SSL *s, unsigned char *session_id, int len,
1117 const unsigned char *limit, SSL_SESSION **ret); 1119 const unsigned char *limit, SSL_SESSION **ret);
1118 1120
1119int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk, 1121int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk,
1120 const EVP_MD *md); 1122 const EVP_MD *md);
1121int tls12_get_sigid(const EVP_PKEY *pk); 1123int tls12_get_sigid(const EVP_PKEY *pk);
1122const EVP_MD *tls12_get_hash(unsigned char hash_alg); 1124const EVP_MD *tls12_get_hash(unsigned char hash_alg);
1123 1125
1124#endif 1126#endif
1125EVP_MD_CTX* ssl_replace_hash(EVP_MD_CTX **hash,const EVP_MD *md) ; 1127EVP_MD_CTX* ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md);
1126void ssl_clear_hash_ctx(EVP_MD_CTX **hash); 1128void ssl_clear_hash_ctx(EVP_MD_CTX **hash);
1127int ssl_add_serverhello_renegotiate_ext(SSL *s, unsigned char *p, int *len, 1129int ssl_add_serverhello_renegotiate_ext(SSL *s, unsigned char *p,
1128 int maxlen); 1130 int *len, int maxlen);
1129int ssl_parse_serverhello_renegotiate_ext(SSL *s, unsigned char *d, int len, 1131int ssl_parse_serverhello_renegotiate_ext(SSL *s, unsigned char *d,
1130 int *al); 1132 int len, int *al);
1131int ssl_add_clienthello_renegotiate_ext(SSL *s, unsigned char *p, int *len, 1133int ssl_add_clienthello_renegotiate_ext(SSL *s, unsigned char *p,
1132 int maxlen); 1134 int *len, int maxlen);
1133int ssl_parse_clienthello_renegotiate_ext(SSL *s, unsigned char *d, int len, 1135int ssl_parse_clienthello_renegotiate_ext(SSL *s, unsigned char *d,
1134 int *al); 1136 int len, int *al);
1135long ssl_get_algorithm2(SSL *s); 1137long ssl_get_algorithm2(SSL *s);
1136int tls1_process_sigalgs(SSL *s, const unsigned char *data, int dsize); 1138int tls1_process_sigalgs(SSL *s, const unsigned char *data, int dsize);
1137int tls12_get_req_sig_algs(SSL *s, unsigned char *p); 1139int tls12_get_req_sig_algs(SSL *s, unsigned char *p);
1138 1140
1139int ssl_add_clienthello_use_srtp_ext(SSL *s, unsigned char *p, int *len, int maxlen); 1141int ssl_add_clienthello_use_srtp_ext(SSL *s, unsigned char *p,
1140int ssl_parse_clienthello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al); 1142 int *len, int maxlen);
1141int ssl_add_serverhello_use_srtp_ext(SSL *s, unsigned char *p, int *len, int maxlen); 1143int ssl_parse_clienthello_use_srtp_ext(SSL *s, unsigned char *d,
1142int ssl_parse_serverhello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al); 1144 int len, int *al);
1145int ssl_add_serverhello_use_srtp_ext(SSL *s, unsigned char *p,
1146 int *len, int maxlen);
1147int ssl_parse_serverhello_use_srtp_ext(SSL *s, unsigned char *d,
1148 int len, int *al);
1143 1149
1144/* s3_cbc.c */ 1150/* s3_cbc.c */
1145void ssl3_cbc_copy_mac(unsigned char* out, 1151void ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec,
1146 const SSL3_RECORD *rec, 1152 unsigned md_size, unsigned orig_len);
1147 unsigned md_size,unsigned orig_len); 1153int ssl3_cbc_remove_padding(const SSL *s, SSL3_RECORD *rec,
1148int ssl3_cbc_remove_padding(const SSL* s, 1154 unsigned block_size, unsigned mac_size);
1149 SSL3_RECORD *rec, 1155int tls1_cbc_remove_padding(const SSL *s, SSL3_RECORD *rec,
1150 unsigned block_size, 1156 unsigned block_size, unsigned mac_size);
1151 unsigned mac_size);
1152int tls1_cbc_remove_padding(const SSL* s,
1153 SSL3_RECORD *rec,
1154 unsigned block_size,
1155 unsigned mac_size);
1156char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx); 1157char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx);
1157void ssl3_cbc_digest_record( 1158void ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, unsigned char *md_out,
1158 const EVP_MD_CTX *ctx, 1159 size_t *md_out_size, const unsigned char header[13],
1159 unsigned char* md_out, 1160 const unsigned char *data, size_t data_plus_mac_size,
1160 size_t* md_out_size, 1161 size_t data_plus_mac_plus_padding_size, const unsigned char *mac_secret,
1161 const unsigned char header[13], 1162 unsigned mac_secret_length, char is_sslv3);
1162 const unsigned char *data, 1163
1163 size_t data_plus_mac_size, 1164void tls_fips_digest_extra(const EVP_CIPHER_CTX *cipher_ctx,
1164 size_t data_plus_mac_plus_padding_size, 1165 EVP_MD_CTX *mac_ctx, const unsigned char *data, size_t data_len,
1165 const unsigned char *mac_secret, 1166 size_t orig_len);
1166 unsigned mac_secret_length,
1167 char is_sslv3);
1168
1169void tls_fips_digest_extra(
1170 const EVP_CIPHER_CTX *cipher_ctx, EVP_MD_CTX *mac_ctx,
1171 const unsigned char *data, size_t data_len, size_t orig_len);
1172 1167
1173#endif 1168#endif
diff --git a/src/lib/libssl/tls1.h b/src/lib/libssl/tls1.h
index 7e35f13849..95d6660ac3 100644
--- a/src/lib/libssl/tls1.h
+++ b/src/lib/libssl/tls1.h
@@ -240,9 +240,9 @@ extern "C" {
240#define TLSEXT_TYPE_session_ticket 35 240#define TLSEXT_TYPE_session_ticket 35
241 241
242/* ExtensionType value from draft-rescorla-tls-opaque-prf-input-00.txt */ 242/* ExtensionType value from draft-rescorla-tls-opaque-prf-input-00.txt */
243#if 0 /* will have to be provided externally for now , 243#if 0 /* will have to be provided externally for now ,
244 * i.e. build with -DTLSEXT_TYPE_opaque_prf_input=38183 244 * i.e. build with - DTLSEXT_TYPE_opaque_prf_input = 38183
245 * using whatever extension number you'd like to try */ 245 * using whatever extension number you'd like to try */
246# define TLSEXT_TYPE_opaque_prf_input ?? */ 246# define TLSEXT_TYPE_opaque_prf_input ?? */
247#endif 247#endif
248 248
@@ -295,8 +295,8 @@ int SSL_get_servername_type(const SSL *s);
295 * It returns 1 on success and zero otherwise. 295 * It returns 1 on success and zero otherwise.
296 */ 296 */
297int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen, 297int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen,
298 const char *label, size_t llen, const unsigned char *p, size_t plen, 298 const char *label, size_t llen, const unsigned char *p, size_t plen,
299 int use_context); 299 int use_context);
300 300
301#define SSL_set_tlsext_host_name(s,name) \ 301#define SSL_set_tlsext_host_name(s,name) \
302SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,(char *)name) 302SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,(char *)name)
@@ -719,11 +719,10 @@ SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,(void (*)(void))cb)
719#endif 719#endif
720 720
721/* TLS Session Ticket extension struct */ 721/* TLS Session Ticket extension struct */
722struct tls_session_ticket_ext_st 722struct tls_session_ticket_ext_st {
723 {
724 unsigned short length; 723 unsigned short length;
725 void *data; 724 void *data;
726 }; 725};
727 726
728#ifdef __cplusplus 727#ifdef __cplusplus
729} 728}