Skip to content

Commit 4291de4

Browse files
committed
address comments
Signed-off-by: h2parson <h2parson@uwaterloo.ca>
1 parent 67ed3d0 commit 4291de4

3 files changed

Lines changed: 4 additions & 18 deletions

File tree

proofs/cbmc/sha3_init/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ USE_DYNAMIC_FRAMES=1
2424

2525
# Disable any setting of EXTERNAL_SAT_SOLVER, and choose SMT backend instead
2626
EXTERNAL_SAT_SOLVER=
27-
CBMCFLAGS=--bitwuzla
27+
CBMCFLAGS=--smt2
2828

2929
FUNCTION_NAME = sha3_init
3030

sha3_api.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
/* === FIPS 202: SHA-3 hash and SHAKE eXtensible Output Functions (XOF) */
77

8+
#include <string.h>
89
#include "sha3_api.h"
910
#include "cbmc.h"
1011

@@ -13,18 +14,8 @@
1314

1415
void sha3_init(sha3_var_t *c, size_t md_sz)
1516
{
16-
size_t i;
17-
18-
for (i = 0; i < 25; i++)
19-
__loop__(
20-
assigns(i, object_whole(c->st.d))
21-
invariant(i <= 25)
22-
invariant(forall(j, 0, i, c->st.d[j] == 0))
23-
decreases(25 - i)
24-
)
25-
{
26-
c->st.d[i] = 0;
27-
}
17+
memset(c->st.d, 0, 25*sizeof(uint64_t));
18+
2819
c->md_sz = md_sz; /* in SHAKE; if 0, padding done */
2920
c->r_sz = 200 - 2 * md_sz;
3021
c->pt = 0;

sha3_api.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ extern "C"
3737
requires(memory_no_alias(c, sizeof(sha3_var_t)))
3838
requires(md_sz <= 49)
3939
assigns(object_whole(c))
40-
ensures(forall(i, 0, 25, c->st.d[i] == 0))
41-
ensures(c->md_sz <= 49)
42-
ensures(c->r_sz <= 200)
43-
ensures(c->r_sz >= 0)
44-
ensures(c->pt == 0)
4540
);
4641

4742
void sha3_update(sha3_var_t *c, const void *data, size_t data_sz);

0 commit comments

Comments
 (0)