Add reference implementation verification scripts

This commit is contained in:
2025-09-19 21:11:41 -07:00
parent 6287904204
commit 618c1331ce
4 changed files with 138 additions and 0 deletions

24
ref-verification/hash.saw Normal file
View File

@@ -0,0 +1,24 @@
m <- llvm_load_module "hash.bc";
include "common.saw";
thm_P12 <- mk_P12;
thm_hash <- llvm_verify
m "crypto_hash"
[thm_P12]
true
do {
let IN_len = 17;
let IN_type = llvm_array IN_len (llvm_int 8);
(IN, IN_ptr) <- fresh_alloc_readonly "IN" IN_type;
let OUT_type = llvm_array 32 (llvm_int 8);
OUT_ptr <- llvm_alloc OUT_type;
llvm_execute_func [OUT_ptr, IN_ptr, llvm_term {{ `IN_len:[64] }}];
llvm_points_to OUT_ptr (llvm_term {{ Hash256_bytes IN }});
llvm_return (llvm_term {{ 0 : [32] }});
}
abc;