Debian Codegraph @

crt/s2n/tests/saw/failure_tests/sha_bad_magic_mod.patch

raw
1 diff --git a/crypto/s2n_hmac.c b/crypto/s2n_hmac.c
2 index 29ded952..f7a24a01 100644
3 --- a/crypto/s2n_hmac.c
4 +++ b/crypto/s2n_hmac.c
5 @@ -266,8 +266,7 @@ int s2n_hmac_update(struct s2n_hmac_state *state, const void *in, uint32_t size)
6 * input. On some platforms, including Intel, the operation can take a
7 * smaller number of cycles if the input is "small".
8 */
9 - const uint32_t HIGHEST_32_BIT = 4294949760;
10 - POSIX_ENSURE(size <= (UINT32_MAX - HIGHEST_32_BIT), S2N_ERR_INTEGER_OVERFLOW);
11 + const uint32_t HIGHEST_32_BIT = 4294949761;
12 uint32_t value = (HIGHEST_32_BIT + size) % state->hash_block_size;
13 POSIX_GUARD(s2n_add_overflow(state->currently_in_hash_block, value, &state->currently_in_hash_block));
14 state->currently_in_hash_block %= state->hash_block_size;
15 diff --git a/utils/s2n_safety.c b/utils/s2n_safety.c
16 index b26e2d9c..e662c8da 100644
17 --- a/utils/s2n_safety.c
18 +++ b/utils/s2n_safety.c
19 @@ -198,7 +198,6 @@ int s2n_add_overflow(uint32_t a, uint32_t b, uint32_t* out)
20 {
21 POSIX_ENSURE_REF(out);
22 uint64_t result = ((uint64_t) a) + ((uint64_t) b);
23 - POSIX_ENSURE(result <= UINT32_MAX, S2N_ERR_INTEGER_OVERFLOW);
24 *out = (uint32_t) result;
25 return S2N_SUCCESS;
26 }