]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Remove some references to rlayer.rstate
authorMatt Caswell <matt@openssl.org>
Thu, 21 Jul 2022 14:39:39 +0000 (15:39 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 18 Aug 2022 15:38:13 +0000 (16:38 +0100)
This also fixes ssl3_pending while we are at it

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/tls_common.c
ssl/record/rec_layer_d1.c
ssl/record/rec_layer_s3.c

index 9ae91184956b0103f21e58c08cdefb2527b0b0ab..d414c016f1af407abed8ba9a3651df86a47947b0 100644 (file)
@@ -1265,7 +1265,15 @@ int tls_processed_read_pending(OSSL_RECORD_LAYER *rl)
 
 size_t tls_app_data_pending(OSSL_RECORD_LAYER *rl)
 {
-    return 0;
+    size_t i;
+    size_t num = 0;
+
+    for (i = rl->curr_rec; i <rl->num_recs; i++) {
+        if (rl->rrec[i].type != SSL3_RT_APPLICATION_DATA)
+            return num;
+        num += rl->rrec[i].length;
+    }
+    return num;
 }
 
 int tls_write_pending(OSSL_RECORD_LAYER *rl)
index 50762e0762972cb3b7c042a254e9a7439c093d9b..a621d089840af1248f0441ac91555c7f1f6884f9 100644 (file)
@@ -379,11 +379,8 @@ int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf,
                 OPENSSL_cleanse(&(rr->data[rr->off]), n);
             rr->length -= n;
             rr->off += n;
-            if (rr->length == 0) {
-                /* TODO(RECLAYER): Do something with this? */
-                sc->rlayer.rstate = SSL_ST_READ_HEADER;
+            if (rr->length == 0)
                 ssl_release_record(sc, rr);
-            }
         }
 #ifndef OPENSSL_NO_SCTP
         /*
index 30796f2024a2e78b7e023c19354aef8b2febbbed..2407efa0e0acbbbfddb185906cb6afd24aa613a9 100644 (file)
@@ -1357,13 +1357,8 @@ int ssl3_read_bytes(SSL *ssl, int type, int *recvd_type, unsigned char *buf,
                     OPENSSL_cleanse(&(rr->data[rr->off]), n);
                 rr->length -= n;
                 rr->off += n;
-                if (rr->length == 0) {
-                    /* TODO(RECLAYER): What to do with this? Is it needed? */
-                    #if 0
-                    s->rlayer.rstate = SSL_ST_READ_HEADER;
-                    #endif
+                if (rr->length == 0)
                     ssl_release_record(s, rr);
-                }
             }
             if (rr->length == 0
                 || (peek && n == rr->length)) {