Minor updates 2
authorHugo Landau <hlandau@openssl.org>
Thu, 6 Jul 2023 19:14:10 +0000 (20:14 +0100)
committerPauli <pauli@openssl.org>
Sun, 16 Jul 2023 22:18:05 +0000 (08:18 +1000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21135)

include/internal/quic_stream_map.h
ssl/quic/quic_impl.c
ssl/quic/quic_rx_depack.c
ssl/quic/quic_txp.c
test/quic_multistream_test.c

index 3202382d0a497fb0b18253e92144a77ad54469b9..bff2e11fd21ad633b56a3d463b891557bb8bb16a 100644 (file)
@@ -164,7 +164,7 @@ struct quic_stream_st {
     unsigned int    active : 1;
 
     /*
-     * This is a cpoy of the QUIC connection as_server  value, indicating
+     * This is a copy of the QUIC connection as_server value, indicating
      * whether we are locally operating as a server or not. Having this
      * significantly simplifies stream type determination relative to our
      * perspective. It never changes after a QUIC_STREAM is created and is the
@@ -717,7 +717,7 @@ int ossl_quic_stream_map_notify_totally_received(QUIC_STREAM_MAP *qsm,
 
 /*
  * Transitions from the DATA_RECVD receive stream state to the DATA_READ state.
- * This shuld be called once all data for a receive stream is read by the
+ * This should be called once all data for a receive stream is read by the
  * application.
  *
  * Returns 1 if the transition was taken.
index 3051a1318c14e278c19a5ddefa330f7e72b6337d..d9bdf74efe7a0d66a032d0b87be616aa54769cdb 100644 (file)
@@ -2753,11 +2753,14 @@ int ossl_quic_stream_reset(SSL *ssl,
     qs          = ctx.xso->stream;
     error_code  = (args != NULL ? args->quic_error_code : 0);
 
-    if (!quic_validate_for_write(ctx.xso, &err))
-        return QUIC_RAISE_NON_NORMAL_ERROR(&ctx, err, NULL);
+    if (!quic_validate_for_write(ctx.xso, &err)) {
+        ok = QUIC_RAISE_NON_NORMAL_ERROR(&ctx, err, NULL);
+        goto err;
+    }
 
     ok = ossl_quic_stream_map_reset_stream_send_part(qsm, qs, error_code);
 
+err:
     quic_unlock(ctx.qc);
     return ok;
 }
index 71f47705f34e52452b4926718b6bedadd0ed540e..a3db49b7ff1042d9e8db97a4bfd88c1b70fb6056 100644 (file)
@@ -195,7 +195,7 @@ static int depack_do_frame_reset_stream(PACKET *pkt,
      * Depending on the receive part state this is handled either as a reset
      * transition or a no-op (e.g. if a reset has already been received before,
      * or the application already retired a FIN). Best effort - there are no
-     * protoocol error conditions we need to check for here.
+     * protocol error conditions we need to check for here.
      */
     ossl_quic_stream_map_notify_reset_recv_part(&ch->qsm, stream,
                                                 frame_data.app_error_code,
@@ -571,9 +571,12 @@ static int depack_do_frame_stream(PACKET *pkt, QUIC_CHANNEL *ch,
 
     /*
      * rs_fin will be 1 only if we can read all data up to and including the FIN
-     * without any gaps before it; this implies we have received all data.
+     * without any gaps before it; this implies we have received all data. Avoid
+     * calling ossl_quic_rstream_available() where it is not necessary as it is
+     * more expensive.
      */
-    if (!ossl_quic_rstream_available(stream->rstream, &rs_avail, &rs_fin))
+    if (stream->recv_state != QUIC_RSTREAM_STATE_SIZE_KNOWN
+        || !ossl_quic_rstream_available(stream->rstream, &rs_avail, &rs_fin))
         return 0;
 
     if (rs_fin)
index a4957c7c39f19138c99d62c19d25d7b94642f4fb..e008255b22da532e4ff29ba54950f64b878a498a 100644 (file)
@@ -1964,7 +1964,7 @@ static int txp_generate_stream_related(OSSL_QUIC_TX_PACKETISER *txp,
          *
          * RFC 9000 s. 3.3: A sender MUST NOT send a STREAM [...] frame for a
          * stream in the "Reset Sent" state [or any terminal state]. We don't
-         * send any moore STREAM frames if we are sending, have sent, or are
+         * send any more STREAM frames if we are sending, have sent, or are
          * planning to send, RESET_STREAM. The other terminal state is Data
          * Recvd, but txp_generate_stream_frames() is guaranteed to generate
          * nothing in this case.
index ad6c0c9e64d88e83174b8427af9f39383f3b40c5..a8e345202a02243e6afca3553c473db5346b7146 100644 (file)
@@ -458,10 +458,8 @@ static void helper_cleanup(struct helper *h)
     BIO_free(h->s_qtf_wbio_own);
     h->s_qtf_wbio_own = NULL;
 
-    if (h->qtf != NULL) {
-        qtest_fault_free(h->qtf);
-        h->qtf = NULL;
-    }
+    qtest_fault_free(h->qtf);
+    h->qtf = NULL;
 
     if (h->s_fd >= 0) {
         BIO_closesocket(h->s_fd);