QUIC: Rename SSL_tick, SSL_get_tick_timeout
authorHugo Landau <hlandau@openssl.org>
Wed, 3 May 2023 18:01:12 +0000 (19:01 +0100)
committerTomas Mraz <tomas@openssl.org>
Mon, 29 May 2023 06:51:12 +0000 (08:51 +0200)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20879)

12 files changed:
include/internal/quic_ssl.h
include/openssl/ssl.h.in
ssl/quic/quic_impl.c
ssl/quic/quic_reactor.c
ssl/ssl_lib.c
test/helpers/quictestlib.c
test/quic_client_test.c
test/quic_multistream_test.c
test/quic_tserver_test.c
test/quicapitest.c
test/quicfaultstest.c
util/libssl.num

index 054ec30280816a3d8b54d6052c9f3a8cc49288c9..f3527dbf9584a2b305e95808bf994d1646fa1098 100644 (file)
@@ -45,9 +45,9 @@ void ossl_quic_set_connect_state(SSL *s);
 void ossl_quic_set_accept_state(SSL *s);
 
 __owur int ossl_quic_has_pending(const SSL *s);
-__owur int ossl_quic_tick(SSL *s);
-__owur int ossl_quic_get_tick_timeout(SSL *s, struct timeval *tv);
-OSSL_TIME ossl_quic_get_tick_deadline(SSL *s);
+__owur int ossl_quic_handle_events(SSL *s);
+__owur int ossl_quic_get_event_timeout(SSL *s, struct timeval *tv);
+OSSL_TIME ossl_quic_get_event_deadline(SSL *s);
 __owur int ossl_quic_get_rpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *d);
 __owur int ossl_quic_get_wpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *d);
 __owur int ossl_quic_get_net_read_desired(SSL *s);
index 4e79ce57468552da091b90dc39b557511d1e8708..dbfd0317ae46b048f9a1aa1999b53b835154d2f6 100644 (file)
@@ -2257,8 +2257,8 @@ int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets);
 size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx);
 
 /* QUIC support */
-int SSL_tick(SSL *s);
-__owur int SSL_get_tick_timeout(SSL *s, struct timeval *tv);
+int SSL_handle_events(SSL *s);
+__owur int SSL_get_event_timeout(SSL *s, struct timeval *tv);
 __owur int SSL_get_rpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *desc);
 __owur int SSL_get_wpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *desc);
 __owur int SSL_net_read_desired(SSL *s);
index 4ba87a32af9452b9b43ddcd51dc017aeef21312d..3297c93d5857561dcc0229d4af08057b4a81696d 100644 (file)
@@ -820,8 +820,8 @@ int ossl_quic_conn_set_initial_peer_addr(SSL *s,
  * QUIC Front-End I/O API: Asynchronous I/O Management
  * ===================================================
  *
- *   (BIO/)SSL_tick                 => ossl_quic_tick
- *   (BIO/)SSL_get_tick_timeout     => ossl_quic_get_tick_timeout
+ *   (BIO/)SSL_handle_events        => ossl_quic_handle_events
+ *   (BIO/)SSL_get_event_timeout    => ossl_quic_get_event_timeout
  *   (BIO/)SSL_get_poll_fd          => ossl_quic_get_poll_fd
  *
  */
@@ -839,9 +839,9 @@ static int xso_blocking_mode(const QUIC_XSO *xso)
         && xso->conn->can_poll_net_wbio;
 }
 
-/* SSL_tick; ticks the reactor. */
+/* SSL_handle_events; handles events by ticking the reactor. */
 QUIC_TAKES_LOCK
-int ossl_quic_tick(SSL *s)
+int ossl_quic_handle_events(SSL *s)
 {
     QCTX ctx;
 
@@ -855,13 +855,13 @@ int ossl_quic_tick(SSL *s)
 }
 
 /*
- * SSL_get_tick_timeout. Get the time in milliseconds until the SSL object
- * should be ticked by the application by calling SSL_tick(). tv is set to 0 if
- * the object should be ticked immediately and tv->tv_sec is set to -1 if no
- * timeout is currently active.
+ * SSL_get_event_timeout. Get the time in milliseconds until the SSL object
+ * should be ticked by the application by calling SSL_handle_events(). tv is set
+ * to 0 if the object should be ticked immediately and tv->tv_sec is set to -1
+ * if no timeout is currently active.
  */
 QUIC_TAKES_LOCK
