-
Notifications
You must be signed in to change notification settings - Fork 15
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
CBMC: Add spec + proof for polyvec_basemul_acc_montgomery_cached
+ poly_add
#306
Conversation
1f8d04a
to
7594067
Compare
@rod-chapman Something strange is happening here: The aliasing-precondition |
7594067
to
abedb00
Compare
I used |
abedb00
to
3715e60
Compare
7adc7e8
to
2374e95
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 @hanno-becker! The pre- and post-conditions are looking good. Some small suggestions.
Also could you add to the PR title that this also proves poly_add?
polyvec_basemul_acc_montgomery_cached
polyvec_basemul_acc_montgomery_cached
+ poly_add
2374e95
to
9f9d47d
Compare
9f9d47d
to
a8185ee
Compare
Opened #325 to discuss the right shape of harness |
a8185ee
to
5ffed5c
Compare
5ffed5c
to
5b58575
Compare
@mkannwischer @rod-chapman The reasoning about aliasing in I have thus specialized |
63c0aee
to
86e1d93
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! One typo in a comment - rest looks good to me now.
...proofs/polyvec_basemul_acc_montgomery_cached/polyvec_basemul_acc_montgomery_cached_harness.c
Outdated
Show resolved
Hide resolved
3f93523
to
b8e6d76
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 for addressing my comments. Looks good now.
This commit adds a CBMC spec and proof for `poly_add()`. Previously, poly_add() had the signature (r[out], a[in], b[in]), allowing the output polynomial to be separate from the two input polynomials. Yet, uses of `poly_add()` always have the form `poly_add(r,r,b)`, aliasing the first and second parameters, and thereby accumulating `b` onto `r`. Since aliasing poses additional verification challenges, and the non-aliased version of `poly_add()` is never used, this commit firstly modifies the signature of `poly_add()` to only take two inputs, accumulating the second onto the first. With that done, the spec and proof in CBMC are straightforward, taking care to use `OLD(...)` and `LOOP_ENTY(...)` in spec and loop invariants to refer to the original values of memory. Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>
The proof is less trivial than the ones before since one has to use the output bounds of the lower level functions to show that the accumulation loop does not overflow. Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>
b8e6d76
to
af5daa9
Compare
No description provided.