-
Notifications
You must be signed in to change notification settings - Fork 4
CBMC: Add proof and contract for crypto_sign_keypair_internal #269
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
Draft
jakemas
wants to merge
1
commit into
main
Choose a base branch
from
crypto_sign_keypair_internal
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.
+94
−9
Draft
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,67 @@ | ||
# 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 = crypto_sign_keypair_internal_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 = crypto_sign_keypair_internal | ||
|
||
DEFINES += | ||
INCLUDES += | ||
|
||
REMOVE_FUNCTION_BODY += | ||
UNWINDSET += | ||
|
||
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c | ||
PROJECT_SOURCES += $(SRCDIR)/mldsa/sign.c | ||
|
||
CHECK_FUNCTION_CONTRACTS=$(MLD_NAMESPACE)crypto_sign_keypair_internal | ||
USE_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)shake256 | ||
USE_FUNCTION_CONTRACTS+=$(MLD_NAMESPACE)polyvec_matrix_expand | ||
USE_FUNCTION_CONTRACTS+=$(MLD_NAMESPACE)poly_uniform_eta_4x | ||
USE_FUNCTION_CONTRACTS+=$(MLD_NAMESPACE)polyvecl_ntt | ||
USE_FUNCTION_CONTRACTS+=$(MLD_NAMESPACE)polyvec_matrix_pointwise_montgomery | ||
USE_FUNCTION_CONTRACTS+=$(MLD_NAMESPACE)polyveck_reduce | ||
USE_FUNCTION_CONTRACTS+=$(MLD_NAMESPACE)polyveck_invntt_tomont | ||
USE_FUNCTION_CONTRACTS+=$(MLD_NAMESPACE)polyveck_add | ||
USE_FUNCTION_CONTRACTS+=$(MLD_NAMESPACE)polyveck_caddq | ||
USE_FUNCTION_CONTRACTS+=$(MLD_NAMESPACE)polyveck_power2round | ||
USE_FUNCTION_CONTRACTS+=$(MLD_NAMESPACE)pack_pk | ||
USE_FUNCTION_CONTRACTS+=$(MLD_NAMESPACE)pack_sk | ||
|
||
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 = crypto_sign_keypair_internal | ||
|
||
# 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 = 9 | ||
|
||
# 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/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 |
10 changes: 10 additions & 0 deletions
10
proofs/cbmc/crypto_sign_keypair_internal/crypto_sign_keypair_internal_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,10 @@ | ||
// Copyright (c) The mldsa-native project authors | ||
// SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT | ||
|
||
#include "sign.h" | ||
|
||
void harness(void) | ||
{ | ||
uint8_t *a, *b, *c; | ||
crypto_sign_keypair_internal(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.
CBMC disliked the shared use of
seedbuf
as bothin
andout
here.