summaryrefslogtreecommitdiffstats
path: root/ssl/s3_both.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2005-10-08 00:18:53 +0000
committerDr. Stephen Henson <steve@openssl.org>2005-10-08 00:18:53 +0000
commit566dda07ba16f9d3b9774fd5c8d526d7cc93f179 (patch)
treed9c9971aa851fe9e977cddc2c1633a36973338ee /ssl/s3_both.c
parent7a2f4cbfe8d63d7212bcce9dee7ef3b4a0faca00 (diff)
New option SSL_OP_NO_COMP to disable compression. New ctrls to set
maximum send fragment size. Allocate I/O buffers accordingly.
Diffstat (limited to 'ssl/s3_both.c')
-rw-r--r--ssl/s3_both.c28
1 files changed, 21 insertions, 7 deletions
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;