Add support for alternative ECJPAKE implementation
This commit allows users to provide alternative implementations of the
ECJPAKE interface through the configuration option MBEDTLS_ECJPAKE_ALT.
When set, the user must add `ecjpake_alt.h` declaring the same
interface as `ecjpake.h`, as well as add some compilation unit which
implements the functionality. This is in line with the preexisting
support for alternative implementations of other modules.
diff --git a/include/mbedtls/ecjpake.h b/include/mbedtls/ecjpake.h
index 6fcffc7..d86e820 100644
--- a/include/mbedtls/ecjpake.h
+++ b/include/mbedtls/ecjpake.h
@@ -44,6 +44,8 @@
#include "ecp.h"
#include "md.h"
+#if !defined(MBEDTLS_ECJPAKE_ALT)
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -223,17 +225,31 @@
*/
void mbedtls_ecjpake_free( mbedtls_ecjpake_context *ctx );
+#ifdef __cplusplus
+}
+#endif
+
+#else /* MBEDTLS_ECJPAKE_ALT */
+#include "ecjpake_alt.h"
+#endif /* MBEDTLS_ECJPAKE_ALT */
+
#if defined(MBEDTLS_SELF_TEST)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief Checkup routine
*
* \return 0 if successful, or 1 if a test failed
*/
int mbedtls_ecjpake_self_test( int verbose );
-#endif
#ifdef __cplusplus
}
#endif
+#endif /* MBEDTLS_SELF_TEST */
+
#endif /* ecjpake.h */