summaryrefslogtreecommitdiffstats
path: root/ssl/s3_both.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2002-04-13 22:47:20 +0000
committerBodo Möller <bodo@openssl.org>2002-04-13 22:47:20 +0000
commit82b0bf0b8792bdc113cadc04a1f9d40f0e0cfbfc (patch)
tree708f5e5cb06a863a90c9742071bae98310b5b980 /ssl/s3_both.c
parent3a7cef3e76aae1ef0d03f50b9e7ebcdf41b30c90 (diff)
Implement known-IV countermeasure.
Fix length checks in ssl3_get_client_hello(). Use s->s3->in_read_app_data differently to fix ssl3_read_internal().
Diffstat (limited to 'ssl/s3_both.c')
-rw-r--r--ssl/s3_both.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/ssl/s3_both.c b/ssl/s3_both.c
index 89b54b71d3..58a24cd883 100644
--- a/ssl/s3_both.c
+++ b/ssl/s3_both.c
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
/* ====================================================================
- * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -592,6 +592,7 @@ int ssl3_setup_buffers(SSL *s)
{
unsigned char *p;
unsigned int extra;
+ size_t len;
if (s->s3->rbuf.buf == NULL)
{
@@ -599,18 +600,21 @@ int ssl3_setup_buffers(SSL *s)
extra=SSL3_RT_MAX_EXTRA;
else
extra=0;
- if ((p=OPENSSL_malloc(SSL3_RT_MAX_PACKET_SIZE+extra))
- == NULL)
+ len = SSL3_RT_MAX_PACKET_SIZE + extra;
+ if ((p=OPENSSL_malloc(len)) == NULL)
goto err;
- s->s3->rbuf.buf=p;
+ s->s3->rbuf.buf = p;
+ s->s3->rbuf.len = len;
}
if (s->s3->wbuf.buf == NULL)
{
- if ((p=OPENSSL_malloc(SSL3_RT_MAX_PACKET_SIZE))
- == NULL)
+ len = SSL3_RT_MAX_PACKET_SIZE;
+ len += SSL3_RT_HEADER_LENGTH + 256; /* extra space for empty fragment */
+ if ((p=OPENSSL_malloc(len)) == NULL)
goto err;
- s->s3->wbuf.buf=p;
+ s->s3->wbuf.buf = p;
+ s->s3->wbuf.len = len;
}
s->packet= &(s->s3->rbuf.buf[0]);
return(1);