Skip to content

Commit

Permalink
cbmc: add fd_keyguard_ambiguity_proof
Browse files Browse the repository at this point in the history
  • Loading branch information
riptl authored and ripatel-fd committed Nov 7, 2023
1 parent cfda905 commit 6a5ba81
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
16 changes: 16 additions & 0 deletions verification/proofs/keyguard/ambiguity/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
HARNESS_ENTRY = harness
HARNESS_FILE = fd_keyguard_ambiguity_proof

PROOF_UID = fd_keyguard_ambiguity

DEFINES +=
INCLUDES += -I$(SRCDIR)

REMOVE_FUNCTION_BODY +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES = $(SRCDIR)/disco/keyguard/fd_keyguard_match.c

UNWINDSET += memcmp.0:1024

include ../../Makefile.common
7 changes: 7 additions & 0 deletions verification/proofs/keyguard/ambiguity/cbmc-viewer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[

],
"proof-name": "fd_keyguard_ambiguity",
"proof-root": "verification/proofs"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <disco/keyguard/fd_keyguard.h>
#include <stdlib.h>
#include <assert.h>

/* fd_keyguard_ambiguity_proof proves that no message up to 2048 bytes
has an ambiguous type detection result. */

void
harness( void ) {
ulong size;
__CPROVER_assume( size<=FD_KEYGUARD_SIGN_REQ_MTU );

uchar * buf = malloc( size );
if( !buf ) return;

assert( fd_keyguard_payload_check_ambiguous( buf, size )==0 );
}

0 comments on commit 6a5ba81

Please sign in to comment.