-
Notifications
You must be signed in to change notification settings - Fork 45
HOL-Light: Add HOL Light poly_use_hint proofs for AArch64 #1037
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 all commits
Commits
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 |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # 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 = poly_use_hint_native_aarch64_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 = poly_use_hint_native_aarch64 | ||
|
|
||
| # We need to set MLD_CHECK_APIS as otherwise mldsa/src/native/api.h won't be | ||
| # included, which contains the CBMC specifications. | ||
| DEFINES += -DMLD_CONFIG_USE_NATIVE_BACKEND_ARITH -DMLD_CONFIG_ARITH_BACKEND_FILE="\"$(SRCDIR)/mldsa/src/native/aarch64/meta.h\"" -DMLD_CHECK_APIS | ||
| INCLUDES += | ||
|
|
||
| REMOVE_FUNCTION_BODY += | ||
| UNWINDSET += | ||
|
|
||
| PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c | ||
| PROJECT_SOURCES += $(SRCDIR)/mldsa/src/poly_kl.c | ||
|
|
||
| ifeq ($(MLD_CONFIG_PARAMETER_SET),44) | ||
| CHECK_FUNCTION_CONTRACTS=mld_poly_use_hint_88_native | ||
| USE_FUNCTION_CONTRACTS=mld_poly_use_hint_88_asm | ||
| else ifeq ($(MLD_CONFIG_PARAMETER_SET),65) | ||
| CHECK_FUNCTION_CONTRACTS=mld_poly_use_hint_32_native | ||
| USE_FUNCTION_CONTRACTS=mld_poly_use_hint_32_asm | ||
| else ifeq ($(MLD_CONFIG_PARAMETER_SET),87) | ||
| CHECK_FUNCTION_CONTRACTS=mld_poly_use_hint_32_native | ||
| USE_FUNCTION_CONTRACTS=mld_poly_use_hint_32_asm | ||
| endif | ||
| USE_FUNCTION_CONTRACTS+=mld_sys_check_capability | ||
| 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 = poly_use_hint_native_aarch64 | ||
|
|
||
| # 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 = 8 | ||
|
|
||
| include ../Makefile.common |
24 changes: 24 additions & 0 deletions
24
proofs/cbmc/poly_use_hint_native_aarch64/poly_use_hint_native_aarch64_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,24 @@ | ||
| // Copyright (c) The mldsa-native project authors | ||
| // SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT | ||
|
|
||
| #include <stdint.h> | ||
| #include "cbmc.h" | ||
| #include "params.h" | ||
|
|
||
| #if MLDSA_GAMMA2 == ((MLDSA_Q - 1) / 88) | ||
| int mld_poly_use_hint_88_native(int32_t *b, const int32_t *a, const int32_t *h); | ||
| #else | ||
| int mld_poly_use_hint_32_native(int32_t *b, const int32_t *a, const int32_t *h); | ||
| #endif | ||
|
|
||
| void harness(void) | ||
| { | ||
| int32_t *b, *a, *h; | ||
| int t; | ||
|
|
||
| #if MLDSA_GAMMA2 == ((MLDSA_Q - 1) / 88) | ||
| t = mld_poly_use_hint_88_native(b, a, h); | ||
| #else | ||
| t = mld_poly_use_hint_32_native(b, a, h); | ||
| #endif | ||
| } |
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
98 changes: 98 additions & 0 deletions
98
proofs/hol_light/aarch64/mldsa/poly_use_hint_32_aarch64_asm.S
|
hanno-becker marked this conversation as resolved.
|
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,98 @@ | ||
| /* | ||
| * Copyright (c) The mldsa-native project authors | ||
| * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT | ||
| */ | ||
|
|
||
|
|
||
| /* | ||
| * WARNING: This file is auto-derived from the mldsa-native source file | ||
| * dev/aarch64_opt/src/poly_use_hint_32_asm.S using scripts/simpasm. Do not modify it directly. | ||
| */ | ||
|
|
||
| .text | ||
| .balign 4 | ||
| #ifdef __APPLE__ | ||
| .global _PQCP_MLDSA_NATIVE_MLDSA44_poly_use_hint_32_asm | ||
| _PQCP_MLDSA_NATIVE_MLDSA44_poly_use_hint_32_asm: | ||
| #else | ||
| .global PQCP_MLDSA_NATIVE_MLDSA44_poly_use_hint_32_asm | ||
| PQCP_MLDSA_NATIVE_MLDSA44_poly_use_hint_32_asm: | ||
| #endif | ||
|
|
||
| .cfi_startproc | ||
| mov w4, #0xe001 // =57345 | ||
| movk w4, #0x7f, lsl #16 | ||
| dup v20.4s, w4 | ||
| mov w5, #0xe100 // =57600 | ||
| movk w5, #0x7b, lsl #16 | ||
| dup v21.4s, w5 | ||
| mov w7, #0xfe00 // =65024 | ||
| movk w7, #0x7, lsl #16 | ||
| dup v22.4s, w7 | ||
| mov w11, #0x401 // =1025 | ||
| movk w11, #0x4010, lsl #16 | ||
| dup v23.4s, w11 | ||
| movi v24.4s, #0xf | ||
| mov x3, #0x10 // =16 | ||
|
|
||
| Lpoly_use_hint_32_loop: | ||
| ldr q1, [x1, #0x10] | ||
| ldr q2, [x1, #0x20] | ||
| ldr q3, [x1, #0x30] | ||
| ldr q0, [x1], #0x40 | ||
| ldr q5, [x2, #0x10] | ||
| ldr q6, [x2, #0x20] | ||
| ldr q7, [x2, #0x30] | ||
| ldr q4, [x2], #0x40 | ||
| sqdmulh v17.4s, v1.4s, v23.4s | ||
| srshr v17.4s, v17.4s, #0x12 | ||
| cmgt v25.4s, v1.4s, v21.4s | ||
| mls v1.4s, v17.4s, v22.4s | ||
| bic v17.16b, v17.16b, v25.16b | ||
| add v1.4s, v1.4s, v25.4s | ||
| cmle v1.4s, v1.4s, #0 | ||
| orr v1.4s, #0x1 | ||
| mla v17.4s, v1.4s, v5.4s | ||
| and v17.16b, v17.16b, v24.16b | ||
| sqdmulh v18.4s, v2.4s, v23.4s | ||
| srshr v18.4s, v18.4s, #0x12 | ||
| cmgt v25.4s, v2.4s, v21.4s | ||
| mls v2.4s, v18.4s, v22.4s | ||
| bic v18.16b, v18.16b, v25.16b | ||
| add v2.4s, v2.4s, v25.4s | ||
| cmle v2.4s, v2.4s, #0 | ||
| orr v2.4s, #0x1 | ||
| mla v18.4s, v2.4s, v6.4s | ||
| and v18.16b, v18.16b, v24.16b | ||
| sqdmulh v19.4s, v3.4s, v23.4s | ||
| srshr v19.4s, v19.4s, #0x12 | ||
| cmgt v25.4s, v3.4s, v21.4s | ||
| mls v3.4s, v19.4s, v22.4s | ||
| bic v19.16b, v19.16b, v25.16b | ||
| add v3.4s, v3.4s, v25.4s | ||
| cmle v3.4s, v3.4s, #0 | ||
| orr v3.4s, #0x1 | ||
| mla v19.4s, v3.4s, v7.4s | ||
| and v19.16b, v19.16b, v24.16b | ||
| sqdmulh v16.4s, v0.4s, v23.4s | ||
| srshr v16.4s, v16.4s, #0x12 | ||
| cmgt v25.4s, v0.4s, v21.4s | ||
| mls v0.4s, v16.4s, v22.4s | ||
| bic v16.16b, v16.16b, v25.16b | ||
| add v0.4s, v0.4s, v25.4s | ||
| cmle v0.4s, v0.4s, #0 | ||
| orr v0.4s, #0x1 | ||
| mla v16.4s, v0.4s, v4.4s | ||
| and v16.16b, v16.16b, v24.16b | ||
| str q17, [x0, #0x10] | ||
| str q18, [x0, #0x20] | ||
| str q19, [x0, #0x30] | ||
| str q16, [x0], #0x40 | ||
| subs x3, x3, #0x1 | ||
| b.ne Lpoly_use_hint_32_loop | ||
| ret | ||
| .cfi_endproc | ||
|
|
||
| #if defined(__ELF__) | ||
| .section .note.GNU-stack,"",%progbits | ||
| #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.
Uh oh!
There was an error while loading. Please reload this page.