From: Bodo Möller Date: Sun, 14 Apr 2002 08:25:41 +0000 (+0000) Subject: improve binary compatibility X-Git-Tag: OpenSSL_0_9_6d-beta1~3 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a6ec2d58ba3d6a26347efa9d53465a6079440715;p=oweals%2Fopenssl.git improve binary compatibility --- diff --git a/ssl/s3_both.c b/ssl/s3_both.c index e4378217bf..beb562868d 100644 --- a/ssl/s3_both.c +++ b/ssl/s3_both.c @@ -584,7 +584,7 @@ int ssl3_setup_buffers(SSL *s) if ((p=OPENSSL_malloc(len)) == NULL) goto err; s->s3->rbuf.buf = p; - s->s3->rbuf.len = len; + s->s3->rbuf_len = len; } if (s->s3->wbuf.buf == NULL) @@ -594,7 +594,7 @@ int ssl3_setup_buffers(SSL *s) if ((p=OPENSSL_malloc(len)) == NULL) goto err; s->s3->wbuf.buf = p; - s->s3->wbuf.len = len; + s->s3->wbuf_len = len; } s->packet= &(s->s3->rbuf.buf[0]); return(1); diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index 56f0293963..57a3fa4f81 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -758,14 +758,14 @@ void ssl3_clear(SSL *s) rp = s->s3->rbuf.buf; wp = s->s3->wbuf.buf; - rlen = s->s3->rbuf.len; - wlen = s->s3->wbuf.len; + rlen = s->s3->rbuf_len; + wlen = s->s3->wbuf_len; memset(s->s3,0,sizeof *s->s3); s->s3->rbuf.buf = rp; s->s3->wbuf.buf = wp; - s->s3->rbuf.len = rlen; - s->s3->wbuf.len = wlen; + s->s3->rbuf_len = rlen; + s->s3->wbuf_len = wlen; ssl_free_wbio_buffer(s); diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c index d5b358e2b4..fb086dcc86 100644 --- a/ssl/s3_pkt.c +++ b/ssl/s3_pkt.c @@ -162,7 +162,7 @@ static int ssl3_read_n(SSL *s, int n, int max, int extend) { /* avoid buffer overflow */ - int max_max = s->s3->rbuf.len - s->packet_length; + int max_max = s->s3->rbuf_len - s->packet_length; if (max > max_max) max = max_max; } @@ -245,7 +245,7 @@ static int ssl3_get_record(SSL *s) extra=SSL3_RT_MAX_EXTRA; else extra=0; - if (extra != (s->s3->rbuf.len - SSL3_RT_MAX_PACKET_SIZE)) + if (extra != (s->s3->rbuf_len - SSL3_RT_MAX_PACKET_SIZE)) { /* actually likely an application error: SLS_OP_MICROSOFT_BIG_SSLV3_BUFFER * set after ssl3_setup_buffers() was done */ @@ -258,7 +258,7 @@ again: if ( (s->rstate != SSL_ST_READ_BODY) || (s->packet_length < SSL3_RT_HEADER_LENGTH)) { - n=ssl3_read_n(s, SSL3_RT_HEADER_LENGTH, s->s3->rbuf.len, 0); + n=ssl3_read_n(s, SSL3_RT_HEADER_LENGTH, s->s3->rbuf_len, 0); if (n <= 0) return(n); /* error or non-blocking */ s->rstate=SSL_ST_READ_BODY; @@ -605,7 +605,7 @@ static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, if (prefix_len <= 0) goto err; - if (s->s3->wbuf.len < prefix_len + SSL3_RT_MAX_PACKET_SIZE) + if (s->s3->wbuf_len < prefix_len + SSL3_RT_MAX_PACKET_SIZE) { /* insufficient space */ SSLerr(SSL_F_DO_SSL3_WRITE, SSL_R_INTERNAL_ERROR); diff --git a/ssl/ssl3.h b/ssl/ssl3.h index b5418d1c36..b45effe052 100644 --- a/ssl/ssl3.h +++ b/ssl/ssl3.h @@ -252,19 +252,13 @@ typedef struct ssl3_record_st /*r */ unsigned char *comp; /* only used with decompression - malloc()ed */ } SSL3_RECORD; -/* 'dummy' variant for binary compatibility ... */ -typedef struct dummy_ssl3_buffer_st - { - unsigned char *buf; /* at least SSL3_RT_MAX_PACKET_SIZE bytes, - * see ssl3_setup_buffers() */ - int offset; /* where to 'copy from' */ - int left; /* how many bytes left */ - } DUMMY_SSL3_BUFFER; typedef struct ssl3_buffer_st { unsigned char *buf; /* at least SSL3_RT_MAX_PACKET_SIZE bytes, * see ssl3_setup_buffers() */ +#if 0 /* put directly into SSL3_STATE for best possible binary compatibility within 0.9.6 series */ size_t len; /* buffer size */ +#endif int offset; /* where to 'copy from' */ int left; /* how many bytes left */ } SSL3_BUFFER; @@ -296,11 +290,8 @@ typedef struct ssl3_state_st unsigned char server_random[SSL3_RANDOM_SIZE]; unsigned char client_random[SSL3_RANDOM_SIZE]; - /* dummies for best possible binary compatibility within 0.9.6 series - * (indexes to other struct members should remain unchanged); - * real 'rbuf' and 'wbuf' are added at the end of this struct */ - DUMMY_SSL3_BUFFER dummy_rbuf; - DUMMY_SSL3_BUFFER dummy_wbuf; + SSL3_BUFFER rbuf; /* read IO goes into here */ + SSL3_BUFFER wbuf; /* write IO goes into here */ SSL3_RECORD rrec; /* each decoded record goes in here */ SSL3_RECORD wrec; /* goes out from here */ @@ -390,8 +381,8 @@ typedef struct ssl3_state_st int need_empty_fragments; int empty_fragment_done; - SSL3_BUFFER rbuf; /* read IO goes into here */ - SSL3_BUFFER wbuf; /* write IO goes into here */ + size_t rbuf_len; /* substitute for rbuf.len */ + size_t wbuf_len; /* substitute for wbuf.len */ } SSL3_STATE;