-
Notifications
You must be signed in to change notification settings - Fork 4
CBMC: Add proof and contract for mldsa_shake128_stream_init #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1f9db18
to
52364de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One unnecessary use of memory_no_alias
in the preconditions.
I see, you are correct. When I remove this precondition I get an issue with CBMC overflow detection:
|
@jakemas Yes, CBMC does not like implicit truncation. You need to explicitly mask: Have a look at https://github.com/pq-code-package/mlkem-native/blob/main/mlkem/compress.c#L101 where the same thing happened during compression in mlkem-native. |
Got it! Thanks! |
f5715ad
to
61649d8
Compare
3527674
to
27ebd64
Compare
proofs/cbmc/mldsa_shake128_stream_init/mldsa_shake128_stream_init_harness.c
Outdated
Show resolved
Hide resolved
3e3e284
to
86ad4c1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function arguments T foo[N]
must be declared as T* foo
in the harness, not as T foo[N]
. Otherwise, the function will only be considered for valid foo
, even if it does not have a precondition for foo
.
@jakemas Can you please check existing harnesses to ensure we are not doing this elsewhere? We should never allocate an array in a harness.
Signed-off-by: Jake Massimo <[email protected]>
0646741
to
53aebb3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jakemas!
Resolves #141