diff options
author | Hugo Landau <hlandau@openssl.org> | 2023-11-23 15:50:03 +0000 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2023-11-25 09:14:05 +0000 |
commit | e64ad80c72b0743871f02badfe199d713b0cdadd (patch) | |
tree | dfcd110bedc2405efec1721e7abd75d79b0885cf | |
parent | 2db3fdb4578ca43624acda81b72bc02b08c8ce3a (diff) |
QUIC SRT GEN: Minor updates
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22599)
-rw-r--r-- | ssl/quic/quic_srt_gen.c | 5 | ||||
-rw-r--r-- | test/quic_srt_gen_test.c | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/ssl/quic/quic_srt_gen.c b/ssl/quic/quic_srt_gen.c index e43a55b29e..233e4aa628 100644 --- a/ssl/quic/quic_srt_gen.c +++ b/ssl/quic/quic_srt_gen.c @@ -65,7 +65,7 @@ int ossl_quic_srt_gen_calculate_token(QUIC_SRT_GEN *srt_gen, QUIC_STATELESS_RESET_TOKEN *token) { size_t outl = 0; - unsigned char mac[32]; + unsigned char mac[SHA256_DIGEST_LENGTH]; if (!EVP_MAC_init(srt_gen->mac_ctx, NULL, 0, NULL)) return 0; @@ -78,6 +78,7 @@ int ossl_quic_srt_gen_calculate_token(QUIC_SRT_GEN *srt_gen, || outl != sizeof(mac)) return 0; - memcpy(token, mac, sizeof(*token)); + assert(sizeof(mac) >= sizeof(token->token)); + memcpy(token->token, mac, sizeof(token->token)); return 1; } diff --git a/test/quic_srt_gen_test.c b/test/quic_srt_gen_test.c index 6982f599c0..59f331d5af 100644 --- a/test/quic_srt_gen_test.c +++ b/test/quic_srt_gen_test.c @@ -65,7 +65,7 @@ static int test_srt_gen(int idx) &token))) goto err; - if (!TEST_mem_eq(&token, sizeof(token), + if (!TEST_mem_eq(token.token, sizeof(token.token), &t->expected, sizeof(t->expected))) goto err; } |