ECDH: Add new ECDH context for Everest Curve25519
diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h
index e202cb4..155a085 100644
--- a/include/mbedtls/config.h
+++ b/include/mbedtls/config.h
@@ -2078,6 +2078,22 @@
*/
//#define MBEDTLS_PLATFORM_GMTIME_R_ALT
+/*
+ * \def MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED
+ *
+ * Enable the verified implementations of crypto primitives
+ * from Project Everest (currently only Curve25519).
+ * This feature breaks ECDH backward compatibility (see also
+ * MBEDTLS_ECDH_LEGACY_CONTEXT).
+ *
+ */
+#define MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED
+
+/* \} name SECTION: Customisation configuration options */
+
+/* Target and application specific configurations */
+//#define YOTTA_CFG_MBEDTLS_TARGET_CONFIG_FILE "target_config.h"
+
/* \} name SECTION: Customisation configuration options */
/* Target and application specific configurations
diff --git a/include/mbedtls/ecdh.h b/include/mbedtls/ecdh.h
index d870a5b..4bb704b 100644
--- a/include/mbedtls/ecdh.h
+++ b/include/mbedtls/ecdh.h
@@ -42,6 +42,11 @@
#include "mbedtls/ecp.h"
+#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)
+#undef MBEDTLS_ECDH_LEGACY_CONTEXT
+#include "everest/everest.h"
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -66,6 +71,9 @@
{
MBEDTLS_ECDH_VARIANT_NONE = 0, /*!< Implementation not defined. */
MBEDTLS_ECDH_VARIANT_MBEDTLS_2_0,/*!< The default Mbed TLS implementation */
+#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)
+ MBEDTLS_ECDH_VARIANT_EVEREST /*!< Everest implementation */
+#endif
} mbedtls_ecdh_variant;
/**
@@ -119,6 +127,9 @@
union
{
mbedtls_ecdh_context_mbed mbed_ecdh;
+#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)
+ mbedtls_ecdh_context_everest everest_ecdh;
+#endif
} ctx; /*!< Implementation-specific context. The
context in use is specified by the \c var
field. */