Debian Codegraph @

crt/s2n/tests/saw/HMAC/spec/modthm.cry

raw
1 valid_block_sizes : [16] -> [16] -> Bit
2 valid_block_sizes hbs bs =
3 // We're not handling SSLv3 yet.
4 //((bs, hbs) == (40, 64)) ||
5 //((bs, hbs) == (48, 64)) ||
6 ((bs, hbs) == (64, 64)) ||
7 ((bs, hbs) == (128, 128))
8
9 modthm : [32] -> [32] -> [32] -> [16] -> [16] -> Bit
10 modthm x11 x15 x16 hash_block_size block_size =
11 ((((x11 + (x16 % x17)) % x18) + (x15 % x17)) % x18)
12 ==
13 ((x11 + ((x16 + x15) % x17)) % x18)
14 where x17 = zero # hash_block_size
15 x18 = zero # block_size
16
17 modthm_precond : [32] -> [32] -> [32] -> [16] -> [16] -> Bit
18 modthm_precond x11 x15 x16 hash_block_size block_size =
19 if (valid_block_sizes hash_block_size block_size) then
20 modthm x11 x15 x16 hash_block_size block_size
21 else True