-int ossl_quic_get_tick_timeout(SSL *s, struct timeval *tv)
+int ossl_quic_get_event_timeout(SSL *s, struct timeval *tv)
 {
     QCTX ctx;
     OSSL_TIME deadline = ossl_time_infinite();
index 4d65a408bbff1a58fe28e3e8235544e30cc178c3..ef447b78c324ddebc1f4249a15c7f6303426d145 100644 (file)
@@ -347,8 +347,9 @@ int ossl_quic_reactor_block_until_pred(QUIC_REACTOR *rtor,
              * the poll call. However this might be difficult because it
              * requires we do the call to poll(2) or equivalent syscall
              * ourselves, whereas in the general case the application does the
-             * polling and just calls SSL_tick(). Implementing this optimisation
-             * in the future will probably therefore require API changes.
+             * polling and just calls SSL_handle_events(). Implementing this
+             * optimisation in the future will probably therefore require API
+             * changes.
              */
             return 0;
     }
index 3bd9e8b48c417ee1d763adba0f29ed867d30a889..a29cb3e2c5894bfc1662292bea1cdbcdf1753b02 100644 (file)
@@ -7124,13 +7124,13 @@ int SSL_CTX_set0_tmp_dh_pkey(SSL_CTX *ctx, EVP_PKEY *dhpkey)
 }
 
 /* QUIC-specific methods which are supported on QUIC connections only. */
-int SSL_tick(SSL *s)
+int SSL_handle_events(SSL *s)
 {
     SSL_CONNECTION *sc;
 
 #ifndef OPENSSL_NO_QUIC
     if (IS_QUIC(s))
-        return ossl_quic_tick(s);
+        return ossl_quic_handle_events(s);
 #endif
 
     sc = SSL_CONNECTION_FROM_SSL_ONLY(s);
@@ -7148,13 +7148,13 @@ int SSL_tick(SSL *s)
     return 1;
 }
 
-int SSL_get_tick_timeout(SSL *s, struct timeval *tv)
+int SSL_get_event_timeout(SSL *s, struct timeval *tv)
 {
     SSL_CONNECTION *sc;
 
 #ifndef OPENSSL_NO_QUIC
     if (IS_QUIC(s))
-        return ossl_quic_get_tick_timeout(s, tv);
+        return ossl_quic_get_event_timeout(s, tv);
 #endif
 
     sc = SSL_CONNECTION_FROM_SSL_ONLY(s);
index c33518805dd18046aada409cbf625423f414c800..79f25dc1eb3dbc8d1b76da7a9e6bec0a6ebd1160 100644 (file)
@@ -268,7 +268,7 @@ int qtest_create_quic_connection(QUIC_TSERVER *qtserv, SSL *clientssl)
          * be done in a real application.
          */
         if (!clienterr && retc <= 0)
-            SSL_tick(clientssl);
+            SSL_handle_events(clientssl);
         if (!servererr && rets <= 0) {
             ossl_quic_tserver_tick(qtserv);
             servererr = ossl_quic_tserver_is_term_any(qtserv);
index 81b21fda3af3dfb11021dcadb79eb12f1226909d..e3fe678edd5283fdced44542986b436afc0dbeff 100644 (file)
@@ -148,7 +148,7 @@ static int test_quic_client(void)
          * blocking but this is just a test.
          */
         OSSL_sleep(0);
-        SSL_tick(c_ssl);
+        SSL_handle_events(c_ssl);
     }
 
     testresult = 1;
index f846a412b513ac36181c90b96a9f4ca8f42b93b9..3f56e0baa7687902ad1098c9126f6363e9340e7b 100644 (file)
@@ -632,7 +632,7 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
             ossl_quic_tserver_tick(h->s);
 
         if (thread_idx >= 0 || connect_started)
-            SSL_tick(h->c_conn);
+            SSL_handle_events(h->c_conn);
 
         if (thread_idx >= 0) {
             /* Only allow certain opcodes on child threads. */
index ae25adc44437ad3aa7f5a122b5f9fcf4f8b6a42a..eefb5ae743b400e2807b8c319a5ee540deda7a35 100644 (file)
@@ -333,7 +333,7 @@ static int do_test(int use_thread_assist, int use_fake_time, int use_inject)
          */
         if (!c_start_idle_test || c_done_idle_test) {
             /* Inhibit manual ticking during idle test to test TA mode. */
-            SSL_tick(c_ssl);
+            SSL_handle_events(c_ssl);
         }
 
         ossl_quic_tserver_tick(tserver);
index 25594ca061ac3c3212b156a4fedc59333c373680..957736eb9d82f10df0a3749d3d7c84ed1d0aa407 100644 (file)
@@ -91,7 +91,7 @@ static int test_quic_write_read(int idx)
                                                msglen, &numbytes)))
             goto end;
         ossl_quic_tserver_tick(qtserv);
