From: Matt Caswell Date: Wed, 27 Jul 2022 13:28:36 +0000 (+0100) Subject: Remove the SSL3_RECORD read field X-Git-Tag: openssl-3.2.0-alpha1~2202 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9007412c1e1fd4bb9298901dae36064cd279c02a;p=thirdparty%2Fopenssl.git Remove the SSL3_RECORD read field The read field is no longer used and can be safely removed. Reviewed-by: Hugo Landau Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/18132) --- diff --git a/ssl/record/methods/dtls_meth.c b/ssl/record/methods/dtls_meth.c index 718e0d8e5e0..05bfa6e2d7c 100644 --- a/ssl/record/methods/dtls_meth.c +++ b/ssl/record/methods/dtls_meth.c @@ -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 */ } diff --git a/ssl/record/methods/tls_common.c b/ssl/record/methods/tls_common.c index 4fc5c010dea..13efb82c612 100644 --- a/ssl/record/methods/tls_common.c +++ b/ssl/record/methods/tls_common.c @@ -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; diff --git a/ssl/record/record.h b/ssl/record/record.h index 4d3f7169dd2..d3984195afd 100644 --- a/ssl/record/record.h +++ b/ssl/record/record.h @@ -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;