]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Augment client side recieve code to store NEW_TOKENS
authorNeil Horman <nhorman@openssl.org>
Wed, 15 Jan 2025 21:21:09 +0000 (16:21 -0500)
committerNeil Horman <nhorman@openssl.org>
Mon, 17 Feb 2025 16:27:33 +0000 (11:27 -0500)
Start storing new tokens in our new cache

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26517)

include/internal/quic_port.h
include/internal/quic_ssl.h
ssl/quic/quic_impl.c
ssl/quic/quic_port.c
ssl/quic/quic_rx_depack.c

index 8465958a6f9bd45194c0e98deccf10163c3e7a1d..5c392346d0ac82ee8accc6bd35346783f6fa2f11 100644 (file)
@@ -113,6 +113,7 @@ BIO *ossl_quic_port_get_net_rbio(QUIC_PORT *port);
 BIO *ossl_quic_port_get_net_wbio(QUIC_PORT *port);
 int ossl_quic_port_set_net_rbio(QUIC_PORT *port, BIO *net_rbio);
 int ossl_quic_port_set_net_wbio(QUIC_PORT *port, BIO *net_wbio);
+SSL_CTX *ossl_quic_port_get_channel_ctx(QUIC_PORT *port);
 
 /*
  * Re-poll the network BIOs already set to determine if their support for
index da00816940dbebeceae4644af16bfce0e6da75d9..e95af55de90c2bd33c863095bda23fce1af2236f 100644 (file)
@@ -30,7 +30,7 @@ void ossl_quic_free_token_store(SSL_TOKEN_STORE_HANDLE *hdl);
 SSL_TOKEN_STORE_HANDLE *ossl_quic_get_token_store(SSL_CTX *ctx);
 int ossl_quic_set_token_store(SSL_CTX *ctx, SSL_TOKEN_STORE_HANDLE *hdl);
 int ossl_quic_update_peer_token(SSL_CTX *ctx, BIO_ADDR *peer,
-                                uint8_t *token, size_t token_len);
+                                const uint8_t *token, size_t token_len);
 int ossl_quic_get_peer_token(SSL_CTX *ctx, BIO_ADDR *peer,
                              uint8_t **token, size_t *token_len);
 
index cccad727d5c003edb160e2e7cd1435c032b2b393..72b4d4bae43ed59287e5f889120c7624ca21ae08 100644 (file)
@@ -4809,7 +4809,7 @@ static QUIC_TOKEN *ossl_quic_build_new_token(BIO_ADDR *peer, uint8_t *token,
 }
 
 int ossl_quic_update_peer_token(SSL_CTX *ctx, BIO_ADDR *peer,
-                                uint8_t *token, size_t token_len)
+                                const uint8_t *token, size_t token_len)
 {
     SSL_TOKEN_STORE *c = ctx->tokencache;
     QUIC_TOKEN *tok, *old = NULL;
@@ -4817,7 +4817,7 @@ int ossl_quic_update_peer_token(SSL_CTX *ctx, BIO_ADDR *peer,
     if (ctx->tokencache == NULL)
         return 0;
 
-    tok = ossl_quic_build_new_token(peer, token, token_len);
+    tok = ossl_quic_build_new_token(peer, (uint8_t *)token, token_len);
     if (tok == NULL)
         return 0;
 
index da658c8a5bef8245d9b1e249b7508d51bc7075b5..29b0edf878bb3173c099ba83b363619a59a0a524 100644 (file)
@@ -440,6 +440,11 @@ int ossl_quic_port_set_net_wbio(QUIC_PORT *port, BIO *net_wbio)
     return 1;
 }
 
+SSL_CTX *ossl_quic_port_get_channel_ctx(QUIC_PORT *port)
+{
+    return port->channel_ctx;
+}
+
 /*
  * QUIC Port: Channel Lifecycle
  * ============================
index 679d6cc3e029d5d03cfb8f42ade3d7ee3dc7fae5..cc0fdf856ea190aaa7b67c1e47db37d9dab12402 100644 (file)
@@ -350,7 +350,9 @@ static int depack_do_frame_new_token(PACKET *pkt, QUIC_CHANNEL *ch,
         return 0;
     }
 
-    /* TODO(QUIC FUTURE): ADD CODE to send |token| to the session manager */
+    /* store the new token in our token cache */
+    ossl_quic_update_peer_token(ossl_quic_port_get_channel_ctx(ch->port),
+                                &ch->cur_peer_addr, token, token_len);
 
     return 1;
 }