Move s->s3->wpend_* to s->rlayer
authorMatt Caswell <matt@openssl.org>
Tue, 3 Feb 2015 13:22:12 +0000 (13:22 +0000)
committerMatt Caswell <matt@openssl.org>
Thu, 26 Mar 2015 15:02:00 +0000 (15:02 +0000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
ssl/record/d1_pkt.c
ssl/record/rec_layer.h
ssl/record/s3_pkt.c
ssl/ssl_locl.h

index 5df1d3043af602ef249b44cfa7f12b8d1993d96b..3b69d8eb418d7f2316321f1bc10867709737fc8a 100644 (file)
@@ -1212,10 +1212,10 @@ int do_dtls1_write(SSL *s, int type, const unsigned char *buf,
      * memorize arguments so that ssl3_write_pending can detect bad write
      * retries later
      */
-    s->s3->wpend_tot = len;
-    s->s3->wpend_buf = buf;
-    s->s3->wpend_type = type;
-    s->s3->wpend_ret = len;
+    s->rlayer.wpend_tot = len;
+    s->rlayer.wpend_buf = buf;
+    s->rlayer.wpend_type = type;
+    s->rlayer.wpend_ret = len;
 
     /* we now just need to write the buffer */
     return ssl3_write_pending(s, type, buf, len);
index 0123c5682c01ff0cbc970852abe7fbbb21b1ea6f..c81c6ce5e0e0ee6165c39e854ecff91d275d6e1c 100644 (file)
@@ -166,6 +166,14 @@ typedef struct record_layer_st {
     unsigned int alert_fragment_len;
     unsigned char handshake_fragment[4];
     unsigned int handshake_fragment_len;
+
+    /* partial write - check the numbers match */
+    /* number bytes written */
+    int wpend_tot;
+    int wpend_type;
+    /* number of bytes submitted */
+    int wpend_ret;
+    const unsigned char *wpend_buf;
 } RECORD_LAYER;
 
 
index fea7dbbb03c2754325b8a1798f2b99820c0c857c..88209299a0a652b4762e7852e180938df8e0af25 100644 (file)
@@ -467,7 +467,7 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len)
      * will happen with non blocking IO
      */
     if (wb->left != 0) {
-        i = ssl3_write_pending(s, type, &buf[tot], s->s3->wpend_tot);
+        i = ssl3_write_pending(s, type, &buf[tot], s->rlayer.wpend_tot);
         if (i <= 0) {
             /* XXX should we ssl3_release_write_buffer if i<0? */
             s->rlayer.wnum = tot;
@@ -579,10 +579,10 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len)
             wb->offset = 0;
             wb->left = packlen;
 
-            s->s3->wpend_tot = nw;
-            s->s3->wpend_buf = &buf[tot];
-            s->s3->wpend_type = type;
-            s->s3->wpend_ret = nw;
+            s->rlayer.wpend_tot = nw;
+            s->rlayer.wpend_buf = &buf[tot];
+            s->rlayer.wpend_type = type;
+            s->rlayer.wpend_ret = nw;
 
             i = ssl3_write_pending(s, type, &buf[tot], nw);
             if (i <= 0) {
@@ -863,10 +863,10 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
      * memorize arguments so that ssl3_write_pending can detect bad write
      * retries later
      */
-    s->s3->wpend_tot = len;
-    s->s3->wpend_buf = buf;
-    s->s3->wpend_type = type;
-    s->s3->wpend_ret = len;
+    s->rlayer.wpend_tot = len;
+    s->rlayer.wpend_buf = buf;
+    s->rlayer.wpend_type = type;
+    s->rlayer.wpend_ret = len;
 
     /* we now just need to write the buffer */
     return ssl3_write_pending(s, type, buf, len);
@@ -882,10 +882,10 @@ int ssl3_write_pending(SSL *s, int type, const unsigned char *buf,
     SSL3_BUFFER *wb = &s->rlayer.wbuf;
 
 /* XXXX */
-    if ((s->s3->wpend_tot > (int)len)
-        || ((s->s3->wpend_buf != buf) &&
+    if ((s->rlayer.wpend_tot > (int)len)
+        || ((s->rlayer.wpend_buf != buf) &&
             !(s->mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER))
-        || (s->s3->wpend_type != type)) {
+        || (s->rlayer.wpend_type != type)) {
         SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BAD_WRITE_RETRY);
         return (-1);
     }
@@ -905,7 +905,7 @@ int ssl3_write_pending(SSL *s, int type, const unsigned char *buf,
             wb->left = 0;
             wb->offset += i;
             s->rwstate = SSL_NOTHING;
-            return (s->s3->wpend_ret);
+            return (s->rlayer.wpend_ret);
         } else if (i <= 0) {
             if (s->version == DTLS1_VERSION || s->version == DTLS1_BAD_VER) {
                 /*
index aa6217d9c63ced06bd16e1fc1d4f1c636151ff8f..b5f15fc7b4bfd65fab1de0ef983c11e5278019e4 100644 (file)
@@ -1237,11 +1237,6 @@ typedef struct ssl3_state_st {
     int empty_fragment_done;
     /* The value of 'extra' when the buffers were initialized */
     int init_extra;
-    /* partial write - check the numbers match */
-    int wpend_tot;              /* number bytes written */
-    int wpend_type;
-    int wpend_ret;              /* number of bytes submitted */
-    const unsigned char *wpend_buf;
     /* used during startup, digest all incoming/outgoing packets */
     BIO *handshake_buffer;
     /*