forked from formosa-crypto/libjade
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request formosa-crypto#68 from formosa-crypto/sliced_safety
sliced_safety: safety checking with slices and safety params
- Loading branch information
Showing
23 changed files
with
683 additions
and
373 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
*.s | ||
*.safety | ||
*.safety_* | ||
*.o | ||
*.a | ||
_build/ | ||
|
This file contains 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,34 @@ | ||
# Notes: | ||
# - this file defines fine-grained targets that allow checking the safety of individual exported | ||
# functions | ||
# - it is meant to be included by Makefile.common, right before the 'generic' safety targets | ||
|
||
SAFETY_FLAGS ?= | ||
SAFETY_TIMEOUT ?= 4320m | ||
SAFETY_DIR := .safety | ||
CHECK_SAFETY_S = (time timeout -v $(SAFETY_TIMEOUT) $(JASMINC) -slice $* -checksafety $(SAFETY_FLAGS) $(shell cat $(SAFETY_DIR)/$*.safetyparam) $< 2> $@) $(CIT) | ||
CHECK_SAFETY = (time timeout -v $(SAFETY_TIMEOUT) $(JASMINC) -checksafety $(SAFETY_FLAGS) $(shell cat $(SAFETY_DIR)/$(OP).safetyparam) $< 2> $@) $(CIT) | ||
|
||
SAFETY_TARGETS = $(addsuffix .safety, $(FUNCTIONS)) | ||
|
||
checksafety-all: $(SAFETY_TARGETS) | ||
|
||
$(OP).safety : $(OP).jazz $(SAFETY_DIR)/$(OP).safetyparam $(DEPS_DIR)/$(OP).safety.d | $(SAFETY_DIR) $(DEPS_DIR) $(CI_DIR) | ||
$(DEPS) | ||
$(CHECK_SAFETY) | ||
|
||
$(SAFETY_TARGETS): | ||
%.safety : $(OP).jazz $(SAFETY_DIR)/$(OP).safetyparam $(DEPS_DIR)/%.safety.d | $(SAFETY_DIR) $(DEPS_DIR) $(CI_DIR) | ||
$(DEPS) | ||
$(CHECK_SAFETY_S) | ||
|
||
DEPFILES := \ | ||
$(DEPFILES) \ | ||
$(addprefix $(DEPS_DIR)/, $(addsuffix .safety.d, $(FUNCTIONS) $(OP))) | ||
|
||
$(SAFETY_DIR)/$(OP).safetyparam: $(SAFETY_DIR) | ||
$(MAKE) -C $(TEST) bin/$(RDIR)/safetyparams | ||
(cd $(SAFETY_DIR) && $(TDIR)/safetyparams) | ||
|
||
$(SAFETY_DIR): ; @mkdir -p $@ | ||
|
This file contains 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 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,41 @@ | ||
ifeq ($(OP),kem) | ||
ifeq ($(SRCS),kem.jazz) | ||
FUNCTIONS = $(addprefix $(NAMESPACE)_, keypair_derand keypair enc_derand enc dec) | ||
endif | ||
endif | ||
|
||
ifeq ($(OP),hash) | ||
ifeq ($(SRCS),hash.jazz) | ||
FUNCTIONS = $(NAMESPACE) | ||
endif | ||
endif | ||
|
||
ifeq ($(OP),onetimeauth) | ||
ifeq ($(SRCS),onetimeauth.jazz) | ||
FUNCTIONS = $(NAMESPACE) $(NAMESPACE)_verify | ||
endif | ||
endif | ||
|
||
ifeq ($(OP),scalarmult) | ||
ifeq ($(SRCS),scalarmult.jazz) | ||
FUNCTIONS = $(NAMESPACE) $(NAMESPACE)_base | ||
endif | ||
endif | ||
|
||
ifeq ($(OP),secretbox) | ||
ifeq ($(SRCS),secretbox.jazz) | ||
FUNCTIONS = $(NAMESPACE) $(NAMESPACE)_open | ||
endif | ||
endif | ||
|
||
ifeq ($(OP),sign) | ||
ifeq ($(SRCS),sign.jazz) | ||
FUNCTIONS = $(NAMESPACE)_keypair $(NAMESPACE) $(NAMESPACE)_open | ||
endif | ||
endif | ||
|
||
ifeq ($(OP),xof) | ||
ifeq ($(SRCS),xof.jazz) | ||
FUNCTIONS = $(NAMESPACE) | ||
endif | ||
endif |
This file contains 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 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 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,46 @@ | ||
#ifndef TEST_COMMON_FILES_C | ||
#define TEST_COMMON_FILES_C | ||
|
||
#include <stdio.h> | ||
#include <stdint.h> | ||
#include <assert.h> | ||
#include <stdarg.h> | ||
|
||
static void f_map_fopen(FILE **files, char **filenames, size_t length, char *mode) | ||
{ | ||
size_t i; | ||
for(i=0; i<length; i++) | ||
{ files[i] = fopen(filenames[i], mode); | ||
assert(files[i] != NULL); | ||
} | ||
} | ||
|
||
static void f_map_fclose(FILE **files, size_t length) | ||
{ | ||
int r; | ||
size_t i; | ||
for(i=0; i<length; i++) | ||
{ r = fclose(files[i]); | ||
assert(r == 0); | ||
} | ||
} | ||
|
||
static void f_map_fopen_write(FILE **files, char **filenames, size_t length) | ||
{ | ||
f_map_fopen(files, filenames, length, "w"); | ||
} | ||
|
||
static void f_fprintf2(FILE *stream1, FILE *stream2, const char *format, ...) | ||
{ | ||
va_list arguments; | ||
|
||
va_start(arguments, format); | ||
vfprintf(stream1, format, arguments); | ||
va_end(arguments); | ||
|
||
va_start(arguments, format); | ||
vfprintf(stream2, format, arguments); | ||
va_end(arguments); | ||
} | ||
|
||
#endif |
Oops, something went wrong.