-        SSL_tick(clientquic);
+        SSL_handle_events(clientquic);
         /*
          * In blocking mode the SSL_read_ex call will block until the socket is
          * readable and has our data. In non-blocking mode we're doing everything
index 1a0f41af801bc7e421a28c555d2bff12c439f013..c9b00ab280803a1e9c7de8eac262896e8befa09a 100644 (file)
@@ -132,7 +132,7 @@ static int test_unknown_frame(void)
         goto err;
 
     ossl_quic_tserver_tick(qtserv);
-    if (!TEST_true(SSL_tick(cssl)))
+    if (!TEST_true(SSL_handle_events(cssl)))
         goto err;
 
     if (!TEST_int_le(ret = SSL_read(cssl, buf, sizeof(buf)), 0))
@@ -145,10 +145,10 @@ static int test_unknown_frame(void)
     /*
      * TODO(QUIC): We should expect an error on the queue after this - but we
      * don't have it yet.
-     * Note, just raising the error in the obvious place causes SSL_tick() to
-     * succeed, but leave a suprious error on the stack. We need to either
-     * allow SSL_tick() to fail, or somehow delay the raising of the error
-     * until the SSL_read() call.
+     * Note, just raising the error in the obvious place causes
+     * SSL_handle_events() to succeed, but leave a suprious error on the stack.
+     * We need to either allow SSL_handle_events() to fail, or somehow delay the
+     * raising of the error until the SSL_read() call.
      */
     if (!TEST_int_eq(ERR_GET_REASON(ERR_peek_error()),
                      SSL_R_UNKNOWN_FRAME_TYPE_RECEIVED))
@@ -339,7 +339,7 @@ static int test_corrupted_data(int idx)
      * "lost". We also process the second packet which should be decrypted
      * successfully. Therefore we ack the frames in it
      */
-    if (!TEST_true(SSL_tick(cssl)))
+    if (!TEST_true(SSL_handle_events(cssl)))
         goto err;
 
     /*
@@ -349,7 +349,7 @@ static int test_corrupted_data(int idx)
     ossl_quic_tserver_tick(qtserv);
 
     /* Receive and process the newly arrived message data resend */
-    if (!TEST_true(SSL_tick(cssl)))
+    if (!TEST_true(SSL_handle_events(cssl)))
         goto err;
 
     /* The whole message should now have arrived */
index bd1e12934ee74f2dbb11623307d988935995df89..608c8fefbf0647e520c9e062ffe45d9b8937c412 100644 (file)
@@ -532,8 +532,6 @@ SSL_CTX_set1_compressed_cert            ?   3_2_0   EXIST::FUNCTION:
 SSL_set1_compressed_cert                ?      3_2_0   EXIST::FUNCTION:
 SSL_CTX_get1_compressed_cert            ?      3_2_0   EXIST::FUNCTION:
 SSL_get1_compressed_cert                ?      3_2_0   EXIST::FUNCTION:
-SSL_tick                                ?      3_2_0   EXIST::FUNCTION:
-SSL_get_tick_timeout                    ?      3_2_0   EXIST::FUNCTION:
 SSL_get_rpoll_descriptor                ?      3_2_0   EXIST::FUNCTION:
 SSL_get_wpoll_descriptor                ?      3_2_0   EXIST::FUNCTION:
 SSL_set_blocking_mode                   ?      3_2_0   EXIST::FUNCTION:
@@ -575,3 +573,5 @@ SSL_get_stream_read_error_code          ?   3_2_0   EXIST::FUNCTION:
 SSL_get_stream_write_error_code         ?      3_2_0   EXIST::FUNCTION:
 SSL_get_conn_close_info                 ?      3_2_0   EXIST::FUNCTION:
 SSL_set_incoming_stream_policy          ?      3_2_0   EXIST::FUNCTION:
+SSL_handle_events                       ?      3_2_0   EXIST::FUNCTION:
+SSL_get_event_timeout                   ?      3_2_0   EXIST::FUNCTION: