summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_asn1.c
diff options
context:
space:
mode:
authorguenther <>2014-04-16 15:10:07 +0000
committerguenther <>2014-04-16 15:10:07 +0000
commit07d70e2f624616050545c4fb6f6ba748c12b342e (patch)
treecd6b7bd17edfb25d9928b1c38f811f45391e4e97 /src/lib/libssl/ssl_asn1.c
parent0e08f2db38e867e26107d9826aa489a211882fb1 (diff)
downloadopenbsd-07d70e2f624616050545c4fb6f6ba748c12b342e.tar.gz
openbsd-07d70e2f624616050545c4fb6f6ba748c12b342e.tar.bz2
openbsd-07d70e2f624616050545c4fb6f6ba748c12b342e.zip
Kill the bogus "send an SSLv3/TLS hello in SSLv2 format" crap from
the SSLv23_* client code. The server continues to accept it. It also kills the bits for SSL2 SESSIONs; even when the server gets an SSLv2-style compat handshake, the session that it creates has the correct version internally. ok tedu@ beck@
Diffstat (limited to 'src/lib/libssl/ssl_asn1.c')
-rw-r--r--src/lib/libssl/ssl_asn1.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/src/lib/libssl/ssl_asn1.c b/src/lib/libssl/ssl_asn1.c
index 51668db785..28e295f6a4 100644
--- a/src/lib/libssl/ssl_asn1.c
+++ b/src/lib/libssl/ssl_asn1.c
@@ -165,16 +165,9 @@ i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp)
165 l = in->cipher_id; 165 l = in->cipher_id;
166 else 166 else
167 l = in->cipher->id; 167 l = in->cipher->id;
168 if (in->ssl_version == SSL2_VERSION) { 168 a.cipher.length = 2;
169 a.cipher.length = 3; 169 buf[0] = ((unsigned char)(l >> 8L))&0xff;
170 buf[0] = ((unsigned char)(l >> 16L))&0xff; 170 buf[1] = ((unsigned char)(l ))&0xff;
171 buf[1] = ((unsigned char)(l >> 8L))&0xff;
172 buf[2] = ((unsigned char)(l ))&0xff;
173 } else {
174 a.cipher.length = 2;
175 buf[0] = ((unsigned char)(l >> 8L))&0xff;
176 buf[1] = ((unsigned char)(l ))&0xff;
177 }
178 171
179#ifndef OPENSSL_NO_COMP 172#ifndef OPENSSL_NO_COMP
180 if (in->compress_meth) { 173 if (in->compress_meth) {
@@ -400,16 +393,7 @@ long length)
400 os.data = NULL; 393 os.data = NULL;
401 os.length = 0; 394 os.length = 0;
402 M_ASN1_D2I_get_x(ASN1_OCTET_STRING, osp, d2i_ASN1_OCTET_STRING); 395 M_ASN1_D2I_get_x(ASN1_OCTET_STRING, osp, d2i_ASN1_OCTET_STRING);
403 if (ssl_version == SSL2_VERSION) { 396 if ((ssl_version >> 8) >= SSL3_VERSION_MAJOR) {
404 if (os.length != 3) {
405 c.error = SSL_R_CIPHER_CODE_WRONG_LENGTH;
406 goto err;
407 }
408 id = 0x02000000L|
409 ((unsigned long)os.data[0]<<16L)|
410 ((unsigned long)os.data[1]<< 8L)|
411 (unsigned long)os.data[2];
412 } else if ((ssl_version >> 8) >= SSL3_VERSION_MAJOR) {
413 if (os.length != 2) { 397 if (os.length != 2) {
414 c.error = SSL_R_CIPHER_CODE_WRONG_LENGTH; 398 c.error = SSL_R_CIPHER_CODE_WRONG_LENGTH;
415 goto err; 399 goto err;
@@ -426,10 +410,7 @@ long length)
426 ret->cipher_id = id; 410 ret->cipher_id = id;
427 411
428 M_ASN1_D2I_get_x(ASN1_OCTET_STRING, osp, d2i_ASN1_OCTET_STRING); 412 M_ASN1_D2I_get_x(ASN1_OCTET_STRING, osp, d2i_ASN1_OCTET_STRING);
429 if ((ssl_version >> 8) >= SSL3_VERSION_MAJOR) 413 i = SSL3_MAX_SSL_SESSION_ID_LENGTH;
430 i = SSL3_MAX_SSL_SESSION_ID_LENGTH;
431 else /* if (ssl_version>>8 == SSL2_VERSION_MAJOR) */
432 i = SSL2_MAX_SSL_SESSION_ID_LENGTH;
433 414
434 if (os.length > i) 415 if (os.length > i)
435 os.length = i; 416 os.length = i;