Slightly simplify SSL3_RECORD.

There's no need to track consumed bytes, so rr->data and rr->off may be
merged together.

Change-Id: I8842d005665ea8b4d4a0cced941f3373872cdac4
Reviewed-on: https://boringssl-review.googlesource.com/6644
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h
index f127947..b89d622 100644
--- a/include/openssl/ssl.h
+++ b/include/openssl/ssl.h
@@ -3894,12 +3894,9 @@
 typedef struct ssl3_record_st {
   /* type is the record type. */
   uint8_t type;
-  /* length is the number of unconsumed bytes of |data|. */
+  /* length is the number of unconsumed bytes in the record. */
   uint16_t length;
-  /* off is the number of consumed bytes of |data|. */
-  uint16_t off;
-  /* data is a non-owning pointer to the record contents. The total length of
-   * the buffer is |off| + |length|. */
+  /* data is a non-owning pointer to the first unconsumed byte of the record. */
   uint8_t *data;
 } SSL3_RECORD;
 
diff --git a/ssl/d1_pkt.c b/ssl/d1_pkt.c
index c8ed9d8..29caa5e 100644
--- a/ssl/d1_pkt.c
+++ b/ssl/d1_pkt.c
@@ -164,7 +164,6 @@
       SSL3_RECORD *rr = &ssl->s3->rrec;
       rr->type = type;
       rr->length = (uint16_t)len;
-      rr->off = 0;
       rr->data = out;
       return 1;
 
@@ -324,12 +323,11 @@
       n = (unsigned int)len;
     }
 
-    memcpy(buf, &(rr->data[rr->off]), n);
+    memcpy(buf, rr->data, n);
     if (!peek) {
       rr->length -= n;
-      rr->off += n;
+      rr->data += n;
       if (rr->length == 0) {
-        rr->off = 0;
         /* The record has been consumed, so we may now clear the buffer. */
         ssl_read_buffer_discard(s);
       }
@@ -351,12 +349,13 @@
     }
 
     if (s->msg_callback) {
-      s->msg_callback(0, s->version, SSL3_RT_ALERT, &rr->data[rr->off], 2, s,
+      s->msg_callback(0, s->version, SSL3_RT_ALERT, rr->data, 2, s,
                       s->msg_callback_arg);
     }
-    const uint8_t alert_level = rr->data[rr->off++];
-    const uint8_t alert_descr = rr->data[rr->off++];
+    const uint8_t alert_level = rr->data[0];
+    const uint8_t alert_descr = rr->data[1];
     rr->length -= 2;
+    rr->data += 2;
 
     if (s->info_callback != NULL) {
       cb = s->info_callback;
@@ -428,7 +427,7 @@
       goto f_err;
     }
     struct hm_header_st msg_hdr;
-    dtls1_get_message_header(&rr->data[rr->off], &msg_hdr);
+    dtls1_get_message_header(rr->data, &msg_hdr);
 
     if (msg_hdr.type == SSL3_MT_FINISHED) {
       if (msg_hdr.frag_off == 0) {
diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c
index 6ca8a84..66970bc 100644
--- a/ssl/s3_pkt.c
+++ b/ssl/s3_pkt.c
@@ -158,7 +158,6 @@
       SSL3_RECORD *rr = &ssl->s3->rrec;
       rr->type = type;
       rr->length = (uint16_t)len;
-      rr->off = 0;
       rr->data = out;
       return 1;
 
@@ -461,12 +460,11 @@
       n = (unsigned int)len;
     }
 
-    memcpy(buf, &(rr->data[rr->off]), n);
+    memcpy(buf, rr->data, n);
     if (!peek) {
       rr->length -= n;
-      rr->off += n;
+      rr->data += n;
       if (rr->length == 0) {
-        rr->off = 0;
         /* The record has been consumed, so we may now clear the buffer. */
         ssl_read_buffer_discard(s);
       }
@@ -494,12 +492,12 @@
         /* Get a new record. */
         goto start;
       }
-      if (rr->data[rr->off] != kHelloRequest[s->s3->hello_request_len]) {
+      if (rr->data[0] != kHelloRequest[s->s3->hello_request_len]) {
         al = SSL_AD_DECODE_ERROR;
         OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_HELLO_REQUEST);
         goto f_err;
       }
-      rr->off++;
+      rr->data++;
       rr->length--;
       s->s3->hello_request_len++;
     }
@@ -559,12 +557,13 @@
     }
 
     if (s->msg_callback) {
-      s->msg_callback(0, s->version, SSL3_RT_ALERT, &rr->data[rr->off], 2, s,
+      s->msg_callback(0, s->version, SSL3_RT_ALERT, rr->data, 2, s,
                       s->msg_callback_arg);
     }
-    const uint8_t alert_level = rr->data[rr->off++];
-    const uint8_t alert_descr = rr->data[rr->off++];
+    const uint8_t alert_level = rr->data[0];
+    const uint8_t alert_descr = rr->data[1];
     rr->length -= 2;
+    rr->data += 2;
 
     if (s->info_callback != NULL) {
       cb = s->info_callback;