-
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
Remove NTT_BOUND_NATIVE and INVNTT_BOUND_NATIVE #645
Conversation
dcec93e
to
3ead8ca
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.
I'm fine with removing the native bounds as there is no real value in them.
Should we also move the static bound assertions?
The numeric macros NTT_BOUND_NATIVE and INVNTT_BOUND_NATIVE could be used by backends to specify an output bound for the forward and inverse NTT. We would then use STATIC_ASSERT's to check that those backend-specific bounds would imply the bounds (NTT_BOUND and INVNTT_BOUND) that the CBMC proofs work against. The added value of NTT_BOUND_NATIVE and INVNTT_BOUND_NATIVE is questionable. In the end, what we care about is that the native NTT and invNTT adhere to the bounds that CBMC relies on. Any strengthening of the bounds may be good to know, but is otherwise an unnecessary complication of the code. This commit removes NTT_BOUND_NATIVE and INVNTT_BOUND_NATIVE and uses the contractual bounds NTT_BOUND and INVNT_BOUND in their place. Similarly, INVNTT_BOUND_REF is removed, which is finer bound for the reference invNTT. Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>
We conduct some basic static sanity checks on the values of NTT_BOUND and INVNTT_BOUND. Previously, those checks were done using a `STATIC_ASSERT` macro. The `STATIC_ASSERT` macro was otherwise not used. This commit rewrites said bounds checks using plain `#if ...`. It therefore eliminates the need for `STATIC_ASSERT`, which is removed. Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>
3ead8ca
to
1f08487
Compare
Those assertions are already checked by CBMC. Repeating them does not add value but impedes readability. Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>
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 the changes. LGTM.
The numeric macros NTT_BOUND_NATIVE and INVNTT_BOUND_NATIVE could be used by backends to specify an output bound for the forward and inverse NTT. We would then use STATIC_ASSERT's to check that those backend-specific bounds would imply the bounds (NTT_BOUND and INVNTT_BOUND) that the CBMC proofs work against.
The added value of NTT_BOUND_NATIVE and INVNTT_BOUND_NATIVE is questionable. In the end, what we care about is that the native NTT and invNTT adhere to the bounds that CBMC relies on. Any strengthening of the bounds may be good to know, but is otherwise an unnecessary complication of the code.
This commit removes NTT_BOUND_NATIVE and INVNTT_BOUND_NATIVE and uses the contractual bounds NTT_BOUND and INVNT_BOUND in their place.
Also, remove the need for
STATIC_ASSERT
by rewriting its use using a plain#if
.