Skip to content

Commit

Permalink
Merge branch 'cwinter_debug'
Browse files Browse the repository at this point in the history
  • Loading branch information
wintersteiger committed Jul 15, 2017
2 parents 8ca629c + b64cfd6 commit a684c03
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion code/Makefile.include
Expand Up @@ -16,7 +16,7 @@ endif
ifndef KREMLIN_HOME
KREMLIN_HOME:=$(abspath $(HACL_HOME)/dependencies/kremlin)
else
KREMLIN_HOME:=$(abspath KREMLIN_HOME)
KREMLIN_HOME:=$(abspath $(KREMLIN_HOME))
endif

export HACL_HOME
Expand Down
3 changes: 3 additions & 0 deletions code/curve25519/Hacl.Spec.EC.Format.Lemmas.fst
Expand Up @@ -102,6 +102,7 @@ let lemma_fexpand k =

let u51 = x:nat{x < pow2 51}

#reset-options "--initial_fuel 0 --max_fuel 0 --z3rlimit 160"

val lemma_fcontract_base_i: s:nat -> s':nat -> a:nat{a >= 64} -> b:nat{b <= 39} -> c:nat{c <= 38} -> Lemma
(pow2 a * ((s / pow2 b) + ((s' * pow2 c) % pow2 64)) =
Expand All @@ -121,6 +122,8 @@ let lemma_fcontract_base_i s s' a b c =
(* c = a + c *)
(* b = 64 + a *)

#reset-options "--initial_fuel 0 --max_fuel 0 --z3rlimit 20"

val lemma_fcontract_base_j: x:nat -> a:nat -> b:nat -> Lemma
(pow2 a * (x % pow2 b) + (pow2 (a+b) * (x / pow2 b)) = pow2 a * x)
let lemma_fcontract_base_j x a b =
Expand Down
2 changes: 1 addition & 1 deletion code/salsa-family/Makefile
Expand Up @@ -74,7 +74,7 @@ salsa20.exe: salsa-c/out.krml
./$@


chacha-vec128-c/out.krml: Hacl.Impl.Chacha20.Vec128.State.fst Hacl.Impl.Chacha20.Vec128.fst Chacha20.Vec128.fst Hacl.Test.Chacha20.Vec128.fst
chacha-vec128-c/out.krml: Hacl.Impl.Chacha20.Vec128.State.fst Hacl.Impl.Chacha20.Vec128.fst Chacha20.Vec128.fst # Hacl.Test.Chacha20.Vec128.fst
$(KREMLIN) $(KREMLIN_ARGS) -tmpdir chacha-vec128-c \
-bundle "Chacha20.Vec128=Chacha20.Vec128,Hacl.Impl.*,Hacl.Lib.*" \
-add-include '"vec128.h"' \
Expand Down
4 changes: 2 additions & 2 deletions secure_api/Makefile
Expand Up @@ -57,15 +57,15 @@ krml-test-vale.exe: vale/asm/vale.a

krml-test-%.exe: tmp-%/out.krml
$(KRML) $< -tmpdir tmp-$* -o $@ -bundle "Crypto.AEAD=Crypto.AEAD.*" -no-prefix Crypto.KrmlTest
./$@
#./$@

test-perf-hacl.exe: krml-test-hacl.exe test/test_perf.c
$(CC) -Ofast -m64 -march=native -mtune=native -funroll-loops -fomit-frame-pointer \
-o test-perf-hacl.exe tmp-hacl/Crypto_AEAD*.c tmp-hacl/Crypto_Indexing*.c tmp-hacl/Buffer_Utils*.c $(KREMLIN_HOME)/kremlib/kremlib.c \
$(KREMLIN_HOME)/kremlib/testlib.c test/test_perf.c test/test_hacks.c -I tmp-hacl \
-I $(KREMLIN_HOME)/kremlib -I $(KREMLIN_HOME)/test \
-I $(OPENSSL_HOME)/include -L $(OPENSSL_HOME) -lcrypto $(CFLAGS)
PATH="$(OPENSSL_HOME):$(PATH)" LD_LIBRARY_PATH="$(OPENSSL_HOME):$(LD_LIBRARY_PATH)" DYLD_LIBRARY_PATH="$(OPENSSL_HOME):$(DYLD_LIBRARY_PATH)" ./test-perf-hacl.exe
# PATH="$(OPENSSL_HOME):$(PATH)" LD_LIBRARY_PATH="$(OPENSSL_HOME):$(LD_LIBRARY_PATH)" DYLD_LIBRARY_PATH="$(OPENSSL_HOME):$(DYLD_LIBRARY_PATH)" ./test-perf-hacl.exe

# Cleaning
clean:
Expand Down
31 changes: 16 additions & 15 deletions test/Makefile
Expand Up @@ -69,22 +69,23 @@ hints:
verify:
$(info The 'test' directory does not contain .fst files, so no verification to run.)

build-snapshot:
SNAPSHOT_FILES= ./c/* \
$(addprefix ../code/poly1305/poly-c/, Poly1305_64.* AEAD_Poly1305_64.*) \
../code/curve25519/x25519-c/Curve25519.* \
../code/salsa-family/chacha-c/Chacha20.* \
../code/salsa-family/salsa-c/Salsa20.* \
$(addprefix ../code/api/aead-c/, Chacha20Poly1305.*) \
$(addprefix ../code/api/box-c/, Hacl_Policies.* NaCl.*) \
$(addprefix ../code/ed25519/ed25519-c/, Ed25519.*) \
$(addprefix ../code/hash/sha2-c/, SHA2_256.*) \
$(addprefix ../code/hash/sha2-c/, SHA2_384.*) \
$(addprefix ../code/hash/sha2-c/, SHA2_512.*) \
$(addprefix ../code/hmac/hmac-c/, HMAC_SHA2_256.*) \
$(addprefix ../code/salsa-family/chacha-vec128-c/, Chacha20_Vec128.* ../vec128.h)

build-snapshot:
mkdir -p $(SNAPSHOT_DIR)
cp $(addprefix ../code/poly1305/poly-c/, Poly1305_64.* AEAD_Poly1305_64.*) \
../code/curve25519/x25519-c/Curve25519.* \
../code/salsa-family/chacha-c/Chacha20.* \
../code/salsa-family/salsa-c/Salsa20.* \
$(addprefix ../code/api/aead-c/, Chacha20Poly1305.*) \
$(addprefix ../code/api/box-c/, Hacl_Policies.* NaCl.*) \
$(addprefix ../code/ed25519/ed25519-c/, Ed25519.*) \
$(addprefix ../code/hash/sha2-c/, SHA2_256.*) \
$(addprefix ../code/hash/sha2-c/, SHA2_384.*) \
$(addprefix ../code/hash/sha2-c/, SHA2_512.*) \
$(addprefix ../code/hmac/hmac-c/, HMAC_SHA2_256.*) \
$(addprefix ../code/salsa-family/chacha20-vec128/, Chacha20_Vec128.* ../vec128.h) \
$(SNAPSHOT_DIR)
cp ./c/* $(SNAPSHOT_DIR)/
cp $(SNAPSHOT_FILES) $(SNAPSHOT_DIR)/
$(MAKE) -C $(SNAPSHOT_DIR) clean

GCC=$(shell which gcc-7 >/dev/null 2>&1 && echo gcc-7 || (which gcc-6 >/dev/null 2>&1 && echo gcc-6 || echo gcc))
Expand Down

0 comments on commit a684c03

Please sign in to comment.