diff options
| author | tedu <> | 2014-07-10 08:51:15 +0000 |
|---|---|---|
| committer | tedu <> | 2014-07-10 08:51:15 +0000 |
| commit | 78de0a2c32aaba2455b28e3cb034f296c59c3179 (patch) | |
| tree | 10d3c4ab8299021b37a17232dc3493cb7fc5dd87 /src/lib/libssl/ssl | |
| parent | 026ac0f99b4505d6ca98aff637a396038bd916d3 (diff) | |
| download | openbsd-78de0a2c32aaba2455b28e3cb034f296c59c3179.tar.gz openbsd-78de0a2c32aaba2455b28e3cb034f296c59c3179.tar.bz2 openbsd-78de0a2c32aaba2455b28e3cb034f296c59c3179.zip | |
decompress libssl. ok beck jsing
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libssl/ssl.h | 37 | ||||
| -rw-r--r-- | src/lib/libssl/ssl3.h | 16 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_algs.c | 8 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_asn1.c | 32 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_ciph.c | 175 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_lib.c | 30 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_locl.h | 16 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_sess.c | 5 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_txt.c | 18 |
9 files changed, 11 insertions, 326 deletions
diff --git a/src/lib/libssl/ssl.h b/src/lib/libssl/ssl.h index b1eeb85c64..18218f4c61 100644 --- a/src/lib/libssl/ssl.h +++ b/src/lib/libssl/ssl.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl.h,v 1.57 2014/07/09 11:25:42 jsing Exp $ */ | 1 | /* $OpenBSD: ssl.h,v 1.58 2014/07/10 08:51:15 tedu Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -145,9 +145,6 @@ | |||
| 145 | 145 | ||
| 146 | #include <openssl/opensslconf.h> | 146 | #include <openssl/opensslconf.h> |
| 147 | 147 | ||
| 148 | #ifndef OPENSSL_NO_COMP | ||
| 149 | #include <openssl/comp.h> | ||
| 150 | #endif | ||
| 151 | #ifndef OPENSSL_NO_BIO | 148 | #ifndef OPENSSL_NO_BIO |
| 152 | #include <openssl/bio.h> | 149 | #include <openssl/bio.h> |
| 153 | #endif | 150 | #endif |
| @@ -488,8 +485,6 @@ struct ssl_session_st { | |||
| 488 | time_t time; | 485 | time_t time; |
| 489 | int references; | 486 | int references; |
| 490 | 487 | ||
| 491 | unsigned int compress_meth; /* Need to lookup the method */ | ||
| 492 | |||
| 493 | const SSL_CIPHER *cipher; | 488 | const SSL_CIPHER *cipher; |
| 494 | unsigned long cipher_id; /* when ASN.1 loaded, this | 489 | unsigned long cipher_id; /* when ASN.1 loaded, this |
| 495 | * needs to be used to load | 490 | * needs to be used to load |
| @@ -682,11 +677,6 @@ typedef struct ssl_comp_st SSL_COMP; | |||
| 682 | struct ssl_comp_st { | 677 | struct ssl_comp_st { |
| 683 | int id; | 678 | int id; |
| 684 | const char *name; | 679 | const char *name; |
| 685 | #ifndef OPENSSL_NO_COMP | ||
| 686 | COMP_METHOD *method; | ||
| 687 | #else | ||
| 688 | char *method; | ||
| 689 | #endif | ||
| 690 | }; | 680 | }; |
| 691 | 681 | ||
| 692 | DECLARE_STACK_OF(SSL_COMP) | 682 | DECLARE_STACK_OF(SSL_COMP) |
| @@ -1099,11 +1089,6 @@ struct ssl_st { | |||
| 1099 | 1089 | ||
| 1100 | EVP_CIPHER_CTX *enc_read_ctx; /* cryptographic state */ | 1090 | EVP_CIPHER_CTX *enc_read_ctx; /* cryptographic state */ |
| 1101 | EVP_MD_CTX *read_hash; /* used for mac generation */ | 1091 | EVP_MD_CTX *read_hash; /* used for mac generation */ |
| 1102 | #ifndef OPENSSL_NO_COMP | ||
| 1103 | COMP_CTX *expand; /* uncompress */ | ||
| 1104 | #else | ||
| 1105 | char *expand; | ||
| 1106 | #endif | ||
| 1107 | 1092 | ||
| 1108 | SSL_AEAD_CTX *aead_write_ctx; /* AEAD context. If non-NULL, then | 1093 | SSL_AEAD_CTX *aead_write_ctx; /* AEAD context. If non-NULL, then |
| 1109 | enc_write_ctx and write_hash are | 1094 | enc_write_ctx and write_hash are |
| @@ -1111,12 +1096,6 @@ struct ssl_st { | |||
| 1111 | 1096 | ||
| 1112 | EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */ | 1097 | EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */ |
| 1113 | EVP_MD_CTX *write_hash; /* used for mac generation */ | 1098 | EVP_MD_CTX *write_hash; /* used for mac generation */ |
| 1114 | #ifndef OPENSSL_NO_COMP | ||
| 1115 | COMP_CTX *compress; /* compression */ | ||
| 1116 | #else | ||
| 1117 | char *compress; | ||
| 1118 | |||
| 1119 | #endif | ||
| 1120 | 1099 | ||
| 1121 | /* session info */ | 1100 | /* session info */ |
| 1122 | 1101 | ||
| @@ -1836,20 +1815,6 @@ void SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx, | |||
| 1836 | void SSL_set_tmp_ecdh_callback(SSL *ssl, | 1815 | void SSL_set_tmp_ecdh_callback(SSL *ssl, |
| 1837 | EC_KEY *(*ecdh)(SSL *ssl, int is_export, int keylength)); | 1816 | EC_KEY *(*ecdh)(SSL *ssl, int is_export, int keylength)); |
| 1838 | 1817 | ||
| 1839 | #ifndef OPENSSL_NO_COMP | ||
| 1840 | const COMP_METHOD *SSL_get_current_compression(SSL *s); | ||
| 1841 | const COMP_METHOD *SSL_get_current_expansion(SSL *s); | ||
| 1842 | const char *SSL_COMP_get_name(const COMP_METHOD *comp); | ||
| 1843 | STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void); | ||
| 1844 | int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm); | ||
| 1845 | #else | ||
| 1846 | const void *SSL_get_current_compression(SSL *s); | ||
| 1847 | const void *SSL_get_current_expansion(SSL *s); | ||
| 1848 | const char *SSL_COMP_get_name(const void *comp); | ||
| 1849 | void *SSL_COMP_get_compression_methods(void); | ||
| 1850 | int SSL_COMP_add_compression_method(int id, void *cm); | ||
| 1851 | #endif | ||
| 1852 | |||
| 1853 | /* TLS extensions functions */ | 1818 | /* TLS extensions functions */ |
| 1854 | int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len); | 1819 | int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len); |
| 1855 | 1820 | ||
diff --git a/src/lib/libssl/ssl3.h b/src/lib/libssl/ssl3.h index 235c359af2..f956c50987 100644 --- a/src/lib/libssl/ssl3.h +++ b/src/lib/libssl/ssl3.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl3.h,v 1.23 2014/06/13 11:52:03 jsing Exp $ */ | 1 | /* $OpenBSD: ssl3.h,v 1.24 2014/07/10 08:51:15 tedu Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -117,9 +117,6 @@ | |||
| 117 | #ifndef HEADER_SSL3_H | 117 | #ifndef HEADER_SSL3_H |
| 118 | #define HEADER_SSL3_H | 118 | #define HEADER_SSL3_H |
| 119 | 119 | ||
| 120 | #ifndef OPENSSL_NO_COMP | ||
| 121 | #include <openssl/comp.h> | ||
| 122 | #endif | ||
| 123 | #include <openssl/buffer.h> | 120 | #include <openssl/buffer.h> |
| 124 | #include <openssl/evp.h> | 121 | #include <openssl/evp.h> |
| 125 | #include <openssl/ssl.h> | 122 | #include <openssl/ssl.h> |
| @@ -285,12 +282,7 @@ extern "C" { | |||
| 285 | 282 | ||
| 286 | /* If compression isn't used don't include the compression overhead */ | 283 | /* If compression isn't used don't include the compression overhead */ |
| 287 | 284 | ||
| 288 | #ifdef OPENSSL_NO_COMP | ||
| 289 | #define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH | 285 | #define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH |
| 290 | #else | ||
| 291 | #define SSL3_RT_MAX_COMPRESSED_LENGTH \ | ||
| 292 | (SSL3_RT_MAX_PLAIN_LENGTH+SSL3_RT_MAX_COMPRESSED_OVERHEAD) | ||
| 293 | #endif | ||
| 294 | #define SSL3_RT_MAX_ENCRYPTED_LENGTH \ | 286 | #define SSL3_RT_MAX_ENCRYPTED_LENGTH \ |
| 295 | (SSL3_RT_MAX_ENCRYPTED_OVERHEAD+SSL3_RT_MAX_COMPRESSED_LENGTH) | 287 | (SSL3_RT_MAX_ENCRYPTED_OVERHEAD+SSL3_RT_MAX_COMPRESSED_LENGTH) |
| 296 | #define SSL3_RT_MAX_PACKET_SIZE \ | 288 | #define SSL3_RT_MAX_PACKET_SIZE \ |
| @@ -336,7 +328,6 @@ typedef struct ssl3_record_st { | |||
| 336 | /*r */ unsigned int off; /* read/write offset into 'buf' */ | 328 | /*r */ unsigned int off; /* read/write offset into 'buf' */ |
| 337 | /*rw*/ unsigned char *data; /* pointer to the record data */ | 329 | /*rw*/ unsigned char *data; /* pointer to the record data */ |
| 338 | /*rw*/ unsigned char *input; /* where the decode bytes are */ | 330 | /*rw*/ unsigned char *input; /* where the decode bytes are */ |
| 339 | /*r */ unsigned char *comp; /* only used with decompression - malloc()ed */ | ||
| 340 | /*r */ unsigned long epoch; /* epoch number, needed by DTLS1 */ | 331 | /*r */ unsigned long epoch; /* epoch number, needed by DTLS1 */ |
| 341 | /*r */ unsigned char seq_num[8]; /* sequence number, needed by DTLS1 */ | 332 | /*r */ unsigned char seq_num[8]; /* sequence number, needed by DTLS1 */ |
| 342 | } SSL3_RECORD; | 333 | } SSL3_RECORD; |
| @@ -492,11 +483,6 @@ typedef struct ssl3_state_st { | |||
| 492 | const EVP_MD *new_hash; | 483 | const EVP_MD *new_hash; |
| 493 | int new_mac_pkey_type; | 484 | int new_mac_pkey_type; |
| 494 | int new_mac_secret_size; | 485 | int new_mac_secret_size; |
| 495 | #ifndef OPENSSL_NO_COMP | ||
| 496 | const SSL_COMP *new_compression; | ||
| 497 | #else | ||
| 498 | char *new_compression; | ||
| 499 | #endif | ||
| 500 | int cert_request; | 486 | int cert_request; |
| 501 | } tmp; | 487 | } tmp; |
| 502 | 488 | ||
diff --git a/src/lib/libssl/ssl_algs.c b/src/lib/libssl/ssl_algs.c index 0518876ab4..ce051252f6 100644 --- a/src/lib/libssl/ssl_algs.c +++ b/src/lib/libssl/ssl_algs.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_algs.c,v 1.18 2014/06/12 15:49:31 deraadt Exp $ */ | 1 | /* $OpenBSD: ssl_algs.c,v 1.19 2014/07/10 08:51:15 tedu Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -112,12 +112,6 @@ SSL_library_init(void) | |||
| 112 | EVP_add_digest_alias(SN_dsaWithSHA1, "DSS1"); | 112 | EVP_add_digest_alias(SN_dsaWithSHA1, "DSS1"); |
| 113 | EVP_add_digest_alias(SN_dsaWithSHA1, "dss1"); | 113 | EVP_add_digest_alias(SN_dsaWithSHA1, "dss1"); |
| 114 | EVP_add_digest(EVP_ecdsa()); | 114 | EVP_add_digest(EVP_ecdsa()); |
| 115 | #ifndef OPENSSL_NO_COMP | ||
| 116 | /* This will initialise the built-in compression algorithms. | ||
| 117 | The value returned is a STACK_OF(SSL_COMP), but that can | ||
| 118 | be discarded safely */ | ||
| 119 | (void)SSL_COMP_get_compression_methods(); | ||
| 120 | #endif | ||
| 121 | /* initialize cipher/digest methods table */ | 115 | /* initialize cipher/digest methods table */ |
| 122 | ssl_load_ciphers(); | 116 | ssl_load_ciphers(); |
| 123 | return (1); | 117 | return (1); |
diff --git a/src/lib/libssl/ssl_asn1.c b/src/lib/libssl/ssl_asn1.c index 8594408898..43366b33b8 100644 --- a/src/lib/libssl/ssl_asn1.c +++ b/src/lib/libssl/ssl_asn1.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_asn1.c,v 1.26 2014/06/12 15:49:31 deraadt Exp $ */ | 1 | /* $OpenBSD: ssl_asn1.c,v 1.27 2014/07/10 08:51:15 tedu Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -118,10 +118,6 @@ i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp) | |||
| 118 | unsigned char ibuf3[LSIZE2], ibuf4[LSIZE2], ibuf5[LSIZE2]; | 118 | unsigned char ibuf3[LSIZE2], ibuf4[LSIZE2], ibuf5[LSIZE2]; |
| 119 | int v6 = 0, v9 = 0, v10 = 0; | 119 | int v6 = 0, v9 = 0, v10 = 0; |
| 120 | unsigned char ibuf6[LSIZE2]; | 120 | unsigned char ibuf6[LSIZE2]; |
| 121 | #ifndef OPENSSL_NO_COMP | ||
| 122 | unsigned char cbuf; | ||
| 123 | int v11 = 0; | ||
| 124 | #endif | ||
| 125 | long l; | 121 | long l; |
| 126 | SSL_SESSION_ASN1 a; | 122 | SSL_SESSION_ASN1 a; |
| 127 | M_ASN1_I2D_vars(in); | 123 | M_ASN1_I2D_vars(in); |
| @@ -155,14 +151,6 @@ i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp) | |||
| 155 | buf[0] = ((unsigned char)(l >> 8L))&0xff; | 151 | buf[0] = ((unsigned char)(l >> 8L))&0xff; |
| 156 | buf[1] = ((unsigned char)(l ))&0xff; | 152 | buf[1] = ((unsigned char)(l ))&0xff; |
| 157 | 153 | ||
| 158 | #ifndef OPENSSL_NO_COMP | ||
| 159 | if (in->compress_meth) { | ||
| 160 | cbuf = (unsigned char)in->compress_meth; | ||
| 161 | a.comp_id.length = 1; | ||
| 162 | a.comp_id.type = V_ASN1_OCTET_STRING; | ||
| 163 | a.comp_id.data = &cbuf; | ||
| 164 | } | ||
| 165 | #endif | ||
| 166 | 154 | ||
| 167 | a.master_key.length = in->master_key_length; | 155 | a.master_key.length = in->master_key_length; |
| 168 | a.master_key.type = V_ASN1_OCTET_STRING; | 156 | a.master_key.type = V_ASN1_OCTET_STRING; |
| @@ -248,10 +236,6 @@ i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp) | |||
| 248 | M_ASN1_I2D_len_EXP_opt(&(a.tlsext_tick), i2d_ASN1_OCTET_STRING, 10, v10); | 236 | M_ASN1_I2D_len_EXP_opt(&(a.tlsext_tick), i2d_ASN1_OCTET_STRING, 10, v10); |
| 249 | if (in->tlsext_hostname) | 237 | if (in->tlsext_hostname) |
| 250 | M_ASN1_I2D_len_EXP_opt(&(a.tlsext_hostname), i2d_ASN1_OCTET_STRING, 6, v6); | 238 | M_ASN1_I2D_len_EXP_opt(&(a.tlsext_hostname), i2d_ASN1_OCTET_STRING, 6, v6); |
| 251 | #ifndef OPENSSL_NO_COMP | ||
| 252 | if (in->compress_meth) | ||
| 253 | M_ASN1_I2D_len_EXP_opt(&(a.comp_id), i2d_ASN1_OCTET_STRING, 11, v11); | ||
| 254 | #endif | ||
| 255 | #ifndef OPENSSL_NO_PSK | 239 | #ifndef OPENSSL_NO_PSK |
| 256 | if (in->psk_identity_hint) | 240 | if (in->psk_identity_hint) |
| 257 | M_ASN1_I2D_len_EXP_opt(&(a.psk_identity_hint), i2d_ASN1_OCTET_STRING, 7, v7); | 241 | M_ASN1_I2D_len_EXP_opt(&(a.psk_identity_hint), i2d_ASN1_OCTET_STRING, 7, v7); |
| @@ -288,10 +272,6 @@ i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp) | |||
| 288 | M_ASN1_I2D_put_EXP_opt(&a.tlsext_tick_lifetime, i2d_ASN1_INTEGER, 9, v9); | 272 | M_ASN1_I2D_put_EXP_opt(&a.tlsext_tick_lifetime, i2d_ASN1_INTEGER, 9, v9); |
| 289 | if (in->tlsext_tick) | 273 | if (in->tlsext_tick) |
| 290 | M_ASN1_I2D_put_EXP_opt(&(a.tlsext_tick), i2d_ASN1_OCTET_STRING, 10, v10); | 274 | M_ASN1_I2D_put_EXP_opt(&(a.tlsext_tick), i2d_ASN1_OCTET_STRING, 10, v10); |
| 291 | #ifndef OPENSSL_NO_COMP | ||
| 292 | if (in->compress_meth) | ||
| 293 | M_ASN1_I2D_put_EXP_opt(&(a.comp_id), i2d_ASN1_OCTET_STRING, 11, v11); | ||
| 294 | #endif | ||
| 295 | M_ASN1_I2D_finish(); | 275 | M_ASN1_I2D_finish(); |
| 296 | } | 276 | } |
| 297 | 277 | ||
| @@ -480,16 +460,6 @@ d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length) | |||
| 480 | os.length = 0; | 460 | os.length = 0; |
| 481 | } else | 461 | } else |
| 482 | ret->tlsext_tick = NULL; | 462 | ret->tlsext_tick = NULL; |
| 483 | #ifndef OPENSSL_NO_COMP | ||
| 484 | os.length = 0; | ||
| 485 | os.data = NULL; | ||
| 486 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 11); | ||
| 487 | if (os.data) { | ||
| 488 | ret->compress_meth = os.data[0]; | ||
| 489 | free(os.data); | ||
| 490 | os.data = NULL; | ||
| 491 | } | ||
| 492 | #endif | ||
| 493 | 463 | ||
| 494 | 464 | ||
| 495 | M_ASN1_D2I_Finish(a, SSL_SESSION_free, SSL_F_D2I_SSL_SESSION); | 465 | M_ASN1_D2I_Finish(a, SSL_SESSION_free, SSL_F_D2I_SSL_SESSION); |
diff --git a/src/lib/libssl/ssl_ciph.c b/src/lib/libssl/ssl_ciph.c index d84e45764e..0ba66cc89f 100644 --- a/src/lib/libssl/ssl_ciph.c +++ b/src/lib/libssl/ssl_ciph.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_ciph.c,v 1.58 2014/07/09 14:20:55 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_ciph.c,v 1.59 2014/07/10 08:51:15 tedu Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -142,9 +142,6 @@ | |||
| 142 | 142 | ||
| 143 | #include <stdio.h> | 143 | #include <stdio.h> |
| 144 | #include <openssl/objects.h> | 144 | #include <openssl/objects.h> |
| 145 | #ifndef OPENSSL_NO_COMP | ||
| 146 | #include <openssl/comp.h> | ||
| 147 | #endif | ||
| 148 | #ifndef OPENSSL_NO_ENGINE | 145 | #ifndef OPENSSL_NO_ENGINE |
| 149 | #include <openssl/engine.h> | 146 | #include <openssl/engine.h> |
| 150 | #endif | 147 | #endif |
| @@ -175,8 +172,6 @@ static const EVP_CIPHER *ssl_cipher_methods[SSL_ENC_NUM_IDX] = { | |||
| 175 | #define SSL_COMP_ZLIB_IDX 1 | 172 | #define SSL_COMP_ZLIB_IDX 1 |
| 176 | #define SSL_COMP_NUM_IDX 2 | 173 | #define SSL_COMP_NUM_IDX 2 |
| 177 | 174 | ||
| 178 | static STACK_OF(SSL_COMP) *ssl_comp_methods = NULL; | ||
| 179 | |||
| 180 | #define SSL_MD_MD5_IDX 0 | 175 | #define SSL_MD_MD5_IDX 0 |
| 181 | #define SSL_MD_SHA1_IDX 1 | 176 | #define SSL_MD_SHA1_IDX 1 |
| 182 | #define SSL_MD_GOST94_IDX 2 | 177 | #define SSL_MD_GOST94_IDX 2 |
| @@ -645,81 +640,14 @@ ssl_load_ciphers(void) | |||
| 645 | ssl_mac_secret_size[SSL_MD_SHA384_IDX]= | 640 | ssl_mac_secret_size[SSL_MD_SHA384_IDX]= |
| 646 | EVP_MD_size(ssl_digest_methods[SSL_MD_SHA384_IDX]); | 641 | EVP_MD_size(ssl_digest_methods[SSL_MD_SHA384_IDX]); |
| 647 | } | 642 | } |
| 648 | #ifndef OPENSSL_NO_COMP | ||
| 649 | |||
| 650 | static int | ||
| 651 | sk_comp_cmp(const SSL_COMP * const *a, | ||
| 652 | const SSL_COMP * const *b) | ||
| 653 | { | ||
| 654 | return ((*a)->id - (*b)->id); | ||
| 655 | } | ||
| 656 | |||
| 657 | static void | ||
| 658 | load_builtin_compressions(void) | ||
| 659 | { | ||
| 660 | int got_write_lock = 0; | ||
| 661 | |||
| 662 | CRYPTO_r_lock(CRYPTO_LOCK_SSL); | ||
| 663 | if (ssl_comp_methods == NULL) { | ||
| 664 | CRYPTO_r_unlock(CRYPTO_LOCK_SSL); | ||
| 665 | CRYPTO_w_lock(CRYPTO_LOCK_SSL); | ||
| 666 | got_write_lock = 1; | ||
| 667 | |||
| 668 | if (ssl_comp_methods == NULL) { | ||
| 669 | SSL_COMP *comp = NULL; | ||
| 670 | |||
| 671 | ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp); | ||
| 672 | if (ssl_comp_methods != NULL) { | ||
| 673 | comp = malloc(sizeof(SSL_COMP)); | ||
| 674 | if (comp != NULL) { | ||
| 675 | comp->method = COMP_zlib(); | ||
| 676 | if (comp->method && | ||
| 677 | comp->method->type == NID_undef) | ||
| 678 | free(comp); | ||
| 679 | else { | ||
| 680 | comp->id = SSL_COMP_ZLIB_IDX; | ||
| 681 | comp->name = comp->method->name; | ||
| 682 | sk_SSL_COMP_push(ssl_comp_methods, comp); | ||
| 683 | } | ||
| 684 | } | ||
| 685 | sk_SSL_COMP_sort(ssl_comp_methods); | ||
| 686 | } | ||
| 687 | } | ||
| 688 | } | ||
| 689 | |||
| 690 | if (got_write_lock) | ||
| 691 | CRYPTO_w_unlock(CRYPTO_LOCK_SSL); | ||
| 692 | else | ||
| 693 | CRYPTO_r_unlock(CRYPTO_LOCK_SSL); | ||
| 694 | } | ||
| 695 | #endif | ||
| 696 | 643 | ||
| 697 | /* ssl_cipher_get_comp sets comp to the correct SSL_COMP for the given | 644 | /* ssl_cipher_get_comp sets comp to the correct SSL_COMP for the given |
| 698 | * session and returns 1. On error it returns 0. */ | 645 | * session and returns 1. On error it returns 0. */ |
| 699 | int | 646 | int |
| 700 | ssl_cipher_get_comp(const SSL_SESSION *s, SSL_COMP **comp) | 647 | ssl_cipher_get_comp(const SSL_SESSION *s, SSL_COMP **comp) |
| 701 | { | 648 | { |
| 702 | SSL_COMP ctmp; | ||
| 703 | int i; | ||
| 704 | |||
| 705 | #ifndef OPENSSL_NO_COMP | ||
| 706 | load_builtin_compressions(); | ||
| 707 | #endif | ||
| 708 | |||
| 709 | *comp = NULL; | 649 | *comp = NULL; |
| 710 | if (s->compress_meth == 0) | 650 | return 1; |
| 711 | return 1; | ||
| 712 | if (ssl_comp_methods == NULL) | ||
| 713 | return 0; | ||
| 714 | |||
| 715 | ctmp.id = s->compress_meth; | ||
| 716 | i = sk_SSL_COMP_find(ssl_comp_methods, &ctmp); | ||
| 717 | if (i >= 0) { | ||
| 718 | *comp = sk_SSL_COMP_value(ssl_comp_methods, i); | ||
| 719 | return 1; | ||
| 720 | } | ||
| 721 | |||
| 722 | return 0; | ||
| 723 | } | 651 | } |
| 724 | 652 | ||
| 725 | int | 653 | int |
| @@ -1919,102 +1847,3 @@ SSL_CIPHER_get_id(const SSL_CIPHER *c) | |||
| 1919 | { | 1847 | { |
| 1920 | return c->id; | 1848 | return c->id; |
| 1921 | } | 1849 | } |
| 1922 | |||
| 1923 | SSL_COMP * | ||
| 1924 | ssl3_comp_find(STACK_OF(SSL_COMP) *sk, int n) | ||
| 1925 | { | ||
| 1926 | SSL_COMP *ctmp; | ||
| 1927 | int i, nn; | ||
| 1928 | |||
| 1929 | if ((n == 0) || (sk == NULL)) | ||
| 1930 | return (NULL); | ||
| 1931 | nn = sk_SSL_COMP_num(sk); | ||
| 1932 | for (i = 0; i < nn; i++) { | ||
| 1933 | ctmp = sk_SSL_COMP_value(sk, i); | ||
| 1934 | if (ctmp->id == n) | ||
| 1935 | return (ctmp); | ||
| 1936 | } | ||
| 1937 | return (NULL); | ||
| 1938 | } | ||
| 1939 | |||
| 1940 | #ifdef OPENSSL_NO_COMP | ||
| 1941 | void * | ||
| 1942 | SSL_COMP_get_compression_methods(void) | ||
| 1943 | { | ||
| 1944 | return NULL; | ||
| 1945 | } | ||
| 1946 | |||
| 1947 | int | ||
| 1948 | SSL_COMP_add_compression_method(int id, void *cm) | ||
| 1949 | { | ||
| 1950 | return 1; | ||
| 1951 | } | ||
| 1952 | |||
| 1953 | const char * | ||
| 1954 | SSL_COMP_get_name(const void *comp) | ||
| 1955 | { | ||
| 1956 | return NULL; | ||
| 1957 | } | ||
| 1958 | #else | ||
| 1959 | STACK_OF(SSL_COMP) * | ||
| 1960 | SSL_COMP_get_compression_methods(void) | ||
| 1961 | { | ||
| 1962 | load_builtin_compressions(); | ||
| 1963 | return (ssl_comp_methods); | ||
| 1964 | } | ||
| 1965 | |||
| 1966 | int | ||
| 1967 | SSL_COMP_add_compression_method(int id, COMP_METHOD *cm) | ||
| 1968 | { | ||
| 1969 | SSL_COMP *comp; | ||
| 1970 | |||
| 1971 | if (cm == NULL || cm->type == NID_undef) | ||
| 1972 | return 1; | ||
| 1973 | |||
| 1974 | /* According to draft-ietf-tls-compression-04.txt, the | ||
| 1975 | compression number ranges should be the following: | ||
| 1976 | |||
| 1977 | 0 to 63: methods defined by the IETF | ||
| 1978 | 64 to 192: external party methods assigned by IANA | ||
| 1979 | 193 to 255: reserved for private use */ | ||
| 1980 | if (id < 193 || id > 255) { | ||
| 1981 | SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, | ||
| 1982 | SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE); | ||
| 1983 | return 1; | ||
| 1984 | } | ||
| 1985 | |||
| 1986 | comp = malloc(sizeof(SSL_COMP)); | ||
| 1987 | if (comp == NULL) { | ||
| 1988 | SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, | ||
| 1989 | ERR_R_MALLOC_FAILURE); | ||
| 1990 | return (1); | ||
| 1991 | } | ||
| 1992 | comp->id = id; | ||
| 1993 | comp->method = cm; | ||
| 1994 | load_builtin_compressions(); | ||
| 1995 | if (ssl_comp_methods && | ||
| 1996 | sk_SSL_COMP_find(ssl_comp_methods, comp) >= 0) { | ||
| 1997 | free(comp); | ||
| 1998 | SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, | ||
| 1999 | SSL_R_DUPLICATE_COMPRESSION_ID); | ||
| 2000 | return (1); | ||
| 2001 | } else if ((ssl_comp_methods == NULL) || | ||
| 2002 | !sk_SSL_COMP_push(ssl_comp_methods, comp)) { | ||
| 2003 | free(comp); | ||
| 2004 | SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, | ||
| 2005 | ERR_R_MALLOC_FAILURE); | ||
| 2006 | return (1); | ||
| 2007 | } else { | ||
| 2008 | return (0); | ||
| 2009 | } | ||
| 2010 | } | ||
| 2011 | |||
| 2012 | const char * | ||
| 2013 | SSL_COMP_get_name(const COMP_METHOD *comp) | ||
| 2014 | { | ||
| 2015 | if (comp) | ||
| 2016 | return comp->name; | ||
| 2017 | return NULL; | ||
| 2018 | } | ||
| 2019 | |||
| 2020 | #endif | ||
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index a5f2f3f751..765012e861 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_lib.c,v 1.71 2014/07/10 08:18:55 bcook Exp $ */ | 1 | /* $OpenBSD: ssl_lib.c,v 1.72 2014/07/10 08:51:15 tedu Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -1793,9 +1793,6 @@ SSL_CTX_new(const SSL_METHOD *meth) | |||
| 1793 | CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_CTX, ret, &ret->ex_data); | 1793 | CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_CTX, ret, &ret->ex_data); |
| 1794 | 1794 | ||
| 1795 | ret->extra_certs = NULL; | 1795 | ret->extra_certs = NULL; |
| 1796 | /* No compression for DTLS */ | ||
| 1797 | if (meth->version != DTLS1_VERSION) | ||
| 1798 | ret->comp_methods = SSL_COMP_get_compression_methods(); | ||
| 1799 | 1796 | ||
| 1800 | ret->max_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH; | 1797 | ret->max_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH; |
| 1801 | 1798 | ||
| @@ -2610,12 +2607,6 @@ ssl_clear_cipher_ctx(SSL *s) | |||
| 2610 | s->aead_write_ctx = NULL; | 2607 | s->aead_write_ctx = NULL; |
| 2611 | } | 2608 | } |
| 2612 | 2609 | ||
| 2613 | #ifndef OPENSSL_NO_COMP | ||
| 2614 | COMP_CTX_free(s->expand); | ||
| 2615 | s->expand = NULL; | ||
| 2616 | COMP_CTX_free(s->compress); | ||
| 2617 | s->compress = NULL; | ||
| 2618 | #endif | ||
| 2619 | } | 2610 | } |
| 2620 | 2611 | ||
| 2621 | /* Fix this function so that it takes an optional type parameter */ | 2612 | /* Fix this function so that it takes an optional type parameter */ |
| @@ -2645,7 +2636,6 @@ SSL_get_current_cipher(const SSL *s) | |||
| 2645 | return (s->session->cipher); | 2636 | return (s->session->cipher); |
| 2646 | return (NULL); | 2637 | return (NULL); |
| 2647 | } | 2638 | } |
| 2648 | #ifdef OPENSSL_NO_COMP | ||
| 2649 | const void * | 2639 | const void * |
| 2650 | SSL_get_current_compression(SSL *s) | 2640 | SSL_get_current_compression(SSL *s) |
| 2651 | { | 2641 | { |
| @@ -2657,24 +2647,6 @@ SSL_get_current_expansion(SSL *s) | |||
| 2657 | { | 2647 | { |
| 2658 | return (NULL); | 2648 | return (NULL); |
| 2659 | } | 2649 | } |
| 2660 | #else | ||
| 2661 | |||
| 2662 | const COMP_METHOD * | ||
| 2663 | SSL_get_current_compression(SSL *s) | ||
| 2664 | { | ||
| 2665 | if (s->compress != NULL) | ||
| 2666 | return (s->compress->meth); | ||
| 2667 | return (NULL); | ||
| 2668 | } | ||
| 2669 | |||
| 2670 | const COMP_METHOD * | ||
| 2671 | SSL_get_current_expansion(SSL *s) | ||
| 2672 | { | ||
| 2673 | if (s->expand != NULL) | ||
| 2674 | return (s->expand->meth); | ||
| 2675 | return (NULL); | ||
| 2676 | } | ||
| 2677 | #endif | ||
| 2678 | 2650 | ||
| 2679 | int | 2651 | int |
| 2680 | ssl_init_wbio_buffer(SSL *s, int push) | 2652 | ssl_init_wbio_buffer(SSL *s, int push) |
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h index 2b3d1b8e44..b3bc4f4ae4 100644 --- a/src/lib/libssl/ssl_locl.h +++ b/src/lib/libssl/ssl_locl.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_locl.h,v 1.56 2014/07/09 11:25:42 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_locl.h,v 1.57 2014/07/10 08:51:15 tedu Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -153,9 +153,6 @@ | |||
| 153 | 153 | ||
| 154 | #include <openssl/opensslconf.h> | 154 | #include <openssl/opensslconf.h> |
| 155 | #include <openssl/buffer.h> | 155 | #include <openssl/buffer.h> |
| 156 | #ifndef OPENSSL_NO_COMP | ||
| 157 | #include <openssl/comp.h> | ||
| 158 | #endif | ||
| 159 | #include <openssl/bio.h> | 156 | #include <openssl/bio.h> |
| 160 | #include <openssl/stack.h> | 157 | #include <openssl/stack.h> |
| 161 | #include <openssl/rsa.h> | 158 | #include <openssl/rsa.h> |
| @@ -547,15 +544,6 @@ struct ssl_aead_ctx_st { | |||
| 547 | char variable_nonce_in_record; | 544 | char variable_nonce_in_record; |
| 548 | }; | 545 | }; |
| 549 | 546 | ||
| 550 | #ifndef OPENSSL_NO_COMP | ||
| 551 | /* Used for holding the relevant compression methods loaded into SSL_CTX */ | ||
| 552 | typedef struct ssl3_comp_st { | ||
| 553 | int comp_id; /* The identifier byte for this compression type */ | ||
| 554 | char *name; /* Text name used for the compression type */ | ||
| 555 | COMP_METHOD *method; /* The method :-) */ | ||
| 556 | } SSL3_COMP; | ||
| 557 | #endif | ||
| 558 | |||
| 559 | extern SSL3_ENC_METHOD ssl3_undef_enc_method; | 547 | extern SSL3_ENC_METHOD ssl3_undef_enc_method; |
| 560 | extern SSL_CIPHER ssl3_ciphers[]; | 548 | extern SSL_CIPHER ssl3_ciphers[]; |
| 561 | 549 | ||
| @@ -685,8 +673,6 @@ long tls1_default_timeout(void); | |||
| 685 | int dtls1_do_write(SSL *s, int type); | 673 | int dtls1_do_write(SSL *s, int type); |
| 686 | int ssl3_read_n(SSL *s, int n, int max, int extend); | 674 | int ssl3_read_n(SSL *s, int n, int max, int extend); |
| 687 | int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); | 675 | int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); |
| 688 | int ssl3_do_compress(SSL *ssl); | ||
| 689 | int ssl3_do_uncompress(SSL *ssl); | ||
| 690 | int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, | 676 | int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, |
| 691 | unsigned int len); | 677 | unsigned int len); |
| 692 | unsigned char *dtls1_set_message_header(SSL *s, unsigned char *p, | 678 | unsigned char *dtls1_set_message_header(SSL *s, unsigned char *p, |
diff --git a/src/lib/libssl/ssl_sess.c b/src/lib/libssl/ssl_sess.c index 7932f20151..b3dd3e6117 100644 --- a/src/lib/libssl/ssl_sess.c +++ b/src/lib/libssl/ssl_sess.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_sess.c,v 1.34 2014/06/21 20:27:25 tedu Exp $ */ | 1 | /* $OpenBSD: ssl_sess.c,v 1.35 2014/07/10 08:51:15 tedu Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -207,7 +207,6 @@ SSL_SESSION_new(void) | |||
| 207 | ss->time = time(NULL); | 207 | ss->time = time(NULL); |
| 208 | ss->prev = NULL; | 208 | ss->prev = NULL; |
| 209 | ss->next = NULL; | 209 | ss->next = NULL; |
| 210 | ss->compress_meth = 0; | ||
| 211 | ss->tlsext_hostname = NULL; | 210 | ss->tlsext_hostname = NULL; |
| 212 | 211 | ||
| 213 | ss->tlsext_ecpointformatlist_length = 0; | 212 | ss->tlsext_ecpointformatlist_length = 0; |
| @@ -233,7 +232,7 @@ SSL_SESSION_get_id(const SSL_SESSION *s, unsigned int *len) | |||
| 233 | unsigned int | 232 | unsigned int |
| 234 | SSL_SESSION_get_compress_id(const SSL_SESSION *s) | 233 | SSL_SESSION_get_compress_id(const SSL_SESSION *s) |
| 235 | { | 234 | { |
| 236 | return s->compress_meth; | 235 | return 0; |
| 237 | } | 236 | } |
| 238 | 237 | ||
| 239 | /* Even with SSLv2, we have 16 bytes (128 bits) of session ID space. SSLv3/TLSv1 | 238 | /* Even with SSLv2, we have 16 bytes (128 bits) of session ID space. SSLv3/TLSv1 |
diff --git a/src/lib/libssl/ssl_txt.c b/src/lib/libssl/ssl_txt.c index c06e2d23b7..25f2290290 100644 --- a/src/lib/libssl/ssl_txt.c +++ b/src/lib/libssl/ssl_txt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_txt.c,v 1.21 2014/06/12 15:49:31 deraadt Exp $ */ | 1 | /* $OpenBSD: ssl_txt.c,v 1.22 2014/07/10 08:51:15 tedu Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -182,22 +182,6 @@ SSL_SESSION_print(BIO *bp, const SSL_SESSION *x) | |||
| 182 | goto err; | 182 | goto err; |
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | #ifndef OPENSSL_NO_COMP | ||
| 186 | if (x->compress_meth != 0) { | ||
| 187 | SSL_COMP *comp = NULL; | ||
| 188 | |||
| 189 | if (!ssl_cipher_get_comp(x, &comp)) | ||
| 190 | goto err; | ||
| 191 | |||
| 192 | if (comp == NULL) { | ||
| 193 | if (BIO_printf(bp, "\n Compression: %d", x->compress_meth) <= 0) | ||
| 194 | goto err; | ||
| 195 | } else { | ||
| 196 | if (BIO_printf(bp, "\n Compression: %d (%s)", comp->id, comp->method->name) <= 0) | ||
| 197 | goto err; | ||
| 198 | } | ||
| 199 | } | ||
| 200 | #endif | ||
| 201 | if (x->time != 0) { | 185 | if (x->time != 0) { |
| 202 | if (BIO_printf(bp, "\n Start Time: %lld", (long long)x->time) <= 0) | 186 | if (BIO_printf(bp, "\n Start Time: %lld", (long long)x->time) <= 0) |
| 203 | goto err; | 187 | goto err; |
