diff options
Diffstat (limited to 'src/lib/libssl/s3_pkt.c')
-rw-r--r-- | src/lib/libssl/s3_pkt.c | 69 |
1 files changed, 3 insertions, 66 deletions
diff --git a/src/lib/libssl/s3_pkt.c b/src/lib/libssl/s3_pkt.c index a508d5ee49..237d90c581 100644 --- a/src/lib/libssl/s3_pkt.c +++ b/src/lib/libssl/s3_pkt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s3_pkt.c,v 1.48 2014/06/19 21:29:51 tedu Exp $ */ | 1 | /* $OpenBSD: s3_pkt.c,v 1.49 2014/07/10 08:51:14 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 | * |
@@ -469,21 +469,6 @@ again: | |||
469 | goto f_err; | 469 | goto f_err; |
470 | } | 470 | } |
471 | 471 | ||
472 | /* r->length is now just compressed */ | ||
473 | if (s->expand != NULL) { | ||
474 | if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH + extra) { | ||
475 | al = SSL_AD_RECORD_OVERFLOW; | ||
476 | SSLerr(SSL_F_SSL3_GET_RECORD, | ||
477 | SSL_R_COMPRESSED_LENGTH_TOO_LONG); | ||
478 | goto f_err; | ||
479 | } | ||
480 | if (!ssl3_do_uncompress(s)) { | ||
481 | al = SSL_AD_DECOMPRESSION_FAILURE; | ||
482 | SSLerr(SSL_F_SSL3_GET_RECORD, SSL_R_BAD_DECOMPRESSION); | ||
483 | goto f_err; | ||
484 | } | ||
485 | } | ||
486 | |||
487 | if (rr->length > SSL3_RT_MAX_PLAIN_LENGTH + extra) { | 472 | if (rr->length > SSL3_RT_MAX_PLAIN_LENGTH + extra) { |
488 | al = SSL_AD_RECORD_OVERFLOW; | 473 | al = SSL_AD_RECORD_OVERFLOW; |
489 | SSLerr(SSL_F_SSL3_GET_RECORD, SSL_R_DATA_LENGTH_TOO_LONG); | 474 | SSLerr(SSL_F_SSL3_GET_RECORD, SSL_R_DATA_LENGTH_TOO_LONG); |
@@ -516,46 +501,6 @@ err: | |||
516 | return (ret); | 501 | return (ret); |
517 | } | 502 | } |
518 | 503 | ||
519 | int | ||
520 | ssl3_do_uncompress(SSL *ssl) | ||
521 | { | ||
522 | #ifndef OPENSSL_NO_COMP | ||
523 | int i; | ||
524 | SSL3_RECORD *rr; | ||
525 | |||
526 | rr = &(ssl->s3->rrec); | ||
527 | i = COMP_expand_block(ssl->expand, rr->comp, | ||
528 | SSL3_RT_MAX_PLAIN_LENGTH, rr->data, (int)rr->length); | ||
529 | if (i < 0) | ||
530 | return (0); | ||
531 | else | ||
532 | rr->length = i; | ||
533 | rr->data = rr->comp; | ||
534 | #endif | ||
535 | return (1); | ||
536 | } | ||
537 | |||
538 | int | ||
539 | ssl3_do_compress(SSL *ssl) | ||
540 | { | ||
541 | #ifndef OPENSSL_NO_COMP | ||
542 | int i; | ||
543 | SSL3_RECORD *wr; | ||
544 | |||
545 | wr = &(ssl->s3->wrec); | ||
546 | i = COMP_compress_block(ssl->compress, wr->data, | ||
547 | SSL3_RT_MAX_COMPRESSED_LENGTH, | ||
548 | wr->input, (int)wr->length); | ||
549 | if (i < 0) | ||
550 | return (0); | ||
551 | else | ||
552 | wr->length = i; | ||
553 | |||
554 | wr->input = wr->data; | ||
555 | #endif | ||
556 | return (1); | ||
557 | } | ||
558 | |||
559 | /* Call this to write data in records of type 'type' | 504 | /* Call this to write data in records of type 'type' |
560 | * It will return <= 0 if not all data has been sent or non-blocking IO. | 505 | * It will return <= 0 if not all data has been sent or non-blocking IO. |
561 | */ | 506 | */ |
@@ -766,16 +711,8 @@ do_ssl3_write(SSL *s, int type, const unsigned char *buf, | |||
766 | 711 | ||
767 | /* we now 'read' from wr->input, wr->length bytes into wr->data */ | 712 | /* we now 'read' from wr->input, wr->length bytes into wr->data */ |
768 | 713 | ||
769 | /* first we compress */ | 714 | memcpy(wr->data, wr->input, wr->length); |
770 | if (s->compress != NULL) { | 715 | wr->input = wr->data; |
771 | if (!ssl3_do_compress(s)) { | ||
772 | SSLerr(SSL_F_DO_SSL3_WRITE, SSL_R_COMPRESSION_FAILURE); | ||
773 | goto err; | ||
774 | } | ||
775 | } else { | ||
776 | memcpy(wr->data, wr->input, wr->length); | ||
777 | wr->input = wr->data; | ||
778 | } | ||
779 | 716 | ||
780 | /* we should still have the output to wr->data and the input | 717 | /* we should still have the output to wr->data and the input |
781 | * from wr->input. Length should be wr->length. | 718 | * from wr->input. Length should be wr->length. |