improve binary compatibility
authorBodo Möller <bodo@openssl.org>
Sun, 14 Apr 2002 08:25:41 +0000 (08:25 +0000)
committerBodo Möller <bodo@openssl.org>
Sun, 14 Apr 2002 08:25:41 +0000 (08:25 +0000)
ssl/s3_both.c
ssl/s3_lib.c
ssl/s3_pkt.c
ssl/ssl3.h

index e4378217bf079134c2205811bd3f391d45cb3032..beb562868de517863a7ecef58db987336db00bdc 100644 (file)
@@ -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);
index 56f02939630cc02cd8f84a692c9862b16193b3ec..57a3fa4f8156ccebf4fbde6ecf3fe92089e5e866 100644 (file)
@@ -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);
 
index d5b358e2b4b32d9b22e4e781fdb5cfbbaf118bd0..fb086dcc861f1e2dceaddd8a49973133e5bfde36 100644 (file)
@@ -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);
index b5418d1c363ce68496581d39b96c45f583485f40..b45effe052ee8332f85bf3db58af8ea31f896609 100644 (file)
@@ -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;