-
Notifications
You must be signed in to change notification settings - Fork 45
Deduplicate polyw1_pack in multilevel builds #1142
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
Open
mkannwischer
wants to merge
2
commits into
main
Choose a base branch
from
poly-dedup-w1-pack
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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 |
|---|---|---|
|
|
@@ -378,4 +378,49 @@ __contract__( | |
| ensures((return_value == 0) == array_abs_bound(a->coeffs, 0, MLDSA_N, B)) | ||
| ); | ||
|
|
||
| #if !defined(MLD_CONFIG_NO_SIGN_API) || !defined(MLD_CONFIG_NO_VERIFY_API) | ||
| #if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLD_CONFIG_PARAMETER_SET == 44 | ||
| #define mld_polyw1_pack_88 MLD_NAMESPACE(polyw1_pack_88) | ||
| /** | ||
| * Bit-pack polynomial w1 for GAMMA2 = (MLDSA_Q-1)/88 (coefficients in [0, 43]). | ||
| * Input coefficients are assumed to be standard representatives. | ||
| * | ||
| * @param[out] r Pointer to output byte array (MLDSA_POLYW1_PACKEDBYTES_88). | ||
| * @param[in] a Pointer to input polynomial. | ||
| */ | ||
| MLD_INTERNAL_API | ||
| void mld_polyw1_pack_88(uint8_t r[MLDSA_POLYW1_PACKEDBYTES_88], | ||
| const mld_poly *a) | ||
| __contract__( | ||
| requires(memory_no_alias(r, MLDSA_POLYW1_PACKEDBYTES_88)) | ||
| requires(memory_no_alias(a, sizeof(mld_poly))) | ||
| requires(array_bound(a->coeffs, 0, MLDSA_N, 0, (MLDSA_Q-1)/(2*MLDSA_GAMMA2_88))) | ||
| assigns(memory_slice(r, MLDSA_POLYW1_PACKEDBYTES_88)) | ||
| ); | ||
| #endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 44 \ | ||
| */ | ||
|
|
||
| #if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || \ | ||
| (MLD_CONFIG_PARAMETER_SET == 65 || MLD_CONFIG_PARAMETER_SET == 87) | ||
| #define mld_polyw1_pack_32 MLD_NAMESPACE(polyw1_pack_32) | ||
| /** | ||
| * Bit-pack polynomial w1 for GAMMA2 = (MLDSA_Q-1)/32 (coefficients in [0, 15]). | ||
| * Input coefficients are assumed to be standard representatives. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
| * | ||
| * @param[out] r Pointer to output byte array (MLDSA_POLYW1_PACKEDBYTES_32). | ||
| * @param[in] a Pointer to input polynomial. | ||
| */ | ||
| MLD_INTERNAL_API | ||
| void mld_polyw1_pack_32(uint8_t r[MLDSA_POLYW1_PACKEDBYTES_32], | ||
| const mld_poly *a) | ||
| __contract__( | ||
| requires(memory_no_alias(r, MLDSA_POLYW1_PACKEDBYTES_32)) | ||
| requires(memory_no_alias(a, sizeof(mld_poly))) | ||
| requires(array_bound(a->coeffs, 0, MLDSA_N, 0, (MLDSA_Q-1)/(2*MLDSA_GAMMA2_32))) | ||
| assigns(memory_slice(r, MLDSA_POLYW1_PACKEDBYTES_32)) | ||
| ); | ||
| #endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 65 \ | ||
| || MLD_CONFIG_PARAMETER_SET == 87 */ | ||
| #endif /* !MLD_CONFIG_NO_SIGN_API || !MLD_CONFIG_NO_VERIFY_API */ | ||
|
|
||
| #endif /* !MLD_POLY_H */ | ||
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
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,40 @@ | ||
| # 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 = polyw1_pack_32_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 = polyw1_pack_32 | ||
|
|
||
| DEFINES += | ||
| INCLUDES += | ||
|
|
||
| REMOVE_FUNCTION_BODY += | ||
| UNWINDSET += | ||
|
|
||
| PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c | ||
| PROJECT_SOURCES += $(SRCDIR)/mldsa/src/poly.c | ||
|
|
||
| ifeq ($(MLD_CONFIG_PARAMETER_SET),44) | ||
| CHECK_FUNCTION_CONTRACTS= | ||
| else | ||
| CHECK_FUNCTION_CONTRACTS=mld_polyw1_pack_32 | ||
| endif | ||
| USE_FUNCTION_CONTRACTS= | ||
| APPLY_LOOP_CONTRACTS=on | ||
| USE_DYNAMIC_FRAMES=1 | ||
|
|
||
| # Disable any setting of EXTERNAL_SAT_SOLVER, and choose SMT backend instead | ||
| EXTERNAL_SAT_SOLVER= | ||
| CBMCFLAGS=--smt2 | ||
|
|
||
| FUNCTION_NAME = polyw1_pack_32 | ||
|
|
||
| # This function is large enough to need... | ||
| CBMC_OBJECT_BITS = 8 | ||
|
|
||
| include ../Makefile.common |
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,13 @@ | ||
| // Copyright (c) The mldsa-native project authors | ||
| // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT | ||
|
|
||
| #include "poly.h" | ||
|
|
||
| void harness(void) | ||
| { | ||
| #if MLD_CONFIG_PARAMETER_SET != 44 | ||
| mld_poly *a; | ||
| uint8_t *r; | ||
| mld_polyw1_pack_32(r, a); | ||
| #endif | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
It is unclear what this means