From 566dda07ba16f9d3b9774fd5c8d526d7cc93f179 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Sat, 8 Oct 2005 00:18:53 +0000 Subject: New option SSL_OP_NO_COMP to disable compression. New ctrls to set maximum send fragment size. Allocate I/O buffers accordingly. --- ssl/s3_both.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'ssl/s3_both.c') diff --git a/ssl/s3_both.c b/ssl/s3_both.c index 2ecfbb77cb..09d72e545d 100644 --- a/ssl/s3_both.c +++ b/ssl/s3_both.c @@ -589,16 +589,22 @@ int ssl_verify_alarm_type(long type) int ssl3_setup_buffers(SSL *s) { unsigned char *p; - unsigned int extra; size_t len; if (s->s3->rbuf.buf == NULL) { + len = SSL3_RT_MAX_PLAIN_LENGTH + + SSL3_RT_MAX_ENCRYPTED_OVERHEAD + + SSL3_RT_HEADER_LENGTH; if (s->options & SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER) - extra=SSL3_RT_MAX_EXTRA; - else - extra=0; - len = SSL3_RT_MAX_PACKET_SIZE + extra; + { + s->s3->init_extra = 1; + len += SSL3_RT_MAX_EXTRA; + } +#ifndef OPENSSL_NO_COMP + if (!(s->options & SSL_OP_NO_COMPRESSION)) + len += SSL3_RT_MAX_COMPRESSED_OVERHEAD; +#endif if ((p=OPENSSL_malloc(len)) == NULL) goto err; s->s3->rbuf.buf = p; @@ -607,8 +613,16 @@ int ssl3_setup_buffers(SSL *s) if (s->s3->wbuf.buf == NULL) { - len = SSL3_RT_MAX_PACKET_SIZE; - len += SSL3_RT_HEADER_LENGTH + 256; /* extra space for empty fragment */ + len = s->max_send_fragment + + SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD + + SSL3_RT_HEADER_LENGTH; +#ifndef OPENSSL_NO_COMP + if (!(s->options & SSL_OP_NO_COMPRESSION)) + len += SSL3_RT_MAX_COMPRESSED_OVERHEAD; +#endif + if (!(s->options & SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS)) + len += SSL3_RT_HEADER_LENGTH + + SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD; if ((p=OPENSSL_malloc(len)) == NULL) goto err; s->s3->wbuf.buf = p; -- cgit v1.2.3