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)
This commit is contained in:
Hugo Landau 2023-11-23 15:50:03 +00:00
parent 2db3fdb457
commit e64ad80c72
2 changed files with 4 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;
}