diff --git a/3rdparty/everest/.gitignore b/3rdparty/everest/.gitignore new file mode 100644 index 0000000000..5761abcfdf --- /dev/null +++ b/3rdparty/everest/.gitignore @@ -0,0 +1 @@ +*.o diff --git a/CMakeLists.txt b/CMakeLists.txt index 6115f0588c..f756d43312 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,7 +176,7 @@ else() set(LIB_INSTALL_DIR lib) endif() -include_directories(include/) +include_directories(include/ 3rdparty/everest/include/ 3rdparty/everest/include/everest/ 3rdparty/everest/include/everest/kremlin/ 3rdparty/everest/include/everest/kremlib/) include_directories(library/) add_subdirectory(library) diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 02f924df45..727fa210c5 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -4,8 +4,9 @@ if(INSTALL_MBEDTLS_HEADERS) file(GLOB headers "mbedtls/*.h") file(GLOB psa_headers "psa/*.h") + file(GLOB everest_headers "../3rdparty/everest/include/*.h") - install(FILES ${headers} + install(FILES ${headers} ${everest_headers} DESTINATION include/mbedtls PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index b1f1fb34c8..009fb3e749 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -94,6 +94,15 @@ set(src_crypto ) endif() +set(src_everest + ../3rdparty/everest/library/everest.c + ../3rdparty/everest/library/Hacl_Curve25519.c + ../3rdparty/everest/library/x25519.c + ../3rdparty/everest/library/kremlib/fstar_uint128.c + ../3rdparty/everest/library/kremlib/FStar_UInt64_FStar_UInt32_FStar_UInt16_FStar_UInt8.c +) + +set(src_crypto ${src_crypto} ${src_everest}) if(CMAKE_COMPILER_IS_GNUCC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-declarations -Wmissing-prototypes") endif(CMAKE_COMPILER_IS_GNUCC) diff --git a/library/Makefile b/library/Makefile index 736ce09b22..58ecb0c27a 100644 --- a/library/Makefile +++ b/library/Makefile @@ -19,6 +19,9 @@ endif # To compile on Plan9: # CFLAGS += -D_BSD_EXTENSION +# Include directories for Everest code +CFLAGS+=-I../3rdparty/everest/include -I../3rdparty/everest/include/everest -I../3rdparty/everest/include/everest/kremlib + # if were running on Windows build for Windows ifdef WINDOWS WINDOWS_BUILD=1 @@ -101,6 +104,13 @@ OBJS_CRYPTO += version.o OBJS_CRYPTO += version_features.o endif +OBJS_CRYPTO+= \ + ../3rdparty/everest/library/everest.o \ + ../3rdparty/everest/library/Hacl_Curve25519.o \ + ../3rdparty/everest/library/x25519.o \ + ../3rdparty/everest/library/kremlib/fstar_uint128.o \ + ../3rdparty/everest/library/kremlib/FStar_UInt64_FStar_UInt32_FStar_UInt16_FStar_UInt8.o + .SILENT: .PHONY: all static shared clean @@ -148,8 +158,10 @@ libmbedcrypto.dll: $(OBJS_CRYPTO) clean: ifndef WINDOWS - rm -f *.o libmbed* + rm -f *.o libmbed* $(OBJS_CRYPTO) else if exist *.o del /Q /F *.o if exist libmbed* del /Q /F libmbed* + if exist $(OBJS_CRYPTO) del /Q /F $(OBJS_CRYPTO) endif + diff --git a/programs/Makefile b/programs/Makefile index 1a69b7469f..871b75b77d 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -11,6 +11,8 @@ LOCAL_CXXFLAGS = $(WARNING_CXXFLAGS) -I../include -D_FILE_OFFSET_BITS=64 LOCAL_LDFLAGS = -L../library \ -lmbedcrypto$(SHARED_SUFFIX) +LOCAL_CFLAGS+=-I../3rdparty/everest/include + ifndef SHARED DEP=../library/libmbedcrypto.a else diff --git a/tests/Makefile b/tests/Makefile index 6b72523eb9..00a14bc211 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -10,6 +10,8 @@ LOCAL_CFLAGS = $(WARNING_CFLAGS) $(CRYPTO_INCLUDES) -I../library -D_FILE_OFFSET_ LOCAL_LDFLAGS = -L../library \ -lmbedcrypto$(SHARED_SUFFIX) +LOCAL_CFLAGS+=-I../3rdparty/everest/include + # Enable definition of various functions used throughout the testsuite # (gethostname, strdup, fileno...) even when compiling with -std=c99. Harmless # on non-POSIX platforms.