summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_locl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/ssl_locl.h')
-rw-r--r--src/lib/libssl/ssl_locl.h300
1 files changed, 102 insertions, 198 deletions
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h
index 4c78393f3f..ed4ddbbae6 100644
--- a/src/lib/libssl/ssl_locl.h
+++ b/src/lib/libssl/ssl_locl.h
@@ -56,7 +56,7 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58/* ==================================================================== 58/* ====================================================================
59 * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. 59 * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
60 * 60 *
61 * Redistribution and use in source and binary forms, with or without 61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions 62 * modification, are permitted provided that the following conditions
@@ -113,32 +113,6 @@
113 * ECC cipher suite support in OpenSSL originally developed by 113 * ECC cipher suite support in OpenSSL originally developed by
114 * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. 114 * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
115 */ 115 */
116/* ====================================================================
117 * Copyright 2005 Nokia. All rights reserved.
118 *
119 * The portions of the attached software ("Contribution") is developed by
120 * Nokia Corporation and is licensed pursuant to the OpenSSL open source
121 * license.
122 *
123 * The Contribution, originally written by Mika Kousa and Pasi Eronen of
124 * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
125 * support (see RFC 4279) to OpenSSL.
126 *
127 * No patent licenses or other rights except those expressly stated in
128 * the OpenSSL open source license shall be deemed granted or received
129 * expressly, by implication, estoppel, or otherwise.
130 *
131 * No assurances are provided by Nokia that the Contribution does not
132 * infringe the patent or other intellectual property rights of any third
133 * party or that the license provides you with all the necessary rights
134 * to make use of the Contribution.
135 *
136 * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
137 * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
138 * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
139 * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
140 * OTHERWISE.
141 */
142 116
143#ifndef HEADER_SSL_LOCL_H 117#ifndef HEADER_SSL_LOCL_H
144#define HEADER_SSL_LOCL_H 118#define HEADER_SSL_LOCL_H
@@ -277,84 +251,58 @@
277 * that the different entities within are mutually exclusive: 251 * that the different entities within are mutually exclusive:
278 * ONLY ONE BIT PER MASK CAN BE SET AT A TIME. 252 * ONLY ONE BIT PER MASK CAN BE SET AT A TIME.
279 */ 253 */
280 254#define SSL_MKEY_MASK 0x000000FFL
281/* Bits for algorithm_mkey (key exchange algorithm) */
282#define SSL_kRSA 0x00000001L /* RSA key exchange */ 255#define SSL_kRSA 0x00000001L /* RSA key exchange */
283#define SSL_kDHr 0x00000002L /* DH cert, RSA CA cert */ /* no such ciphersuites supported! */ 256#define SSL_kDHr 0x00000002L /* DH cert RSA CA cert */
284#define SSL_kDHd 0x00000004L /* DH cert, DSA CA cert */ /* no such ciphersuite supported! */ 257#define SSL_kDHd 0x00000004L /* DH cert DSA CA cert */
285#define SSL_kEDH 0x00000008L /* tmp DH key no DH cert */ 258#define SSL_kFZA 0x00000008L
286#define SSL_kKRB5 0x00000010L /* Kerberos5 key exchange */ 259#define SSL_kEDH 0x00000010L /* tmp DH key no DH cert */
287#define SSL_kECDHr 0x00000020L /* ECDH cert, RSA CA cert */ 260#define SSL_kKRB5 0x00000020L /* Kerberos5 key exchange */
288#define SSL_kECDHe 0x00000040L /* ECDH cert, ECDSA CA cert */ 261#define SSL_kECDH 0x00000040L /* ECDH w/ long-term keys */
289#define SSL_kEECDH 0x00000080L /* ephemeral ECDH */ 262#define SSL_kECDHE 0x00000080L /* ephemeral ECDH */
290#define SSL_kPSK 0x00000100L /* PSK */ 263#define SSL_EDH (SSL_kEDH|(SSL_AUTH_MASK^SSL_aNULL))
291#define SSL_kGOST 0x00000200L /* GOST key exchange */ 264
292 265#define SSL_AUTH_MASK 0x00007F00L
293/* Bits for algorithm_auth (server authentication) */ 266#define SSL_aRSA 0x00000100L /* Authenticate with RSA */
294#define SSL_aRSA 0x00000001L /* RSA auth */ 267#define SSL_aDSS 0x00000200L /* Authenticate with DSS */
295#define SSL_aDSS 0x00000002L /* DSS auth */ 268#define SSL_DSS SSL_aDSS
296#define SSL_aNULL 0x00000004L /* no auth (i.e. use ADH or AECDH) */ 269#define SSL_aFZA 0x00000400L
297#define SSL_aDH 0x00000008L /* Fixed DH auth (kDHd or kDHr) */ /* no such ciphersuites supported! */ 270#define SSL_aNULL 0x00000800L /* no Authenticate, ADH */
298#define SSL_aECDH 0x00000010L /* Fixed ECDH auth (kECDHe or kECDHr) */ 271#define SSL_aDH 0x00001000L /* no Authenticate, ADH */
299#define SSL_aKRB5 0x00000020L /* KRB5 auth */ 272#define SSL_aKRB5 0x00002000L /* Authenticate with KRB5 */
300#define SSL_aECDSA 0x00000040L /* ECDSA auth*/ 273#define SSL_aECDSA 0x00004000L /* Authenticate with ECDSA */
301#define SSL_aPSK 0x00000080L /* PSK auth */ 274
302#define SSL_aGOST94 0x00000100L /* GOST R 34.10-94 signature auth */ 275#define SSL_NULL (SSL_eNULL)
303#define SSL_aGOST01 0x00000200L /* GOST R 34.10-2001 signature auth */ 276#define SSL_ADH (SSL_kEDH|SSL_aNULL)
304 277#define SSL_RSA (SSL_kRSA|SSL_aRSA)
305 278#define SSL_DH (SSL_kDHr|SSL_kDHd|SSL_kEDH)
306/* Bits for algorithm_enc (symmetric encryption) */ 279#define SSL_ECDH (SSL_kECDH|SSL_kECDHE)
307#define SSL_DES 0x00000001L 280#define SSL_FZA (SSL_aFZA|SSL_kFZA|SSL_eFZA)
308#define SSL_3DES 0x00000002L 281#define SSL_KRB5 (SSL_kKRB5|SSL_aKRB5)
309#define SSL_RC4 0x00000004L 282
310#define SSL_RC2 0x00000008L 283#define SSL_ENC_MASK 0x1C3F8000L
311#define SSL_IDEA 0x00000010L 284#define SSL_DES 0x00008000L
312#define SSL_eNULL 0x00000020L 285#define SSL_3DES 0x00010000L
313#define SSL_AES128 0x00000040L 286#define SSL_RC4 0x00020000L
314#define SSL_AES256 0x00000080L 287#define SSL_RC2 0x00040000L
315#define SSL_CAMELLIA128 0x00000100L 288#define SSL_IDEA 0x00080000L
316#define SSL_CAMELLIA256 0x00000200L 289#define SSL_eFZA 0x00100000L
317#define SSL_eGOST2814789CNT 0x00000400L 290#define SSL_eNULL 0x00200000L
318#define SSL_SEED 0x00000800L 291#define SSL_AES 0x04000000L
319 292#define SSL_CAMELLIA 0x08000000L
320#define SSL_AES (SSL_AES128|SSL_AES256) 293#define SSL_SEED 0x10000000L
321#define SSL_CAMELLIA (SSL_CAMELLIA128|SSL_CAMELLIA256) 294
322 295#define SSL_MAC_MASK 0x00c00000L
323 296#define SSL_MD5 0x00400000L
324/* Bits for algorithm_mac (symmetric authentication) */ 297#define SSL_SHA1 0x00800000L
325#define SSL_MD5 0x00000001L 298#define SSL_SHA (SSL_SHA1)
326#define SSL_SHA1 0x00000002L 299
327#define SSL_GOST94 0x00000004L 300#define SSL_SSL_MASK 0x03000000L
328#define SSL_GOST89MAC 0x00000008L 301#define SSL_SSLV2 0x01000000L
329 302#define SSL_SSLV3 0x02000000L
330/* Bits for algorithm_ssl (protocol version) */
331#define SSL_SSLV2 0x00000001L
332#define SSL_SSLV3 0x00000002L
333#define SSL_TLSV1 SSL_SSLV3 /* for now */ 303#define SSL_TLSV1 SSL_SSLV3 /* for now */
334 304
335 305/* we have used 1fffffff - 3 bits left to go. */
336/* Bits for algorithm2 (handshake digests and other extra flags) */
337
338#define SSL_HANDSHAKE_MAC_MD5 0x10
339#define SSL_HANDSHAKE_MAC_SHA 0x20
340#define SSL_HANDSHAKE_MAC_GOST94 0x40
341#define SSL_HANDSHAKE_MAC_DEFAULT (SSL_HANDSHAKE_MAC_MD5 | SSL_HANDSHAKE_MAC_SHA)
342
343/* When adding new digest in the ssl_ciph.c and increment SSM_MD_NUM_IDX
344 * make sure to update this constant too */
345#define SSL_MAX_DIGEST 4
346
347#define TLS1_PRF_DGST_SHIFT 8
348#define TLS1_PRF_MD5 (SSL_HANDSHAKE_MAC_MD5 << TLS1_PRF_DGST_SHIFT)
349#define TLS1_PRF_SHA1 (SSL_HANDSHAKE_MAC_SHA << TLS1_PRF_DGST_SHIFT)
350#define TLS1_PRF_GOST94 (SSL_HANDSHAKE_MAC_GOST94 << TLS1_PRF_DGST_SHIFT)
351#define TLS1_PRF (TLS1_PRF_MD5 | TLS1_PRF_SHA1)
352
353/* Stream MAC for GOST ciphersuites from cryptopro draft
354 * (currently this also goes into algorithm2) */
355#define TLS1_STREAM_MAC 0x04
356
357
358 306
359/* 307/*
360 * Export and cipher strength information. For each cipher we have to decide 308 * Export and cipher strength information. For each cipher we have to decide
@@ -372,11 +320,10 @@
372 * be possible. 320 * be possible.
373 */ 321 */
374#define SSL_EXP_MASK 0x00000003L 322#define SSL_EXP_MASK 0x00000003L
375#define SSL_STRONG_MASK 0x000001fcL
376
377#define SSL_NOT_EXP 0x00000001L 323#define SSL_NOT_EXP 0x00000001L
378#define SSL_EXPORT 0x00000002L 324#define SSL_EXPORT 0x00000002L
379 325
326#define SSL_STRONG_MASK 0x000000fcL
380#define SSL_STRONG_NONE 0x00000004L 327#define SSL_STRONG_NONE 0x00000004L
381#define SSL_EXP40 0x00000008L 328#define SSL_EXP40 0x00000008L
382#define SSL_MICRO (SSL_EXP40) 329#define SSL_MICRO (SSL_EXP40)
@@ -410,14 +357,17 @@
410#define SSL_C_IS_EXPORT40(c) SSL_IS_EXPORT40((c)->algo_strength) 357#define SSL_C_IS_EXPORT40(c) SSL_IS_EXPORT40((c)->algo_strength)
411 358
412#define SSL_EXPORT_KEYLENGTH(a,s) (SSL_IS_EXPORT40(s) ? 5 : \ 359#define SSL_EXPORT_KEYLENGTH(a,s) (SSL_IS_EXPORT40(s) ? 5 : \
413 (a) == SSL_DES ? 8 : 7) 360 ((a)&SSL_ENC_MASK) == SSL_DES ? 8 : 7)
414#define SSL_EXPORT_PKEYLENGTH(a) (SSL_IS_EXPORT40(a) ? 512 : 1024) 361#define SSL_EXPORT_PKEYLENGTH(a) (SSL_IS_EXPORT40(a) ? 512 : 1024)
415#define SSL_C_EXPORT_KEYLENGTH(c) SSL_EXPORT_KEYLENGTH((c)->algorithm_enc, \ 362#define SSL_C_EXPORT_KEYLENGTH(c) SSL_EXPORT_KEYLENGTH((c)->algorithms, \
416 (c)->algo_strength) 363 (c)->algo_strength)
417#define SSL_C_EXPORT_PKEYLENGTH(c) SSL_EXPORT_PKEYLENGTH((c)->algo_strength) 364#define SSL_C_EXPORT_PKEYLENGTH(c) SSL_EXPORT_PKEYLENGTH((c)->algo_strength)
418 365
419 366
420 367#define SSL_ALL 0xffffffffL
368#define SSL_ALL_CIPHERS (SSL_MKEY_MASK|SSL_AUTH_MASK|SSL_ENC_MASK|\
369 SSL_MAC_MASK)
370#define SSL_ALL_STRENGTHS (SSL_EXP_MASK|SSL_STRONG_MASK)
421 371
422/* Mostly for SSLv3 */ 372/* Mostly for SSLv3 */
423#define SSL_PKEY_RSA_ENC 0 373#define SSL_PKEY_RSA_ENC 0
@@ -426,9 +376,7 @@
426#define SSL_PKEY_DH_RSA 3 376#define SSL_PKEY_DH_RSA 3
427#define SSL_PKEY_DH_DSA 4 377#define SSL_PKEY_DH_DSA 4
428#define SSL_PKEY_ECC 5 378#define SSL_PKEY_ECC 5
429#define SSL_PKEY_GOST94 6 379#define SSL_PKEY_NUM 6
430#define SSL_PKEY_GOST01 7
431#define SSL_PKEY_NUM 8
432 380
433/* SSL_kRSA <- RSA_ENC | (RSA_TMP & RSA_SIGN) | 381/* SSL_kRSA <- RSA_ENC | (RSA_TMP & RSA_SIGN) |
434 * <- (EXPORT & (RSA_ENC | RSA_TMP) & RSA_SIGN) 382 * <- (EXPORT & (RSA_ENC | RSA_TMP) & RSA_SIGN)
@@ -469,10 +417,8 @@ typedef struct cert_st
469 /* The following masks are for the key and auth 417 /* The following masks are for the key and auth
470 * algorithms that are supported by the certs below */ 418 * algorithms that are supported by the certs below */
471 int valid; 419 int valid;
472 unsigned long mask_k; 420 unsigned long mask;
473 unsigned long mask_a; 421 unsigned long export_mask;
474 unsigned long export_mask_k;
475 unsigned long export_mask_a;
476#ifndef OPENSSL_NO_RSA 422#ifndef OPENSSL_NO_RSA
477 RSA *rsa_tmp; 423 RSA *rsa_tmp;
478 RSA *(*rsa_tmp_cb)(SSL *ssl,int is_export,int keysize); 424 RSA *(*rsa_tmp_cb)(SSL *ssl,int is_export,int keysize);
@@ -546,9 +492,9 @@ typedef struct ssl3_enc_method
546 int (*setup_key_block)(SSL *); 492 int (*setup_key_block)(SSL *);
547 int (*generate_master_secret)(SSL *, unsigned char *, unsigned char *, int); 493 int (*generate_master_secret)(SSL *, unsigned char *, unsigned char *, int);
548 int (*change_cipher_state)(SSL *, int); 494 int (*change_cipher_state)(SSL *, int);
549 int (*final_finish_mac)(SSL *, const char *, int, unsigned char *); 495 int (*final_finish_mac)(SSL *, EVP_MD_CTX *, EVP_MD_CTX *, const char *, int, unsigned char *);
550 int finish_mac_length; 496 int finish_mac_length;
551 int (*cert_verify_mac)(SSL *, int, unsigned char *); 497 int (*cert_verify_mac)(SSL *, EVP_MD_CTX *, unsigned char *);
552 const char *client_finished_label; 498 const char *client_finished_label;
553 int client_finished_label_len; 499 int client_finished_label_len;
554 const char *server_finished_label; 500 const char *server_finished_label;
@@ -566,35 +512,24 @@ typedef struct ssl3_comp_st
566 } SSL3_COMP; 512 } SSL3_COMP;
567#endif 513#endif
568 514
569#ifndef OPENSSL_NO_BUF_FREELISTS
570typedef struct ssl3_buf_freelist_st
571 {
572 size_t chunklen;
573 unsigned int len;
574 struct ssl3_buf_freelist_entry_st *head;
575 } SSL3_BUF_FREELIST;
576
577typedef struct ssl3_buf_freelist_entry_st
578 {
579 struct ssl3_buf_freelist_entry_st *next;
580 } SSL3_BUF_FREELIST_ENTRY;
581#endif
582
583extern SSL3_ENC_METHOD ssl3_undef_enc_method; 515extern SSL3_ENC_METHOD ssl3_undef_enc_method;
584OPENSSL_EXTERN const SSL_CIPHER ssl2_ciphers[]; 516OPENSSL_EXTERN SSL_CIPHER ssl2_ciphers[];
585OPENSSL_EXTERN SSL_CIPHER ssl3_ciphers[]; 517OPENSSL_EXTERN SSL_CIPHER ssl3_ciphers[];
586 518
587 519
588SSL_METHOD *ssl_bad_method(int ver); 520SSL_METHOD *ssl_bad_method(int ver);
521SSL_METHOD *sslv2_base_method(void);
522SSL_METHOD *sslv23_base_method(void);
523SSL_METHOD *sslv3_base_method(void);
589 524
590extern SSL3_ENC_METHOD TLSv1_enc_data; 525extern SSL3_ENC_METHOD TLSv1_enc_data;
591extern SSL3_ENC_METHOD SSLv3_enc_data; 526extern SSL3_ENC_METHOD SSLv3_enc_data;
592extern SSL3_ENC_METHOD DTLSv1_enc_data; 527extern SSL3_ENC_METHOD DTLSv1_enc_data;
593 528
594#define IMPLEMENT_tls1_meth_func(func_name, s_accept, s_connect, s_get_meth) \ 529#define IMPLEMENT_tls1_meth_func(func_name, s_accept, s_connect, s_get_meth) \
595const SSL_METHOD *func_name(void) \ 530SSL_METHOD *func_name(void) \
596 { \ 531 { \
597 static const SSL_METHOD func_name##_data= { \ 532 static SSL_METHOD func_name##_data= { \
598 TLS1_VERSION, \ 533 TLS1_VERSION, \
599 tls1_new, \ 534 tls1_new, \
600 tls1_clear, \ 535 tls1_clear, \
@@ -629,9 +564,9 @@ const SSL_METHOD *func_name(void) \
629 } 564 }
630 565
631#define IMPLEMENT_ssl3_meth_func(func_name, s_accept, s_connect, s_get_meth) \ 566#define IMPLEMENT_ssl3_meth_func(func_name, s_accept, s_connect, s_get_meth) \
632const SSL_METHOD *func_name(void) \ 567SSL_METHOD *func_name(void) \
633 { \ 568 { \
634 static const SSL_METHOD func_name##_data= { \ 569 static SSL_METHOD func_name##_data= { \
635 SSL3_VERSION, \ 570 SSL3_VERSION, \
636 ssl3_new, \ 571 ssl3_new, \
637 ssl3_clear, \ 572 ssl3_clear, \
@@ -666,9 +601,9 @@ const SSL_METHOD *func_name(void) \
666 } 601 }
667 602
668#define IMPLEMENT_ssl23_meth_func(func_name, s_accept, s_connect, s_get_meth) \ 603#define IMPLEMENT_ssl23_meth_func(func_name, s_accept, s_connect, s_get_meth) \
669const SSL_METHOD *func_name(void) \ 604SSL_METHOD *func_name(void) \
670 { \ 605 { \
671 static const SSL_METHOD func_name##_data= { \ 606 static SSL_METHOD func_name##_data= { \
672 TLS1_VERSION, \ 607 TLS1_VERSION, \
673 tls1_new, \ 608 tls1_new, \
674 tls1_clear, \ 609 tls1_clear, \
@@ -703,9 +638,9 @@ const SSL_METHOD *func_name(void) \
703 } 638 }
704 639
705#define IMPLEMENT_ssl2_meth_func(func_name, s_accept, s_connect, s_get_meth) \ 640#define IMPLEMENT_ssl2_meth_func(func_name, s_accept, s_connect, s_get_meth) \
706const SSL_METHOD *func_name(void) \ 641SSL_METHOD *func_name(void) \
707 { \ 642 { \
708 static const SSL_METHOD func_name##_data= { \ 643 static SSL_METHOD func_name##_data= { \
709 SSL2_VERSION, \ 644 SSL2_VERSION, \
710 ssl2_new, /* local */ \ 645 ssl2_new, /* local */ \
711 ssl2_clear, /* local */ \ 646 ssl2_clear, /* local */ \
@@ -740,9 +675,9 @@ const SSL_METHOD *func_name(void) \
740 } 675 }
741 676
742#define IMPLEMENT_dtls1_meth_func(func_name, s_accept, s_connect, s_get_meth) \ 677#define IMPLEMENT_dtls1_meth_func(func_name, s_accept, s_connect, s_get_meth) \
743const SSL_METHOD *func_name(void) \ 678SSL_METHOD *func_name(void) \
744 { \ 679 { \
745 static const SSL_METHOD func_name##_data= { \ 680 static SSL_METHOD func_name##_data= { \
746 DTLS1_VERSION, \ 681 DTLS1_VERSION, \
747 dtls1_new, \ 682 dtls1_new, \
748 dtls1_clear, \ 683 dtls1_clear, \
@@ -759,7 +694,7 @@ const SSL_METHOD *func_name(void) \
759 dtls1_read_bytes, \ 694 dtls1_read_bytes, \
760 dtls1_write_app_data_bytes, \ 695 dtls1_write_app_data_bytes, \
761 dtls1_dispatch_alert, \ 696 dtls1_dispatch_alert, \
762 dtls1_ctrl, \ 697 ssl3_ctrl, \
763 ssl3_ctx_ctrl, \ 698 ssl3_ctx_ctrl, \
764 ssl3_get_cipher_by_char, \ 699 ssl3_get_cipher_by_char, \
765 ssl3_put_cipher_by_char, \ 700 ssl3_put_cipher_by_char, \
@@ -788,8 +723,6 @@ int ssl_set_peer_cert_type(SESS_CERT *c, int type);
788int ssl_get_new_session(SSL *s, int session); 723int ssl_get_new_session(SSL *s, int session);
789int ssl_get_prev_session(SSL *s, unsigned char *session,int len, const unsigned char *limit); 724int ssl_get_prev_session(SSL *s, unsigned char *session,int len, const unsigned char *limit);
790int ssl_cipher_id_cmp(const SSL_CIPHER *a,const SSL_CIPHER *b); 725int ssl_cipher_id_cmp(const SSL_CIPHER *a,const SSL_CIPHER *b);
791DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER,
792 ssl_cipher_id);
793int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap, 726int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap,
794 const SSL_CIPHER * const *bp); 727 const SSL_CIPHER * const *bp);
795STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num, 728STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num,
@@ -802,16 +735,15 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth,
802 const char *rule_str); 735 const char *rule_str);
803void ssl_update_cache(SSL *s, int mode); 736void ssl_update_cache(SSL *s, int mode);
804int ssl_cipher_get_evp(const SSL_SESSION *s,const EVP_CIPHER **enc, 737int ssl_cipher_get_evp(const SSL_SESSION *s,const EVP_CIPHER **enc,
805 const EVP_MD **md,int *mac_pkey_type,int *mac_secret_size, SSL_COMP **comp); 738 const EVP_MD **md,SSL_COMP **comp);
806int ssl_get_handshake_digest(int i,long *mask,const EVP_MD **md);
807int ssl_verify_cert_chain(SSL *s,STACK_OF(X509) *sk); 739int ssl_verify_cert_chain(SSL *s,STACK_OF(X509) *sk);
808int ssl_undefined_function(SSL *s); 740int ssl_undefined_function(SSL *s);
809int ssl_undefined_void_function(void); 741int ssl_undefined_void_function(void);
810int ssl_undefined_const_function(const SSL *s); 742int ssl_undefined_const_function(const SSL *s);
811X509 *ssl_get_server_send_cert(SSL *); 743X509 *ssl_get_server_send_cert(SSL *);
812EVP_PKEY *ssl_get_sign_pkey(SSL *,const SSL_CIPHER *); 744EVP_PKEY *ssl_get_sign_pkey(SSL *,SSL_CIPHER *);
813int ssl_cert_type(X509 *x,EVP_PKEY *pkey); 745int ssl_cert_type(X509 *x,EVP_PKEY *pkey);
814void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher); 746void ssl_set_cert_masks(CERT *c, SSL_CIPHER *cipher);
815STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s); 747STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s);
816int ssl_verify_alarm_type(long type); 748int ssl_verify_alarm_type(long type);
817void ssl_load_ciphers(void); 749void ssl_load_ciphers(void);
@@ -820,7 +752,7 @@ int ssl2_enc_init(SSL *s, int client);
820int ssl2_generate_key_material(SSL *s); 752int ssl2_generate_key_material(SSL *s);
821void ssl2_enc(SSL *s,int send_data); 753void ssl2_enc(SSL *s,int send_data);
822void ssl2_mac(SSL *s,unsigned char *mac,int send_data); 754void ssl2_mac(SSL *s,unsigned char *mac,int send_data);
823const SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p); 755SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p);
824int ssl2_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p); 756int ssl2_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p);
825int ssl2_part_read(SSL *s, unsigned long f, int i); 757int ssl2_part_read(SSL *s, unsigned long f, int i);
826int ssl2_do_write(SSL *s); 758int ssl2_do_write(SSL *s);
@@ -828,7 +760,7 @@ int ssl2_set_certificate(SSL *s, int type, int len, const unsigned char *data);
828void ssl2_return_error(SSL *s,int reason); 760void ssl2_return_error(SSL *s,int reason);
829void ssl2_write_error(SSL *s); 761void ssl2_write_error(SSL *s);
830int ssl2_num_ciphers(void); 762int ssl2_num_ciphers(void);
831const SSL_CIPHER *ssl2_get_cipher(unsigned int u); 763SSL_CIPHER *ssl2_get_cipher(unsigned int u);
832int ssl2_new(SSL *s); 764int ssl2_new(SSL *s);
833void ssl2_free(SSL *s); 765void ssl2_free(SSL *s);
834int ssl2_accept(SSL *s); 766int ssl2_accept(SSL *s);
@@ -845,7 +777,7 @@ long ssl2_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)(void));
845int ssl2_pending(const SSL *s); 777int ssl2_pending(const SSL *s);
846long ssl2_default_timeout(void ); 778long ssl2_default_timeout(void );
847 779
848const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p); 780SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p);
849int ssl3_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p); 781int ssl3_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p);
850void ssl3_init_finished_mac(SSL *s); 782void ssl3_init_finished_mac(SSL *s);
851int ssl3_send_server_certificate(SSL *s); 783int ssl3_send_server_certificate(SSL *s);
@@ -857,34 +789,29 @@ int ssl3_send_change_cipher_spec(SSL *s,int state_a,int state_b);
857int ssl3_change_cipher_state(SSL *s,int which); 789int ssl3_change_cipher_state(SSL *s,int which);
858void ssl3_cleanup_key_block(SSL *s); 790void ssl3_cleanup_key_block(SSL *s);
859int ssl3_do_write(SSL *s,int type); 791int ssl3_do_write(SSL *s,int type);
860int ssl3_send_alert(SSL *s,int level, int desc); 792void ssl3_send_alert(SSL *s,int level, int desc);
861int ssl3_generate_master_secret(SSL *s, unsigned char *out, 793int ssl3_generate_master_secret(SSL *s, unsigned char *out,
862 unsigned char *p, int len); 794 unsigned char *p, int len);
863int ssl3_get_req_cert_type(SSL *s,unsigned char *p); 795int ssl3_get_req_cert_type(SSL *s,unsigned char *p);
864long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok); 796long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok);
865int ssl3_send_finished(SSL *s, int a, int b, const char *sender,int slen); 797int ssl3_send_finished(SSL *s, int a, int b, const char *sender,int slen);
866int ssl3_num_ciphers(void); 798int ssl3_num_ciphers(void);
867const SSL_CIPHER *ssl3_get_cipher(unsigned int u); 799SSL_CIPHER *ssl3_get_cipher(unsigned int u);
868int ssl3_renegotiate(SSL *ssl); 800int ssl3_renegotiate(SSL *ssl);
869int ssl3_renegotiate_check(SSL *ssl); 801int ssl3_renegotiate_check(SSL *ssl);
870int ssl3_dispatch_alert(SSL *s); 802int ssl3_dispatch_alert(SSL *s);
871int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); 803int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek);
872int ssl3_write_bytes(SSL *s, int type, const void *buf, int len); 804int ssl3_write_bytes(SSL *s, int type, const void *buf, int len);
873int ssl3_final_finish_mac(SSL *s, const char *sender, int slen,unsigned char *p); 805int ssl3_final_finish_mac(SSL *s, EVP_MD_CTX *ctx1, EVP_MD_CTX *ctx2,
874int ssl3_cert_verify_mac(SSL *s, int md_nid, unsigned char *p); 806 const char *sender, int slen,unsigned char *p);
807int ssl3_cert_verify_mac(SSL *s, EVP_MD_CTX *in, unsigned char *p);
875void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len); 808void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len);
876int ssl3_enc(SSL *s, int send_data); 809int ssl3_enc(SSL *s, int send_data);
877int n_ssl3_mac(SSL *ssl, unsigned char *md, int send_data); 810int ssl3_mac(SSL *ssl, unsigned char *md, int send_data);
878void ssl3_free_digest_list(SSL *s);
879unsigned long ssl3_output_cert_chain(SSL *s, X509 *x); 811unsigned long ssl3_output_cert_chain(SSL *s, X509 *x);
880SSL_CIPHER *ssl3_choose_cipher(SSL *ssl,STACK_OF(SSL_CIPHER) *clnt, 812SSL_CIPHER *ssl3_choose_cipher(SSL *ssl,STACK_OF(SSL_CIPHER) *clnt,
881 STACK_OF(SSL_CIPHER) *srvr); 813 STACK_OF(SSL_CIPHER) *srvr);
882int ssl3_setup_buffers(SSL *s); 814int ssl3_setup_buffers(SSL *s);
883int ssl3_setup_read_buffer(SSL *s);
884int ssl3_setup_write_buffer(SSL *s);
885int ssl3_release_read_buffer(SSL *s);
886int ssl3_release_write_buffer(SSL *s);
887int ssl3_digest_cached_records(SSL *s);
888int ssl3_new(SSL *s); 815int ssl3_new(SSL *s);
889void ssl3_free(SSL *s); 816void ssl3_free(SSL *s);
890int ssl3_accept(SSL *s); 817int ssl3_accept(SSL *s);
@@ -905,12 +832,12 @@ int ssl3_do_change_cipher_spec(SSL *ssl);
905long ssl3_default_timeout(void ); 832long ssl3_default_timeout(void );
906 833
907int ssl23_num_ciphers(void ); 834int ssl23_num_ciphers(void );
908const SSL_CIPHER *ssl23_get_cipher(unsigned int u); 835SSL_CIPHER *ssl23_get_cipher(unsigned int u);
909int ssl23_read(SSL *s, void *buf, int len); 836int ssl23_read(SSL *s, void *buf, int len);
910int ssl23_peek(SSL *s, void *buf, int len); 837int ssl23_peek(SSL *s, void *buf, int len);
911int ssl23_write(SSL *s, const void *buf, int len); 838int ssl23_write(SSL *s, const void *buf, int len);
912int ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p); 839int ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
913const SSL_CIPHER *ssl23_get_cipher_by_char(const unsigned char *p); 840SSL_CIPHER *ssl23_get_cipher_by_char(const unsigned char *p);
914long ssl23_default_timeout(void ); 841long ssl23_default_timeout(void );
915 842
916long tls1_default_timeout(void); 843long tls1_default_timeout(void);
@@ -935,21 +862,14 @@ int dtls1_read_failed(SSL *s, int code);
935int dtls1_buffer_message(SSL *s, int ccs); 862int dtls1_buffer_message(SSL *s, int ccs);
936int dtls1_retransmit_message(SSL *s, unsigned short seq, 863int dtls1_retransmit_message(SSL *s, unsigned short seq,
937 unsigned long frag_off, int *found); 864 unsigned long frag_off, int *found);
938int dtls1_get_queue_priority(unsigned short seq, int is_ccs);
939int dtls1_retransmit_buffered_messages(SSL *s);
940void dtls1_clear_record_buffer(SSL *s); 865void dtls1_clear_record_buffer(SSL *s);
941void dtls1_get_message_header(unsigned char *data, struct hm_header_st *msg_hdr); 866void dtls1_get_message_header(unsigned char *data, struct hm_header_st *msg_hdr);
942void dtls1_get_ccs_header(unsigned char *data, struct ccs_header_st *ccs_hdr); 867void dtls1_get_ccs_header(unsigned char *data, struct ccs_header_st *ccs_hdr);
943void dtls1_reset_seq_numbers(SSL *s, int rw); 868void dtls1_reset_seq_numbers(SSL *s, int rw);
944long dtls1_default_timeout(void); 869long dtls1_default_timeout(void);
945struct timeval* dtls1_get_timeout(SSL *s, struct timeval* timeleft); 870SSL_CIPHER *dtls1_get_cipher(unsigned int u);
946int dtls1_handle_timeout(SSL *s); 871
947const SSL_CIPHER *dtls1_get_cipher(unsigned int u); 872
948void dtls1_start_timer(SSL *s);
949void dtls1_stop_timer(SSL *s);
950int dtls1_is_timer_expired(SSL *s);
951void dtls1_double_timeout(SSL *s);
952int dtls1_send_newsession_ticket(SSL *s);
953 873
954/* some client-only functions */ 874/* some client-only functions */
955int ssl3_client_hello(SSL *s); 875int ssl3_client_hello(SSL *s);
@@ -959,15 +879,12 @@ int ssl3_get_new_session_ticket(SSL *s);
959int ssl3_get_cert_status(SSL *s); 879int ssl3_get_cert_status(SSL *s);
960int ssl3_get_server_done(SSL *s); 880int ssl3_get_server_done(SSL *s);
961int ssl3_send_client_verify(SSL *s); 881int ssl3_send_client_verify(SSL *s);
962int ssl3_send_client_certificate(SSL *s);
963int ssl_do_client_cert_cb(SSL *s, X509 **px509, EVP_PKEY **ppkey); 882int ssl_do_client_cert_cb(SSL *s, X509 **px509, EVP_PKEY **ppkey);
883int ssl3_send_client_certificate(SSL *s);
964int ssl3_send_client_key_exchange(SSL *s); 884int ssl3_send_client_key_exchange(SSL *s);
965int ssl3_get_key_exchange(SSL *s); 885int ssl3_get_key_exchange(SSL *s);
966int ssl3_get_server_certificate(SSL *s); 886int ssl3_get_server_certificate(SSL *s);
967int ssl3_check_cert_and_algorithm(SSL *s); 887int ssl3_check_cert_and_algorithm(SSL *s);
968#ifndef OPENSSL_NO_TLSEXT
969int ssl3_check_finished(SSL *s);
970#endif
971 888
972int dtls1_client_hello(SSL *s); 889int dtls1_client_hello(SSL *s);
973int dtls1_send_client_certificate(SSL *s); 890int dtls1_send_client_certificate(SSL *s);
@@ -1005,6 +922,7 @@ void tls1_free(SSL *s);
1005void tls1_clear(SSL *s); 922void tls1_clear(SSL *s);
1006long tls1_ctrl(SSL *s,int cmd, long larg, void *parg); 923long tls1_ctrl(SSL *s,int cmd, long larg, void *parg);
1007long tls1_callback_ctrl(SSL *s,int cmd, void (*fp)(void)); 924long tls1_callback_ctrl(SSL *s,int cmd, void (*fp)(void));
925SSL_METHOD *tlsv1_base_method(void );
1008 926
1009int dtls1_new(SSL *s); 927int dtls1_new(SSL *s);
1010int dtls1_accept(SSL *s); 928int dtls1_accept(SSL *s);
@@ -1012,6 +930,7 @@ int dtls1_connect(SSL *s);
1012void dtls1_free(SSL *s); 930void dtls1_free(SSL *s);
1013void dtls1_clear(SSL *s); 931void dtls1_clear(SSL *s);
1014long dtls1_ctrl(SSL *s,int cmd, long larg, void *parg); 932long dtls1_ctrl(SSL *s,int cmd, long larg, void *parg);
933SSL_METHOD *dtlsv1_base_method(void );
1015 934
1016long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok); 935long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok);
1017int dtls1_get_record(SSL *s); 936int dtls1_get_record(SSL *s);
@@ -1026,9 +945,9 @@ void ssl_free_wbio_buffer(SSL *s);
1026int tls1_change_cipher_state(SSL *s, int which); 945int tls1_change_cipher_state(SSL *s, int which);
1027int tls1_setup_key_block(SSL *s); 946int tls1_setup_key_block(SSL *s);
1028int tls1_enc(SSL *s, int snd); 947int tls1_enc(SSL *s, int snd);
1029int tls1_final_finish_mac(SSL *s, 948int tls1_final_finish_mac(SSL *s, EVP_MD_CTX *in1_ctx, EVP_MD_CTX *in2_ctx,
1030 const char *str, int slen, unsigned char *p); 949 const char *str, int slen, unsigned char *p);
1031int tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *p); 950int tls1_cert_verify_mac(SSL *s, EVP_MD_CTX *in, unsigned char *p);
1032int tls1_mac(SSL *ssl, unsigned char *md, int snd); 951int tls1_mac(SSL *ssl, unsigned char *md, int snd);
1033int tls1_generate_master_secret(SSL *s, unsigned char *out, 952int tls1_generate_master_secret(SSL *s, unsigned char *out,
1034 unsigned char *p, int len); 953 unsigned char *p, int len);
@@ -1036,17 +955,10 @@ int tls1_alert_code(int code);
1036int ssl3_alert_code(int code); 955int ssl3_alert_code(int code);
1037int ssl_ok(SSL *s); 956int ssl_ok(SSL *s);
1038 957
1039#ifndef OPENSSL_NO_ECDH 958int check_srvr_ecc_cert_and_alg(X509 *x, SSL_CIPHER *cs);
1040int ssl_check_srvr_ecc_cert_and_alg(X509 *x, const SSL_CIPHER *cs);
1041#endif
1042 959
1043SSL_COMP *ssl3_comp_find(STACK_OF(SSL_COMP) *sk, int n); 960SSL_COMP *ssl3_comp_find(STACK_OF(SSL_COMP) *sk, int n);
1044 961
1045#ifndef OPENSSL_NO_EC
1046int tls1_ec_curve_id2nid(int curve_id);
1047int tls1_ec_nid2curve_id(int nid);
1048#endif /* OPENSSL_NO_EC */
1049
1050#ifndef OPENSSL_NO_TLSEXT 962#ifndef OPENSSL_NO_TLSEXT
1051unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned char *limit); 963unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned char *limit);
1052unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, unsigned char *limit); 964unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, unsigned char *limit);
@@ -1056,7 +968,6 @@ int ssl_prepare_clienthello_tlsext(SSL *s);
1056int ssl_prepare_serverhello_tlsext(SSL *s); 968int ssl_prepare_serverhello_tlsext(SSL *s);
1057int ssl_check_clienthello_tlsext(SSL *s); 969int ssl_check_clienthello_tlsext(SSL *s);
1058int ssl_check_serverhello_tlsext(SSL *s); 970int ssl_check_serverhello_tlsext(SSL *s);
1059
1060#ifdef OPENSSL_NO_SHA256 971#ifdef OPENSSL_NO_SHA256
1061#define tlsext_tick_md EVP_sha1 972#define tlsext_tick_md EVP_sha1
1062#else 973#else
@@ -1064,15 +975,8 @@ int ssl_check_serverhello_tlsext(SSL *s);
1064#endif 975#endif
1065int tls1_process_ticket(SSL *s, unsigned char *session_id, int len, 976int tls1_process_ticket(SSL *s, unsigned char *session_id, int len,
1066 const unsigned char *limit, SSL_SESSION **ret); 977 const unsigned char *limit, SSL_SESSION **ret);
1067#endif
1068EVP_MD_CTX* ssl_replace_hash(EVP_MD_CTX **hash,const EVP_MD *md) ; 978EVP_MD_CTX* ssl_replace_hash(EVP_MD_CTX **hash,const EVP_MD *md) ;
1069void ssl_clear_hash_ctx(EVP_MD_CTX **hash); 979void ssl_clear_hash_ctx(EVP_MD_CTX **hash);
1070int ssl_add_serverhello_renegotiate_ext(SSL *s, unsigned char *p, int *len, 980#endif
1071 int maxlen); 981
1072int ssl_parse_serverhello_renegotiate_ext(SSL *s, unsigned char *d, int len,
1073 int *al);
1074int ssl_add_clienthello_renegotiate_ext(SSL *s, unsigned char *p, int *len,
1075 int maxlen);
1076int ssl_parse_clienthello_renegotiate_ext(SSL *s, unsigned char *d, int len,
1077 int *al);
1078#endif 982#endif