-
Notifications
You must be signed in to change notification settings - Fork 25
Port: Hoist default C backend into separate functions #735
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
aa25aba
Hoist default C backend into separate functions (mld_poly_ntt_c)
willieyz ab8246f
Hoist default C backend into separate functions(mld_poly_caddq_c)
willieyz a21fd43
Hoist default C backend into separate functions(mld_poly_invntt_tomon…
willieyz e4929ec
Hoist default C backend into separate functions(mld_poly_pointwise_mo…
willieyz c2fa513
Hoist default C backend into separate functions(mld_rej_uniform_c)
willieyz f2362e2
Hoist default C backend into separate functions(mld_polyvecl_pointwis…
willieyz bdeeb01
Hoist default C backend into separate functions(mld_poly_decompose_c)
willieyz 0e4dbb1
Hoist default C backend into separate functions(mld_poly_use_hint_c)
willieyz f907f99
Hoist default C backend into separate functions(mld_polyz_unpack_c)
willieyz c262d71
Hoist default C backend into separate functions(mld_rej_eta_c)
willieyz 088d716
Hoist default C backend into separate functions(mld_poly_chknorm_c)
willieyz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # Copyright (c) The mldsa-native project authors | ||
| # SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT | ||
|
|
||
| include ../Makefile_params.common | ||
|
|
||
| HARNESS_ENTRY = harness | ||
| HARNESS_FILE = polyvecl_pointwise_acc_montgomery_c_harness | ||
|
|
||
| # This should be a unique identifier for this proof, and will appear on the | ||
| # Litani dashboard. It can be human-readable and contain spaces if you wish. | ||
| PROOF_UID = polyvecl_pointwise_acc_montgomery_c | ||
|
|
||
| DEFINES += | ||
| INCLUDES += | ||
|
|
||
| REMOVE_FUNCTION_BODY += | ||
| UNWINDSET += | ||
|
|
||
| PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c | ||
| PROJECT_SOURCES += $(SRCDIR)/mldsa/src/polyvec.c | ||
|
|
||
| CHECK_FUNCTION_CONTRACTS=mld_polyvecl_pointwise_acc_montgomery_c | ||
| USE_FUNCTION_CONTRACTS=mld_montgomery_reduce | ||
| APPLY_LOOP_CONTRACTS=on | ||
| USE_DYNAMIC_FRAMES=1 | ||
|
|
||
| # Disable any setting of EXTERNAL_SAT_SOLVER, and choose SMT backend instead | ||
| EXTERNAL_SAT_SOLVER= | ||
| CBMCFLAGS=--external-smt2-solver $(PROOF_ROOT)/lib/z3_no_bv_extract --z3 | ||
| CBMCFLAGS += --slice-formula | ||
| CBMCFLAGS += --no-array-field-sensitivity | ||
|
|
||
| FUNCTION_NAME = mld_polyvecl_pointwise_acc_montgomery_c | ||
|
|
||
| # If this proof is found to consume huge amounts of RAM, you can set the | ||
| # EXPENSIVE variable. With new enough versions of the proof tools, this will | ||
| # restrict the number of EXPENSIVE CBMC jobs running at once. See the | ||
| # documentation in Makefile.common under the "Job Pools" heading for details. | ||
| # EXPENSIVE = true | ||
|
|
||
| # This function is large enough to need... | ||
| CBMC_OBJECT_BITS = 12 | ||
|
|
||
| # If you require access to a file-local ("static") function or object to conduct | ||
| # your proof, set the following (and do not include the original source file | ||
| # ("mldsa/poly.c") in PROJECT_SOURCES). | ||
| # REWRITTEN_SOURCES = $(PROOFDIR)/<__SOURCE_FILE_BASENAME__>.i | ||
| # include ../Makefile.common | ||
| # $(PROOFDIR)/<__SOURCE_FILE_BASENAME__>.i_SOURCE = $(SRCDIR)/mldsa/src/poly.c | ||
| # $(PROOFDIR)/<__SOURCE_FILE_BASENAME__>.i_FUNCTIONS = foo bar | ||
| # $(PROOFDIR)/<__SOURCE_FILE_BASENAME__>.i_OBJECTS = baz | ||
| # Care is required with variables on the left-hand side: REWRITTEN_SOURCES must | ||
| # be set before including Makefile.common, but any use of variables on the | ||
| # left-hand side requires those variables to be defined. Hence, _SOURCE, | ||
| # _FUNCTIONS, _OBJECTS is set after including Makefile.common. | ||
|
|
||
| include ../Makefile.common |
18 changes: 18 additions & 0 deletions
18
...fs/cbmc/polyvecl_pointwise_acc_montgomery_c/polyvecl_pointwise_acc_montgomery_c_harness.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // Copyright (c) The mldsa-native project authors | ||
| // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT | ||
|
|
||
| #include "polyvec.h" | ||
|
|
||
|
|
||
| // Prototype for the function under test | ||
| #define mld_polyvecl_pointwise_acc_montgomery_c \ | ||
| MLD_ADD_PARAM_SET(mld_polyvecl_pointwise_acc_montgomery_c) | ||
| void mld_polyvecl_pointwise_acc_montgomery_c(mld_poly *a, mld_polyvecl *b, | ||
| mld_polyvecl *c); | ||
|
|
||
| void harness(void) | ||
| { | ||
| mld_poly *a; | ||
| mld_polyvecl *b, *c; | ||
| mld_polyvecl_pointwise_acc_montgomery_c(a, b, c); | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This cast business is not very nice. I wonder if we should modify the native API to streamline this. Not an issue for this PR.
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.
mlkem-native has
Is that better?