ECDH: Include Everest Curve25519 in build scripts
diff --git a/3rdparty/everest/.gitignore b/3rdparty/everest/.gitignore
new file mode 100644
index 0000000..5761abc
--- /dev/null
+++ b/3rdparty/everest/.gitignore
@@ -0,0 +1 @@
+*.o
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6115f05..f756d43 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -176,7 +176,7 @@
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 02f924d..727fa21 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -4,8 +4,9 @@
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 b1f1fb3..009fb3e 100644
--- a/library/CMakeLists.txt
+++ b/library/CMakeLists.txt
@@ -94,6 +94,15 @@
)
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 736ce09..58ecb0c 100644
--- a/library/Makefile
+++ b/library/Makefile
@@ -19,6 +19,9 @@
# 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_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 @@
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 1a69b74..871b75b 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -11,6 +11,8 @@
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 6b72523..00a14bc 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -10,6 +10,8 @@
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.