summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl.h
diff options
context:
space:
mode:
authorbeck <>2002-05-15 02:29:21 +0000
committerbeck <>2002-05-15 02:29:21 +0000
commitb64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9 (patch)
treefa27cf82a1250b64ed3bf5f4a18c7354d470bbcc /src/lib/libssl/ssl.h
parente471e1ea98d673597b182ea85f29e30c97cd08b5 (diff)
downloadopenbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.gz
openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.bz2
openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.zip
OpenSSL 0.9.7 stable 2002 05 08 merge
Diffstat (limited to 'src/lib/libssl/ssl.h')
-rw-r--r--src/lib/libssl/ssl.h442
1 files changed, 338 insertions, 104 deletions
diff --git a/src/lib/libssl/ssl.h b/src/lib/libssl/ssl.h
index 9de9e611ab..833f761690 100644
--- a/src/lib/libssl/ssl.h
+++ b/src/lib/libssl/ssl.h
@@ -55,20 +55,130 @@
55 * copied and put under another distribution licence 55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58/* ====================================================================
59 * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
60 *
61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions
63 * are met:
64 *
65 * 1. Redistributions of source code must retain the above copyright
66 * notice, this list of conditions and the following disclaimer.
67 *
68 * 2. Redistributions in binary form must reproduce the above copyright
69 * notice, this list of conditions and the following disclaimer in
70 * the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3. All advertising materials mentioning features or use of this
74 * software must display the following acknowledgment:
75 * "This product includes software developed by the OpenSSL Project
76 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77 *
78 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79 * endorse or promote products derived from this software without
80 * prior written permission. For written permission, please contact
81 * openssl-core@openssl.org.
82 *
83 * 5. Products derived from this software may not be called "OpenSSL"
84 * nor may "OpenSSL" appear in their names without prior written
85 * permission of the OpenSSL Project.
86 *
87 * 6. Redistributions of any form whatsoever must retain the following
88 * acknowledgment:
89 * "This product includes software developed by the OpenSSL Project
90 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91 *
92 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
96 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103 * OF THE POSSIBILITY OF SUCH DAMAGE.
104 * ====================================================================
105 *
106 * This product includes cryptographic software written by Eric Young
107 * (eay@cryptsoft.com). This product includes software written by Tim
108 * Hudson (tjh@cryptsoft.com).
109 *
110 */
111/* ====================================================================
112 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
113 *
114 * Redistribution and use in source and binary forms, with or without
115 * modification, are permitted provided that the following conditions
116 * are met:
117 *
118 * 1. Redistributions of source code must retain the above copyright
119 * notice, this list of conditions and the following disclaimer.
120 *
121 * 2. Redistributions in binary form must reproduce the above copyright
122 * notice, this list of conditions and the following disclaimer in
123 * the documentation and/or other materials provided with the
124 * distribution.
125 *
126 * 3. All advertising materials mentioning features or use of this
127 * software must display the following acknowledgment:
128 * "This product includes software developed by the OpenSSL Project
129 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
130 *
131 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
132 * endorse or promote products derived from this software without
133 * prior written permission. For written permission, please contact
134 * openssl-core@openssl.org.
135 *
136 * 5. Products derived from this software may not be called "OpenSSL"
137 * nor may "OpenSSL" appear in their names without prior written
138 * permission of the OpenSSL Project.
139 *
140 * 6. Redistributions of any form whatsoever must retain the following
141 * acknowledgment:
142 * "This product includes software developed by the OpenSSL Project
143 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
144 *
145 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
146 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
147 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
148 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
149 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
150 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
151 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
152 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
153 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
154 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
155 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
156 * OF THE POSSIBILITY OF SUCH DAMAGE.
157 * ====================================================================
158 *
159 * This product includes cryptographic software written by Eric Young
160 * (eay@cryptsoft.com). This product includes software written by Tim
161 * Hudson (tjh@cryptsoft.com).
162 *
163 */
58 164
59#ifndef HEADER_SSL_H 165#ifndef HEADER_SSL_H
60#define HEADER_SSL_H 166#define HEADER_SSL_H
61 167
62#ifndef NO_COMP 168#include <openssl/e_os2.h>
169
170#ifndef OPENSSL_NO_COMP
63#include <openssl/comp.h> 171#include <openssl/comp.h>
64#endif 172#endif
65#ifndef NO_BIO 173#ifndef OPENSSL_NO_BIO
66#include <openssl/bio.h> 174#include <openssl/bio.h>
67#endif 175#endif
68#ifndef NO_X509 176#ifndef OPENSSL_NO_X509
69#include <openssl/x509.h> 177#include <openssl/x509.h>
70#endif 178#endif
179#include <openssl/kssl.h>
71#include <openssl/safestack.h> 180#include <openssl/safestack.h>
181#include <openssl/symhacks.h>
72 182
73#ifdef __cplusplus 183#ifdef __cplusplus
74extern "C" { 184extern "C" {
@@ -92,6 +202,16 @@ extern "C" {
92#define SSL_TXT_DES_192_EDE3_CBC_WITH_MD5 SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5 202#define SSL_TXT_DES_192_EDE3_CBC_WITH_MD5 SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5
93#define SSL_TXT_DES_192_EDE3_CBC_WITH_SHA SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA 203#define SSL_TXT_DES_192_EDE3_CBC_WITH_SHA SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA
94 204
205/* VRS Additional Kerberos5 entries
206 */
207#define SSL_TXT_KRB5_DES_40_CBC_SHA SSL3_TXT_KRB5_DES_40_CBC_SHA
208#define SSL_TXT_KRB5_DES_40_CBC_MD5 SSL3_TXT_KRB5_DES_40_CBC_MD5
209#define SSL_TXT_KRB5_DES_64_CBC_SHA SSL3_TXT_KRB5_DES_64_CBC_SHA
210#define SSL_TXT_KRB5_DES_64_CBC_MD5 SSL3_TXT_KRB5_DES_64_CBC_MD5
211#define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA
212#define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5
213#define SSL_MAX_KRB5_PRINCIPAL_LENGTH 256
214
95#define SSL_MAX_SSL_SESSION_ID_LENGTH 32 215#define SSL_MAX_SSL_SESSION_ID_LENGTH 32
96#define SSL_MAX_SID_CTX_LENGTH 32 216#define SSL_MAX_SID_CTX_LENGTH 32
97 217
@@ -112,6 +232,10 @@ extern "C" {
112#define SSL_TXT_eNULL "eNULL" 232#define SSL_TXT_eNULL "eNULL"
113#define SSL_TXT_NULL "NULL" 233#define SSL_TXT_NULL "NULL"
114 234
235#define SSL_TXT_kKRB5 "kKRB5"
236#define SSL_TXT_aKRB5 "aKRB5"
237#define SSL_TXT_KRB5 "KRB5"
238
115#define SSL_TXT_kRSA "kRSA" 239#define SSL_TXT_kRSA "kRSA"
116#define SSL_TXT_kDHr "kDHr" 240#define SSL_TXT_kDHr "kDHr"
117#define SSL_TXT_kDHd "kDHd" 241#define SSL_TXT_kDHd "kDHd"
@@ -129,6 +253,7 @@ extern "C" {
129#define SSL_TXT_RC4 "RC4" 253#define SSL_TXT_RC4 "RC4"
130#define SSL_TXT_RC2 "RC2" 254#define SSL_TXT_RC2 "RC2"
131#define SSL_TXT_IDEA "IDEA" 255#define SSL_TXT_IDEA "IDEA"
256#define SSL_TXT_AES "AESdraft" /* AES ciphersuites are not yet official (thus excluded from 'ALL') */
132#define SSL_TXT_MD5 "MD5" 257#define SSL_TXT_MD5 "MD5"
133#define SSL_TXT_SHA1 "SHA1" 258#define SSL_TXT_SHA1 "SHA1"
134#define SSL_TXT_SHA "SHA" 259#define SSL_TXT_SHA "SHA"
@@ -141,9 +266,10 @@ extern "C" {
141#define SSL_TXT_TLSV1 "TLSv1" 266#define SSL_TXT_TLSV1 "TLSv1"
142#define SSL_TXT_ALL "ALL" 267#define SSL_TXT_ALL "ALL"
143 268
144/* 'DEFAULT' at the start of the cipher list insert the following string 269/* The following cipher list is used by default.
145 * in addition to this being the default cipher string */ 270 * It also is substituted when an application-defined cipher list string
146#define SSL_DEFAULT_CIPHER_LIST "ALL:!ADH:RC4+RSA:+SSLv2:@STRENGTH" 271 * starts with 'DEFAULT'. */
272#define SSL_DEFAULT_CIPHER_LIST "ALL:!ADH:+RC4:@STRENGTH" /* low priority for RC4 */
147 273
148/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */ 274/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */
149#define SSL_SENT_SHUTDOWN 1 275#define SSL_SENT_SHUTDOWN 1
@@ -164,8 +290,8 @@ extern "C" {
164extern "C" { 290extern "C" {
165#endif 291#endif
166 292
167#if (defined(NO_RSA) || defined(NO_MD5)) && !defined(NO_SSL2) 293#if (defined(OPENSSL_NO_RSA) || defined(OPENSSL_NO_MD5)) && !defined(OPENSSL_NO_SSL2)
168#define NO_SSL2 294#define OPENSSL_NO_SSL2
169#endif 295#endif
170 296
171#define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 297#define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1
@@ -211,8 +337,8 @@ typedef struct ssl_method_st
211 int (*ssl_shutdown)(SSL *s); 337 int (*ssl_shutdown)(SSL *s);
212 int (*ssl_renegotiate)(SSL *s); 338 int (*ssl_renegotiate)(SSL *s);
213 int (*ssl_renegotiate_check)(SSL *s); 339 int (*ssl_renegotiate_check)(SSL *s);
214 long (*ssl_ctrl)(SSL *s,int cmd,long larg,char *parg); 340 long (*ssl_ctrl)(SSL *s,int cmd,long larg,void *parg);
215 long (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,char *parg); 341 long (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,void *parg);
216 SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr); 342 SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr);
217 int (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr); 343 int (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr);
218 int (*ssl_pending)(SSL *s); 344 int (*ssl_pending)(SSL *s);
@@ -233,6 +359,7 @@ typedef struct ssl_method_st
233 * Cipher OCTET_STRING, -- the 3 byte cipher ID 359 * Cipher OCTET_STRING, -- the 3 byte cipher ID
234 * Session_ID OCTET_STRING, -- the Session ID 360 * Session_ID OCTET_STRING, -- the Session ID
235 * Master_key OCTET_STRING, -- the master key 361 * Master_key OCTET_STRING, -- the master key
362 * KRB5_principal OCTET_STRING -- optional Kerberos principal
236 * Key_Arg [ 0 ] IMPLICIT OCTET_STRING, -- the optional Key argument 363 * Key_Arg [ 0 ] IMPLICIT OCTET_STRING, -- the optional Key argument
237 * Time [ 1 ] EXPLICIT INTEGER, -- optional Start Time 364 * Time [ 1 ] EXPLICIT INTEGER, -- optional Start Time
238 * Timeout [ 2 ] EXPLICIT INTEGER, -- optional Timeout ins seconds 365 * Timeout [ 2 ] EXPLICIT INTEGER, -- optional Timeout ins seconds
@@ -263,6 +390,11 @@ typedef struct ssl_session_st
263 unsigned int sid_ctx_length; 390 unsigned int sid_ctx_length;
264 unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; 391 unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
265 392
393#ifndef OPENSSL_NO_KRB5
394 unsigned int krb5_client_princ_len;
395 unsigned char krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH];
396#endif /* OPENSSL_NO_KRB5 */
397
266 int not_resumable; 398 int not_resumable;
267 399
268 /* The cert is the certificate used to establish this connection */ 400 /* The cert is the certificate used to establish this connection */
@@ -306,21 +438,29 @@ typedef struct ssl_session_st
306#define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x00000080L 438#define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x00000080L
307#define SSL_OP_TLS_D5_BUG 0x00000100L 439#define SSL_OP_TLS_D5_BUG 0x00000100L
308#define SSL_OP_TLS_BLOCK_PADDING_BUG 0x00000200L 440#define SSL_OP_TLS_BLOCK_PADDING_BUG 0x00000200L
309#define SSL_OP_TLS_ROLLBACK_BUG 0x00000400L
310 441
311/* If set, always create a new key when using tmp_dh parameters */ 442/* If set, always create a new key when using tmp_dh parameters */
312#define SSL_OP_SINGLE_DH_USE 0x00100000L 443#define SSL_OP_SINGLE_DH_USE 0x00100000L
313/* Set to also use the tmp_rsa key when doing RSA operations. */ 444/* Set to always use the tmp_rsa key when doing RSA operations,
445 * even when this violates protocol specs */
314#define SSL_OP_EPHEMERAL_RSA 0x00200000L 446#define SSL_OP_EPHEMERAL_RSA 0x00200000L
447/* Set on servers to choose the cipher according to the server's
448 * preferences */
449#define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000L
450/* If set, a server will allow a client to issue a SSLv3.0 version number
451 * as latest version supported in the premaster secret, even when TLSv1.0
452 * (version 3.1) was announced in the client hello. Normally this is
453 * forbidden to prevent version rollback attacks. */
454#define SSL_OP_TLS_ROLLBACK_BUG 0x00800000L
455/* As server, disallow session resumption on renegotiation */
456#define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x01000000L
315 457
316/* The next flag deliberately changes the ciphertest, this is a check 458/* The next flag deliberately changes the ciphertest, this is a check
317 * for the PKCS#1 attack */ 459 * for the PKCS#1 attack */
318#define SSL_OP_PKCS1_CHECK_1 0x08000000L 460#define SSL_OP_PKCS1_CHECK_1 0x08000000L
319#define SSL_OP_PKCS1_CHECK_2 0x10000000L 461#define SSL_OP_PKCS1_CHECK_2 0x10000000L
320#define SSL_OP_NETSCAPE_CA_DN_BUG 0x20000000L 462#define SSL_OP_NETSCAPE_CA_DN_BUG 0x20000000L
321/* SSL_OP_NON_EXPORT_FIRST looks utterly broken .. */ 463#define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x40000000L
322#define SSL_OP_NON_EXPORT_FIRST 0x40000000L
323#define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x80000000L
324#define SSL_OP_ALL 0x000FFFFFL 464#define SSL_OP_ALL 0x000FFFFFL
325 465
326#define SSL_OP_NO_SSLv2 0x01000000L 466#define SSL_OP_NO_SSLv2 0x01000000L
@@ -343,30 +483,60 @@ typedef struct ssl_session_st
343 * they cannot be used to clear bits. */ 483 * they cannot be used to clear bits. */
344 484
345#define SSL_CTX_set_options(ctx,op) \ 485#define SSL_CTX_set_options(ctx,op) \
346 SSL_CTX_ctrl(ctx,SSL_CTRL_OPTIONS,op,NULL) 486 SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,(op),NULL)
347#define SSL_CTX_get_options(ctx) \ 487#define SSL_CTX_get_options(ctx) \
348 SSL_CTX_ctrl(ctx,SSL_CTRL_OPTIONS,0,NULL) 488 SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,0,NULL)
349#define SSL_set_options(ssl,op) \ 489#define SSL_set_options(ssl,op) \
350 SSL_ctrl(ssl,SSL_CTRL_OPTIONS,op,NULL) 490 SSL_ctrl((ssl),SSL_CTRL_OPTIONS,(op),NULL)
351#define SSL_get_options(ssl) \ 491#define SSL_get_options(ssl) \
352 SSL_ctrl(ssl,SSL_CTRL_OPTIONS,0,NULL) 492 SSL_ctrl((ssl),SSL_CTRL_OPTIONS,0,NULL)
353 493
354#define SSL_CTX_set_mode(ctx,op) \ 494#define SSL_CTX_set_mode(ctx,op) \
355 SSL_CTX_ctrl(ctx,SSL_CTRL_MODE,op,NULL) 495 SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL)
356#define SSL_CTX_get_mode(ctx) \ 496#define SSL_CTX_get_mode(ctx) \
357 SSL_CTX_ctrl(ctx,SSL_CTRL_MODE,0,NULL) 497 SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL)
358#define SSL_set_mode(ssl,op) \ 498#define SSL_set_mode(ssl,op) \
359 SSL_ctrl(ssl,SSL_CTRL_MODE,op,NULL) 499 SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL)
360#define SSL_get_mode(ssl) \ 500#define SSL_get_mode(ssl) \
361 SSL_ctrl(ssl,SSL_CTRL_MODE,0,NULL) 501 SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL)
502
503
504void 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));
505void 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));
506#define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg))
507#define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg))
508
509
510
511#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32)
512#define SSL_MAX_CERT_LIST_DEFAULT 1024*30 /* 30k max cert list :-) */
513#else
514#define SSL_MAX_CERT_LIST_DEFAULT 1024*100 /* 100k max cert list :-) */
515#endif
362 516
363#define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20) 517#define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20)
364 518
519/* This callback type is used inside SSL_CTX, SSL, and in the functions that set
520 * them. It is used to override the generation of SSL/TLS session IDs in a
521 * server. Return value should be zero on an error, non-zero to proceed. Also,
522 * callbacks should themselves check if the id they generate is unique otherwise
523 * the SSL handshake will fail with an error - callbacks can do this using the
524 * 'ssl' value they're passed by;
525 * SSL_has_matching_session_id(ssl, id, *id_len)
526 * The length value passed in is set at the maximum size the session ID can be.
527 * In SSLv2 this is 16 bytes, whereas SSLv3/TLSv1 it is 32 bytes. The callback
528 * can alter this length to be less if desired, but under SSLv2 session IDs are
529 * supposed to be fixed at 16 bytes so the id will be padded after the callback
530 * returns in this case. It is also an error for the callback to set the size to
531 * zero. */
532typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id,
533 unsigned int *id_len);
534
365typedef struct ssl_comp_st 535typedef struct ssl_comp_st
366 { 536 {
367 int id; 537 int id;
368 char *name; 538 char *name;
369#ifndef NO_COMP 539#ifndef OPENSSL_NO_COMP
370 COMP_METHOD *method; 540 COMP_METHOD *method;
371#else 541#else
372 char *method; 542 char *method;
@@ -378,8 +548,6 @@ DECLARE_STACK_OF(SSL_COMP)
378struct ssl_ctx_st 548struct ssl_ctx_st
379 { 549 {
380 SSL_METHOD *method; 550 SSL_METHOD *method;
381 unsigned long options;
382 unsigned long mode;
383 551
384 STACK_OF(SSL_CIPHER) *cipher_list; 552 STACK_OF(SSL_CIPHER) *cipher_list;
385 /* same as above but sorted for lookup */ 553 /* same as above but sorted for lookup */
@@ -417,6 +585,7 @@ struct ssl_ctx_st
417 void (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess); 585 void (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess);
418 SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, 586 SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl,
419 unsigned char *data,int len,int *copy); 587 unsigned char *data,int len,int *copy);
588
420 struct 589 struct
421 { 590 {
422 int sess_connect; /* SSL new conn - started */ 591 int sess_connect; /* SSL new conn - started */
@@ -439,37 +608,20 @@ struct ssl_ctx_st
439 608
440 int references; 609 int references;
441 610
442/**/ void (*info_callback)();
443
444 /* if defined, these override the X509_verify_cert() calls */ 611 /* if defined, these override the X509_verify_cert() calls */
445/**/ int (*app_verify_callback)(); 612 int (*app_verify_callback)(X509_STORE_CTX *, void *);
446/**/ char *app_verify_arg; /* never used; should be void * */ 613 void *app_verify_arg;
447 614 /* before OpenSSL 0.9.7, 'app_verify_arg' was ignored
448 /* default values to use in SSL structures */ 615 * ('app_verify_callback' was called with just one argument) */
449/**/ struct cert_st /* CERT */ *cert;
450/**/ int read_ahead;
451/**/ int verify_mode;
452/**/ int verify_depth;
453/**/ unsigned int sid_ctx_length;
454/**/ unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
455/**/ int (*default_verify_callback)(int ok,X509_STORE_CTX *ctx);
456
457 int purpose; /* Purpose setting */
458 int trust; /* Trust setting */
459 616
460 /* Default password callback. */ 617 /* Default password callback. */
461/**/ pem_password_cb *default_passwd_callback; 618 pem_password_cb *default_passwd_callback;
462 619
463 /* Default password callback user data. */ 620 /* Default password callback user data. */
464/**/ void *default_passwd_callback_userdata; 621 void *default_passwd_callback_userdata;
465 622
466 /* get client cert callback */ 623 /* get client cert callback */
467/**/ int (*client_cert_cb)(/* SSL *ssl, X509 **x509, EVP_PKEY **pkey */); 624 int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey);
468
469 /* what we put in client cert requests */
470 STACK_OF(X509_NAME) *client_CA;
471
472/**/ int quiet_shutdown;
473 625
474 CRYPTO_EX_DATA ex_data; 626 CRYPTO_EX_DATA ex_data;
475 627
@@ -478,7 +630,43 @@ struct ssl_ctx_st
478 const EVP_MD *sha1; /* For SSLv3/TLSv1 'ssl3->sha1' */ 630 const EVP_MD *sha1; /* For SSLv3/TLSv1 'ssl3->sha1' */
479 631
480 STACK_OF(X509) *extra_certs; 632 STACK_OF(X509) *extra_certs;
481 STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */ 633 STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */
634
635
636 /* Default values used when no per-SSL value is defined follow */
637
638 void (*info_callback)(const SSL *ssl,int type,int val); /* used if SSL's info_callback is NULL */
639
640 /* what we put in client cert requests */
641 STACK_OF(X509_NAME) *client_CA;
642
643
644 /* Default values to use in SSL structures follow (these are copied by SSL_new) */
645
646 unsigned long options;
647 unsigned long mode;
648 long max_cert_list;
649
650 struct cert_st /* CERT */ *cert;
651 int read_ahead;
652
653 /* callback that allows applications to peek at protocol messages */
654 void (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);
655 void *msg_callback_arg;
656
657 int verify_mode;
658 int verify_depth;
659 unsigned int sid_ctx_length;
660 unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
661 int (*default_verify_callback)(int ok,X509_STORE_CTX *ctx); /* called 'verify_callback' in the SSL */
662
663 /* Default generate session ID callback. */
664 GEN_SESSION_CB generate_session_id;
665
666 int purpose; /* Purpose setting */
667 int trust; /* Trust setting */
668
669 int quiet_shutdown;
482 }; 670 };
483 671
484#define SSL_SESS_CACHE_OFF 0x0000 672#define SSL_SESS_CACHE_OFF 0x0000
@@ -553,7 +741,7 @@ struct ssl_st
553 * same. This is so data can be read and written to different 741 * same. This is so data can be read and written to different
554 * handlers */ 742 * handlers */
555 743
556#ifndef NO_BIO 744#ifndef OPENSSL_NO_BIO
557 BIO *rbio; /* used by SSL_read */ 745 BIO *rbio; /* used by SSL_read */
558 BIO *wbio; /* used by SSL_write */ 746 BIO *wbio; /* used by SSL_write */
559 BIO *bbio; /* used during session-id reuse to concatenate 747 BIO *bbio; /* used during session-id reuse to concatenate
@@ -583,7 +771,12 @@ struct ssl_st
583 771
584 int server; /* are we the server side? - mostly used by SSL_clear*/ 772 int server; /* are we the server side? - mostly used by SSL_clear*/
585 773
586 int new_session;/* 1 if we are to use a new session */ 774 int new_session;/* 1 if we are to use a new session.
775 * 2 if we are a server and are inside a handshake
776 * (i.e. not just sending a HelloRequest)
777 * NB: For servers, the 'new' session may actually be a previously
778 * cached session or even the previous session unless
779 * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */
587 int quiet_shutdown;/* don't send shutdown packets */ 780 int quiet_shutdown;/* don't send shutdown packets */
588 int shutdown; /* we have shut things down, 0x01 sent, 0x02 781 int shutdown; /* we have shut things down, 0x01 sent, 0x02
589 * for received */ 782 * for received */
@@ -591,6 +784,7 @@ struct ssl_st
591 int rstate; /* where we are when reading */ 784 int rstate; /* where we are when reading */
592 785
593 BUF_MEM *init_buf; /* buffer used during init */ 786 BUF_MEM *init_buf; /* buffer used during init */
787 void *init_msg; /* pointer to handshake message body, set by ssl3_get_message() */
594 int init_num; /* amount read/written */ 788 int init_num; /* amount read/written */
595 int init_off; /* amount read/written */ 789 int init_off; /* amount read/written */
596 790
@@ -603,6 +797,11 @@ struct ssl_st
603 797
604 int read_ahead; /* Read as many input bytes as possible 798 int read_ahead; /* Read as many input bytes as possible
605 * (for non-blocking reads) */ 799 * (for non-blocking reads) */
800
801 /* callback that allows applications to peek at protocol messages */
802 void (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);
803 void *msg_callback_arg;
804
606 int hit; /* reusing a previous session */ 805 int hit; /* reusing a previous session */
607 806
608 int purpose; /* Purpose setting */ 807 int purpose; /* Purpose setting */
@@ -617,7 +816,7 @@ struct ssl_st
617 816
618 EVP_CIPHER_CTX *enc_read_ctx; /* cryptographic state */ 817 EVP_CIPHER_CTX *enc_read_ctx; /* cryptographic state */
619 const EVP_MD *read_hash; /* used for mac generation */ 818 const EVP_MD *read_hash; /* used for mac generation */
620#ifndef NO_COMP 819#ifndef OPENSSL_NO_COMP
621 COMP_CTX *expand; /* uncompress */ 820 COMP_CTX *expand; /* uncompress */
622#else 821#else
623 char *expand; 822 char *expand;
@@ -625,7 +824,7 @@ struct ssl_st
625 824
626 EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */ 825 EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */
627 const EVP_MD *write_hash; /* used for mac generation */ 826 const EVP_MD *write_hash; /* used for mac generation */
628#ifndef NO_COMP 827#ifndef OPENSSL_NO_COMP
629 COMP_CTX *compress; /* compression */ 828 COMP_CTX *compress; /* compression */
630#else 829#else
631 char *compress; 830 char *compress;
@@ -645,16 +844,24 @@ struct ssl_st
645 /* This can also be in the session once a session is established */ 844 /* This can also be in the session once a session is established */
646 SSL_SESSION *session; 845 SSL_SESSION *session;
647 846
847 /* Default generate session ID callback. */
848 GEN_SESSION_CB generate_session_id;
849
648 /* Used in SSL2 and SSL3 */ 850 /* Used in SSL2 and SSL3 */
649 int verify_mode; /* 0 don't care about verify failure. 851 int verify_mode; /* 0 don't care about verify failure.
650 * 1 fail if verify fails */ 852 * 1 fail if verify fails */
651 int verify_depth; 853 int verify_depth;
652 int (*verify_callback)(int ok,X509_STORE_CTX *ctx); /* fail if callback returns 0 */ 854 int (*verify_callback)(int ok,X509_STORE_CTX *ctx); /* fail if callback returns 0 */
653 void (*info_callback)(); /* optional informational callback */ 855
856 void (*info_callback)(const SSL *ssl,int type,int val); /* optional informational callback */
654 857
655 int error; /* error bytes to be written */ 858 int error; /* error bytes to be written */
656 int error_code; /* actual code */ 859 int error_code; /* actual code */
657 860
861#ifndef OPENSSL_NO_KRB5
862 KSSL_CTX *kssl_ctx; /* Kerberos 5 context */
863#endif /* OPENSSL_NO_KRB5 */
864
658 SSL_CTX *ctx; 865 SSL_CTX *ctx;
659 /* set this flag to 1 and a sleep(1) is put into all SSL_read() 866 /* set this flag to 1 and a sleep(1) is put into all SSL_read()
660 * and SSL_write() calls, good for nbio debuging :-) */ 867 * and SSL_write() calls, good for nbio debuging :-) */
@@ -670,6 +877,7 @@ struct ssl_st
670 int references; 877 int references;
671 unsigned long options; /* protocol behaviour */ 878 unsigned long options; /* protocol behaviour */
672 unsigned long mode; /* API behaviour */ 879 unsigned long mode; /* API behaviour */
880 long max_cert_list;
673 int first_packet; 881 int first_packet;
674 int client_version; /* what was passed, used for 882 int client_version; /* what was passed, used for
675 * SSLv3/TLS rollback check */ 883 * SSLv3/TLS rollback check */
@@ -831,13 +1039,14 @@ size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count);
831#define SSL_ERROR_SYSCALL 5 /* look at error stack/return value/errno */ 1039#define SSL_ERROR_SYSCALL 5 /* look at error stack/return value/errno */
832#define SSL_ERROR_ZERO_RETURN 6 1040#define SSL_ERROR_ZERO_RETURN 6
833#define SSL_ERROR_WANT_CONNECT 7 1041#define SSL_ERROR_WANT_CONNECT 7
1042#define SSL_ERROR_WANT_ACCEPT 8
834 1043
835#define SSL_CTRL_NEED_TMP_RSA 1 1044#define SSL_CTRL_NEED_TMP_RSA 1
836#define SSL_CTRL_SET_TMP_RSA 2 1045#define SSL_CTRL_SET_TMP_RSA 2
837#define SSL_CTRL_SET_TMP_DH 3 1046#define SSL_CTRL_SET_TMP_DH 3
838#define SSL_CTRL_SET_TMP_RSA_CB 4 1047#define SSL_CTRL_SET_TMP_RSA_CB 4
839#define SSL_CTRL_SET_TMP_DH_CB 5 1048#define SSL_CTRL_SET_TMP_DH_CB 5
840/* Add these ones */ 1049
841#define SSL_CTRL_GET_SESSION_REUSED 6 1050#define SSL_CTRL_GET_SESSION_REUSED 6
842#define SSL_CTRL_GET_CLIENT_CERT_REQUEST 7 1051#define SSL_CTRL_GET_CLIENT_CERT_REQUEST 7
843#define SSL_CTRL_GET_NUM_RENEGOTIATIONS 8 1052#define SSL_CTRL_GET_NUM_RENEGOTIATIONS 8
@@ -846,6 +1055,9 @@ size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count);
846#define SSL_CTRL_GET_FLAGS 11 1055#define SSL_CTRL_GET_FLAGS 11
847#define SSL_CTRL_EXTRA_CHAIN_CERT 12 1056#define SSL_CTRL_EXTRA_CHAIN_CERT 12
848 1057
1058#define SSL_CTRL_SET_MSG_CALLBACK 13
1059#define SSL_CTRL_SET_MSG_CALLBACK_ARG 14
1060
849/* Stats */ 1061/* Stats */
850#define SSL_CTRL_SESS_NUMBER 20 1062#define SSL_CTRL_SESS_NUMBER 20
851#define SSL_CTRL_SESS_CONNECT 21 1063#define SSL_CTRL_SESS_CONNECT 21
@@ -860,7 +1072,7 @@ size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count);
860#define SSL_CTRL_SESS_TIMEOUTS 30 1072#define SSL_CTRL_SESS_TIMEOUTS 30
861#define SSL_CTRL_SESS_CACHE_FULL 31 1073#define SSL_CTRL_SESS_CACHE_FULL 31
862#define SSL_CTRL_OPTIONS 32 1074#define SSL_CTRL_OPTIONS 32
863#define SSL_CTRL_MODE 33 1075#define SSL_CTRL_MODE 33
864 1076
865#define SSL_CTRL_GET_READ_AHEAD 40 1077#define SSL_CTRL_GET_READ_AHEAD 40
866#define SSL_CTRL_SET_READ_AHEAD 41 1078#define SSL_CTRL_SET_READ_AHEAD 41
@@ -869,6 +1081,9 @@ size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count);
869#define SSL_CTRL_SET_SESS_CACHE_MODE 44 1081#define SSL_CTRL_SET_SESS_CACHE_MODE 44
870#define SSL_CTRL_GET_SESS_CACHE_MODE 45 1082#define SSL_CTRL_GET_SESS_CACHE_MODE 45
871 1083
1084#define SSL_CTRL_GET_MAX_CERT_LIST 50
1085#define SSL_CTRL_SET_MAX_CERT_LIST 51
1086
872#define SSL_session_reused(ssl) \ 1087#define SSL_session_reused(ssl) \
873 SSL_ctrl((ssl),SSL_CTRL_GET_SESSION_REUSED,0,NULL) 1088 SSL_ctrl((ssl),SSL_CTRL_GET_SESSION_REUSED,0,NULL)
874#define SSL_num_renegotiations(ssl) \ 1089#define SSL_num_renegotiations(ssl) \
@@ -895,23 +1110,7 @@ size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count);
895#define SSL_CTX_add_extra_chain_cert(ctx,x509) \ 1110#define SSL_CTX_add_extra_chain_cert(ctx,x509) \
896 SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509) 1111 SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509)
897 1112
898/* VMS uses only 31 characters for symbols. */ 1113#ifndef OPENSSL_NO_BIO
899#ifdef VMS
900#undef SSL_CTX_set_cert_verify_callback
901#define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb
902#undef SSL_CTX_use_certificate_chain_file
903#define SSL_CTX_use_certificate_chain_file SSL_CTX_use_cert_chain_file
904#undef SSL_CTX_set_default_verify_paths
905#define SSL_CTX_set_default_verify_paths SSL_CTX_set_def_verify_paths
906#undef SSL_get_ex_data_X509_STORE_CTX_idx
907#define SSL_get_ex_data_X509_STORE_CTX_idx SSL_get_ex_data_X509_STOR_CTX_i
908#undef SSL_add_file_cert_subjects_to_stack
909#define SSL_add_file_cert_subjects_to_stack SSL_add_file_cert_sub_to_stack
910#undef SSL_add_dir_cert_subjects_to_stack
911#define SSL_add_dir_cert_subjects_to_stack SSL_add_dir_cert_sub_to_stack
912#endif
913
914#ifndef NO_BIO
915BIO_METHOD *BIO_f_ssl(void); 1114BIO_METHOD *BIO_f_ssl(void);
916BIO *BIO_new_ssl(SSL_CTX *ctx,int client); 1115BIO *BIO_new_ssl(SSL_CTX *ctx,int client);
917BIO *BIO_new_ssl_connect(SSL_CTX *ctx); 1116BIO *BIO_new_ssl_connect(SSL_CTX *ctx);
@@ -939,16 +1138,18 @@ char * SSL_CIPHER_get_version(SSL_CIPHER *c);
939const char * SSL_CIPHER_get_name(SSL_CIPHER *c); 1138const char * SSL_CIPHER_get_name(SSL_CIPHER *c);
940 1139
941int SSL_get_fd(SSL *s); 1140int SSL_get_fd(SSL *s);
1141int SSL_get_rfd(SSL *s);
1142int SSL_get_wfd(SSL *s);
942const char * SSL_get_cipher_list(SSL *s,int n); 1143const char * SSL_get_cipher_list(SSL *s,int n);
943char * SSL_get_shared_ciphers(SSL *s, char *buf, int len); 1144char * SSL_get_shared_ciphers(SSL *s, char *buf, int len);
944int SSL_get_read_ahead(SSL * s); 1145int SSL_get_read_ahead(SSL * s);
945int SSL_pending(SSL *s); 1146int SSL_pending(SSL *s);
946#ifndef NO_SOCK 1147#ifndef OPENSSL_NO_SOCK
947int SSL_set_fd(SSL *s, int fd); 1148int SSL_set_fd(SSL *s, int fd);
948int SSL_set_rfd(SSL *s, int fd); 1149int SSL_set_rfd(SSL *s, int fd);
949int SSL_set_wfd(SSL *s, int fd); 1150int SSL_set_wfd(SSL *s, int fd);
950#endif 1151#endif
951#ifndef NO_BIO 1152#ifndef OPENSSL_NO_BIO
952void SSL_set_bio(SSL *s, BIO *rbio,BIO *wbio); 1153void SSL_set_bio(SSL *s, BIO *rbio,BIO *wbio);
953BIO * SSL_get_rbio(SSL *s); 1154BIO * SSL_get_rbio(SSL *s);
954BIO * SSL_get_wbio(SSL *s); 1155BIO * SSL_get_wbio(SSL *s);
@@ -961,7 +1162,7 @@ int (*SSL_get_verify_callback(SSL *s))(int,X509_STORE_CTX *);
961void SSL_set_verify(SSL *s, int mode, 1162void SSL_set_verify(SSL *s, int mode,
962 int (*callback)(int ok,X509_STORE_CTX *ctx)); 1163 int (*callback)(int ok,X509_STORE_CTX *ctx));
963void SSL_set_verify_depth(SSL *s, int depth); 1164void SSL_set_verify_depth(SSL *s, int depth);
964#ifndef NO_RSA 1165#ifndef OPENSSL_NO_RSA
965int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); 1166int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa);
966#endif 1167#endif
967int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len); 1168int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len);
@@ -970,7 +1171,7 @@ int SSL_use_PrivateKey_ASN1(int pk,SSL *ssl, unsigned char *d, long len);
970int SSL_use_certificate(SSL *ssl, X509 *x); 1171int SSL_use_certificate(SSL *ssl, X509 *x);
971int SSL_use_certificate_ASN1(SSL *ssl, unsigned char *d, int len); 1172int SSL_use_certificate_ASN1(SSL *ssl, unsigned char *d, int len);
972 1173
973#ifndef NO_STDIO 1174#ifndef OPENSSL_NO_STDIO
974int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); 1175int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type);
975int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type); 1176int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type);
976int SSL_use_certificate_file(SSL *ssl, const char *file, int type); 1177int SSL_use_certificate_file(SSL *ssl, const char *file, int type);
@@ -981,16 +1182,22 @@ int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); /* PEM t
981STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); 1182STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);
982int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, 1183int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
983 const char *file); 1184 const char *file);
1185#ifndef OPENSSL_SYS_WIN32
1186#ifndef OPENSSL_SYS_VMS
1187#ifndef OPENSSL_SYS_MACINTOSH_CLASSIC /* XXXXX: Better scheme needed! [was: #ifndef MAC_OS_pre_X] */
984int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, 1188int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
985 const char *dir); 1189 const char *dir);
986#endif 1190#endif
1191#endif
1192#endif
1193
1194#endif
987 1195
988void ERR_load_SSL_strings(void );
989void SSL_load_error_strings(void ); 1196void SSL_load_error_strings(void );
990char * SSL_state_string(SSL *s); 1197const char *SSL_state_string(const SSL *s);
991char * SSL_rstate_string(SSL *s); 1198const char *SSL_rstate_string(const SSL *s);
992char * SSL_state_string_long(SSL *s); 1199const char *SSL_state_string_long(const SSL *s);
993char * SSL_rstate_string_long(SSL *s); 1200const char *SSL_rstate_string_long(const SSL *s);
994long SSL_SESSION_get_time(SSL_SESSION *s); 1201long SSL_SESSION_get_time(SSL_SESSION *s);
995long SSL_SESSION_set_time(SSL_SESSION *s, long t); 1202long SSL_SESSION_set_time(SSL_SESSION *s, long t);
996long SSL_SESSION_get_timeout(SSL_SESSION *s); 1203long SSL_SESSION_get_timeout(SSL_SESSION *s);
@@ -1000,10 +1207,10 @@ void SSL_copy_session_id(SSL *to,SSL *from);
1000SSL_SESSION *SSL_SESSION_new(void); 1207SSL_SESSION *SSL_SESSION_new(void);
1001unsigned long SSL_SESSION_hash(SSL_SESSION *a); 1208unsigned long SSL_SESSION_hash(SSL_SESSION *a);
1002int SSL_SESSION_cmp(SSL_SESSION *a,SSL_SESSION *b); 1209int SSL_SESSION_cmp(SSL_SESSION *a,SSL_SESSION *b);
1003#ifndef NO_FP_API 1210#ifndef OPENSSL_NO_FP_API
1004int SSL_SESSION_print_fp(FILE *fp,SSL_SESSION *ses); 1211int SSL_SESSION_print_fp(FILE *fp,SSL_SESSION *ses);
1005#endif 1212#endif
1006#ifndef NO_BIO 1213#ifndef OPENSSL_NO_BIO
1007int SSL_SESSION_print(BIO *fp,SSL_SESSION *ses); 1214int SSL_SESSION_print(BIO *fp,SSL_SESSION *ses);
1008#endif 1215#endif
1009void SSL_SESSION_free(SSL_SESSION *ses); 1216void SSL_SESSION_free(SSL_SESSION *ses);
@@ -1011,6 +1218,10 @@ int i2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp);
1011int SSL_set_session(SSL *to, SSL_SESSION *session); 1218int SSL_set_session(SSL *to, SSL_SESSION *session);
1012int SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c); 1219int SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c);
1013int SSL_CTX_remove_session(SSL_CTX *,SSL_SESSION *c); 1220int SSL_CTX_remove_session(SSL_CTX *,SSL_SESSION *c);
1221int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB);
1222int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB);
1223int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id,
1224 unsigned int id_len);
1014SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,unsigned char **pp,long length); 1225SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,unsigned char **pp,long length);
1015 1226
1016#ifdef HEADER_X509_H 1227#ifdef HEADER_X509_H
@@ -1019,18 +1230,14 @@ X509 * SSL_get_peer_certificate(SSL *s);
1019 1230
1020STACK_OF(X509) *SSL_get_peer_cert_chain(SSL *s); 1231STACK_OF(X509) *SSL_get_peer_cert_chain(SSL *s);
1021 1232
1022#ifdef VMS
1023#define SSL_CTX_set_default_passwd_cb_userdata SSL_CTX_set_def_passwd_cb_ud
1024#endif
1025
1026int SSL_CTX_get_verify_mode(SSL_CTX *ctx); 1233int SSL_CTX_get_verify_mode(SSL_CTX *ctx);
1027int SSL_CTX_get_verify_depth(SSL_CTX *ctx); 1234int SSL_CTX_get_verify_depth(SSL_CTX *ctx);
1028int (*SSL_CTX_get_verify_callback(SSL_CTX *ctx))(int,X509_STORE_CTX *); 1235int (*SSL_CTX_get_verify_callback(SSL_CTX *ctx))(int,X509_STORE_CTX *);
1029void SSL_CTX_set_verify(SSL_CTX *ctx,int mode, 1236void SSL_CTX_set_verify(SSL_CTX *ctx,int mode,
1030 int (*callback)(int, X509_STORE_CTX *)); 1237 int (*callback)(int, X509_STORE_CTX *));
1031void SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth); 1238void SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth);
1032void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*cb)(),char *arg); 1239void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*cb)(X509_STORE_CTX *,void *), void *arg);
1033#ifndef NO_RSA 1240#ifndef OPENSSL_NO_RSA
1034int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); 1241int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);
1035#endif 1242#endif
1036int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, unsigned char *d, long len); 1243int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, unsigned char *d, long len);
@@ -1064,9 +1271,9 @@ int SSL_connect(SSL *ssl);
1064int SSL_read(SSL *ssl,void *buf,int num); 1271int SSL_read(SSL *ssl,void *buf,int num);
1065int SSL_peek(SSL *ssl,void *buf,int num); 1272int SSL_peek(SSL *ssl,void *buf,int num);
1066int SSL_write(SSL *ssl,const void *buf,int num); 1273int SSL_write(SSL *ssl,const void *buf,int num);
1067long SSL_ctrl(SSL *ssl,int cmd, long larg, char *parg); 1274long SSL_ctrl(SSL *ssl,int cmd, long larg, void *parg);
1068long SSL_callback_ctrl(SSL *, int, void (*)()); 1275long SSL_callback_ctrl(SSL *, int, void (*)());
1069long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, char *parg); 1276long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, void *parg);
1070long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)()); 1277long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)());
1071 1278
1072int SSL_get_error(SSL *s,int ret_code); 1279int SSL_get_error(SSL *s,int ret_code);
@@ -1095,14 +1302,15 @@ STACK_OF(SSL_CIPHER) *SSL_get_ciphers(SSL *s);
1095 1302
1096int SSL_do_handshake(SSL *s); 1303int SSL_do_handshake(SSL *s);
1097int SSL_renegotiate(SSL *s); 1304int SSL_renegotiate(SSL *s);
1305int SSL_renegotiate_pending(SSL *s);
1098int SSL_shutdown(SSL *s); 1306int SSL_shutdown(SSL *s);
1099 1307
1100SSL_METHOD *SSL_get_ssl_method(SSL *s); 1308SSL_METHOD *SSL_get_ssl_method(SSL *s);
1101int SSL_set_ssl_method(SSL *s,SSL_METHOD *method); 1309int SSL_set_ssl_method(SSL *s,SSL_METHOD *method);
1102char *SSL_alert_type_string_long(int value); 1310const char *SSL_alert_type_string_long(int value);
1103char *SSL_alert_type_string(int value); 1311const char *SSL_alert_type_string(int value);
1104char *SSL_alert_desc_string_long(int value); 1312const char *SSL_alert_desc_string_long(int value);
1105char *SSL_alert_desc_string(int value); 1313const char *SSL_alert_desc_string(int value);
1106 1314
1107void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *list); 1315void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *list);
1108void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *list); 1316void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *list);
@@ -1140,8 +1348,9 @@ int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
1140SSL_SESSION *SSL_get_session(SSL *ssl); 1348SSL_SESSION *SSL_get_session(SSL *ssl);
1141SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ 1349SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */
1142SSL_CTX *SSL_get_SSL_CTX(SSL *ssl); 1350SSL_CTX *SSL_get_SSL_CTX(SSL *ssl);
1143void SSL_set_info_callback(SSL *ssl,void (*cb)()); 1351void SSL_set_info_callback(SSL *ssl,
1144void (*SSL_get_info_callback(SSL *ssl))(); 1352 void (*cb)(const SSL *ssl,int type,int val));
1353void (*SSL_get_info_callback(SSL *ssl))(const SSL *ssl,int type,int val);
1145int SSL_state(SSL *ssl); 1354int SSL_state(SSL *ssl);
1146 1355
1147void SSL_set_verify_result(SSL *ssl,long v); 1356void SSL_set_verify_result(SSL *ssl,long v);
@@ -1179,9 +1388,17 @@ int SSL_get_ex_data_X509_STORE_CTX_idx(void );
1179 SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL) 1388 SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL)
1180#define SSL_CTX_set_read_ahead(ctx,m) \ 1389#define SSL_CTX_set_read_ahead(ctx,m) \
1181 SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL) 1390 SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL)
1391#define SSL_CTX_get_max_cert_list(ctx) \
1392 SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL)
1393#define SSL_CTX_set_max_cert_list(ctx,m) \
1394 SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)
1395#define SSL_get_max_cert_list(ssl) \
1396 SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL)
1397#define SSL_set_max_cert_list(ssl,m) \
1398 SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)
1182 1399
1183 /* NB: the keylength is only applicable when is_export is true */ 1400 /* NB: the keylength is only applicable when is_export is true */
1184#ifndef NO_RSA 1401#ifndef OPENSSL_NO_RSA
1185void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, 1402void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,
1186 RSA *(*cb)(SSL *ssl,int is_export, 1403 RSA *(*cb)(SSL *ssl,int is_export,
1187 int keylength)); 1404 int keylength));
@@ -1190,7 +1407,7 @@ void SSL_set_tmp_rsa_callback(SSL *ssl,
1190 RSA *(*cb)(SSL *ssl,int is_export, 1407 RSA *(*cb)(SSL *ssl,int is_export,
1191 int keylength)); 1408 int keylength));
1192#endif 1409#endif
1193#ifndef NO_DH 1410#ifndef OPENSSL_NO_DH
1194void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, 1411void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,
1195 DH *(*dh)(SSL *ssl,int is_export, 1412 DH *(*dh)(SSL *ssl,int is_export,
1196 int keylength)); 1413 int keylength));
@@ -1199,7 +1416,7 @@ void SSL_set_tmp_dh_callback(SSL *ssl,
1199 int keylength)); 1416 int keylength));
1200#endif 1417#endif
1201 1418
1202#ifndef NO_COMP 1419#ifndef OPENSSL_NO_COMP
1203int SSL_COMP_add_compression_method(int id,COMP_METHOD *cm); 1420int SSL_COMP_add_compression_method(int id,COMP_METHOD *cm);
1204#else 1421#else
1205int SSL_COMP_add_compression_method(int id,char *cm); 1422int SSL_COMP_add_compression_method(int id,char *cm);
@@ -1254,6 +1471,7 @@ void ERR_load_SSL_strings(void);
1254#define SSL_F_SSL3_CTRL 213 1471#define SSL_F_SSL3_CTRL 213
1255#define SSL_F_SSL3_CTX_CTRL 133 1472#define SSL_F_SSL3_CTX_CTRL 133
1256#define SSL_F_SSL3_ENC 134 1473#define SSL_F_SSL3_ENC 134
1474#define SSL_F_SSL3_GENERATE_KEY_BLOCK 238
1257#define SSL_F_SSL3_GET_CERTIFICATE_REQUEST 135 1475#define SSL_F_SSL3_GET_CERTIFICATE_REQUEST 135
1258#define SSL_F_SSL3_GET_CERT_VERIFY 136 1476#define SSL_F_SSL3_GET_CERT_VERIFY 136
1259#define SSL_F_SSL3_GET_CLIENT_CERTIFICATE 137 1477#define SSL_F_SSL3_GET_CLIENT_CERTIFICATE 137
@@ -1403,6 +1621,7 @@ void ERR_load_SSL_strings(void);
1403#define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 145 1621#define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 145
1404#define SSL_R_DATA_LENGTH_TOO_LONG 146 1622#define SSL_R_DATA_LENGTH_TOO_LONG 146
1405#define SSL_R_DECRYPTION_FAILED 147 1623#define SSL_R_DECRYPTION_FAILED 147
1624#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 1109
1406#define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148 1625#define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148
1407#define SSL_R_DIGEST_CHECK_FAILED 149 1626#define SSL_R_DIGEST_CHECK_FAILED 149
1408#define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150 1627#define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150
@@ -1413,15 +1632,27 @@ void ERR_load_SSL_strings(void);
1413#define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154 1632#define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154
1414#define SSL_R_HTTPS_PROXY_REQUEST 155 1633#define SSL_R_HTTPS_PROXY_REQUEST 155
1415#define SSL_R_HTTP_REQUEST 156 1634#define SSL_R_HTTP_REQUEST 156
1416#define SSL_R_INTERNAL_ERROR 157 1635#define SSL_R_ILLEGAL_PADDING 1110
1417#define SSL_R_INVALID_CHALLENGE_LENGTH 158 1636#define SSL_R_INVALID_CHALLENGE_LENGTH 158
1418#define SSL_R_INVALID_COMMAND 280 1637#define SSL_R_INVALID_COMMAND 280
1419#define SSL_R_INVALID_PURPOSE 278 1638#define SSL_R_INVALID_PURPOSE 278
1420#define SSL_R_INVALID_TRUST 279 1639#define SSL_R_INVALID_TRUST 279
1640#define SSL_R_KRB5 1104
1641#define SSL_R_KRB5_C_CC_PRINC 1094
1642#define SSL_R_KRB5_C_GET_CRED 1095
1643#define SSL_R_KRB5_C_INIT 1096
1644#define SSL_R_KRB5_C_MK_REQ 1097
1645#define SSL_R_KRB5_S_BAD_TICKET 1098
1646#define SSL_R_KRB5_S_INIT 1099
1647#define SSL_R_KRB5_S_RD_REQ 1108
1648#define SSL_R_KRB5_S_TKT_EXPIRED 1105
1649#define SSL_R_KRB5_S_TKT_NYV 1106
1650#define SSL_R_KRB5_S_TKT_SKEW 1107
1421#define SSL_R_LENGTH_MISMATCH 159 1651#define SSL_R_LENGTH_MISMATCH 159
1422#define SSL_R_LENGTH_TOO_SHORT 160 1652#define SSL_R_LENGTH_TOO_SHORT 160
1423#define SSL_R_LIBRARY_BUG 274 1653#define SSL_R_LIBRARY_BUG 274
1424#define SSL_R_LIBRARY_HAS_NO_CIPHERS 161 1654#define SSL_R_LIBRARY_HAS_NO_CIPHERS 161
1655#define SSL_R_MESSAGE_TOO_LONG 1111
1425#define SSL_R_MISSING_DH_DSA_CERT 162 1656#define SSL_R_MISSING_DH_DSA_CERT 162
1426#define SSL_R_MISSING_DH_KEY 163 1657#define SSL_R_MISSING_DH_KEY 163
1427#define SSL_R_MISSING_DH_RSA_CERT 164 1658#define SSL_R_MISSING_DH_RSA_CERT 164
@@ -1505,7 +1736,10 @@ void ERR_load_SSL_strings(void);
1505#define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228 1736#define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228
1506#define SSL_R_SSL_HANDSHAKE_FAILURE 229 1737#define SSL_R_SSL_HANDSHAKE_FAILURE 229
1507#define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230 1738#define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230
1739#define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 1102
1740#define SSL_R_SSL_SESSION_ID_CONFLICT 1103
1508#define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273 1741#define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273
1742#define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 1101
1509#define SSL_R_SSL_SESSION_ID_IS_DIFFERENT 231 1743#define SSL_R_SSL_SESSION_ID_IS_DIFFERENT 231
1510#define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049 1744#define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049
1511#define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050 1745#define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050