]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Remove the SSL3_RECORD read field
authorMatt Caswell <matt@openssl.org>
Wed, 27 Jul 2022 13:28:36 +0000 (14:28 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 18 Aug 2022 15:38:14 +0000 (16:38 +0100)
The read field is no longer used and can be safely removed.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18132)

ssl/record/methods/dtls_meth.c
ssl/record/methods/tls_common.c
ssl/record/record.h

index 718e0d8e5e0b668659027992d7abb4659c7ce698..05bfa6e2d7c9b31030763f93e8cd87745600959c 100644 (file)
@@ -449,7 +449,6 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
         p += 6;
 
         n2s(p, rr->length);
-        rr->read = 0;
 
         /*
          * Lets check the version. We tolerate alerts that don't have the exact
@@ -459,7 +458,6 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
             if (version != rl->version) {
                 /* unexpected version, silently discard */
                 rr->length = 0;
-                rr->read = 1;
                 rl->packet_length = 0;
                 goto again;
             }
@@ -471,7 +469,6 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
                                                    : rl->version >> 8)) {
             /* wrong version, silently discard record */
             rr->length = 0;
-            rr->read = 1;
             rl->packet_length = 0;
             goto again;
         }
@@ -479,7 +476,6 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
         if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH) {
             /* record too long, silently discard it */
             rr->length = 0;
-            rr->read = 1;
             rl->packet_length = 0;
             goto again;
         }
@@ -493,7 +489,6 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
                 && rr->length > rl->max_frag_len + SSL3_RT_MAX_ENCRYPTED_OVERHEAD) {
             /* record too long, silently discard it */
             rr->length = 0;
-            rr->read = 1;
             rl->packet_length = 0;
             goto again;
         }
@@ -515,7 +510,6 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
                 return OSSL_RECORD_RETURN_FATAL;
             }
             rr->length = 0;
-            rr->read = 1;
             rl->packet_length = 0;
             goto again;
         }
@@ -542,7 +536,6 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
         /* Check whether this is a repeat, or aged record. */
         if (!dtls_record_replay_check(rl, bitmap)) {
             rr->length = 0;
-            rr->read = 1;
             rl->packet_length = 0; /* dump this record */
             goto again;         /* get another record */
         }
@@ -551,10 +544,8 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
 #endif
 
     /* just read a 0 length packet */
-    if (rr->length == 0) {
-        rr->read = 1;
+    if (rr->length == 0)
         goto again;
-    }
 
     /*
      * If this record is from the next epoch (either HM or ALERT), and a
@@ -571,7 +562,6 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
             }
         }
         rr->length = 0;
-        rr->read = 1;
         rl->packet_length = 0;
         goto again;
     }
@@ -582,7 +572,6 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
             return OSSL_RECORD_RETURN_FATAL;
         }
         rr->length = 0;
-        rr->read = 1;
         rl->packet_length = 0; /* dump this record */
         goto again;             /* get another record */
     }
index 4fc5c010dea14793c92c0cfb73a75032c1c87dec..13efb82c6125d65141c6cdb5b125a3d79f20a21d 100644 (file)
@@ -588,9 +588,6 @@ int tls_get_more_records(OSSL_RECORD_LAYER *rl)
         thisrr->data = thisrr->input;
         thisrr->orig_len = thisrr->length;
 
-        /* Mark this record as not read by upper layers yet */
-        thisrr->read = 0;
-
         num_recs++;
 
         /* we have pulled in a full packet so zero things */
@@ -627,7 +624,6 @@ int tls_get_more_records(OSSL_RECORD_LAYER *rl)
                         SSL_R_UNEXPECTED_CCS_MESSAGE);
             return OSSL_RECORD_RETURN_FATAL;
         }
-        thisrr->read = 1;
         rl->num_recs = 0;
         rl->curr_rec = 0;
         rl->num_released = 0;
@@ -714,7 +710,6 @@ int tls_get_more_records(OSSL_RECORD_LAYER *rl)
             }
 
             thisrr->length = 0;
-            thisrr->read = 1;
             rl->num_recs = 0;
             rl->curr_rec = 0;
             rl->num_released = 0;
index 4d3f7169dd2c11e3f9a62af091ee343db68ffe02..d3984195afdb651b395d781c314b28ebaf8e2bad 100644 (file)
@@ -65,9 +65,6 @@ typedef struct ssl3_record_st {
     /* only used with decompression - malloc()ed */
     /* r */
     unsigned char *comp;
-    /* Whether the data from this record has already been read or not */
-    /* r */
-    unsigned int read;
     /* epoch number, needed by DTLS1 */
     /* r */
     unsigned long epoch;