Merge remote-tracking branch 'upstream-public/pr/1304' into development

This commit is contained in:
Jaeden Amero 2018-01-25 10:07:39 +00:00
commit cef0c5a2c8
5 changed files with 28 additions and 3 deletions

View file

@ -28,12 +28,14 @@ Features
The following functions from the ECDSA module can be replaced The following functions from the ECDSA module can be replaced
with alternative implementation: with alternative implementation:
mbedtls_ecdsa_sign(), mbedtls_ecdsa_verify() and mbedtls_ecdsa_genkey(). mbedtls_ecdsa_sign(), mbedtls_ecdsa_verify() and mbedtls_ecdsa_genkey().
* Add support for alternative implementation for ECDH, controlled by new * Add support for alternative implementation of ECDH, controlled by the
configuration flags MBEDTLS_ECDH_COMPUTE_SHARED_ALT and new configuration flags MBEDTLS_ECDH_COMPUTE_SHARED_ALT and
MBEDTLS_ECDH_GEN_PUBLIC_ALT in config.h. MBEDTLS_ECDH_GEN_PUBLIC_ALT in config.h.
The following functions from the ECDH module can be replaced The following functions from the ECDH module can be replaced
with an alternative implementation: with an alternative implementation:
mbedtls_ecdh_gen_public() and mbedtls_ecdh_compute_shared(). mbedtls_ecdh_gen_public() and mbedtls_ecdh_compute_shared().
* Add support for alternative implementation of ECJPAKE, controlled by
the new configuration flag MBEDTLS_ECJPAKE_ALT.
API Changes API Changes
* Extend RSA interface by multiple functions allowing structure- * Extend RSA interface by multiple functions allowing structure-

View file

@ -271,6 +271,7 @@
//#define MBEDTLS_CMAC_ALT //#define MBEDTLS_CMAC_ALT
//#define MBEDTLS_DES_ALT //#define MBEDTLS_DES_ALT
//#define MBEDTLS_DHM_ALT //#define MBEDTLS_DHM_ALT
//#define MBEDTLS_ECJPAKE_ALT
//#define MBEDTLS_GCM_ALT //#define MBEDTLS_GCM_ALT
//#define MBEDTLS_MD2_ALT //#define MBEDTLS_MD2_ALT
//#define MBEDTLS_MD4_ALT //#define MBEDTLS_MD4_ALT

View file

@ -44,6 +44,8 @@
#include "ecp.h" #include "ecp.h"
#include "md.h" #include "md.h"
#if !defined(MBEDTLS_ECJPAKE_ALT)
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -223,17 +225,31 @@ int mbedtls_ecjpake_derive_secret( mbedtls_ecjpake_context *ctx,
*/ */
void mbedtls_ecjpake_free( mbedtls_ecjpake_context *ctx ); 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) #if defined(MBEDTLS_SELF_TEST)
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* \brief Checkup routine * \brief Checkup routine
* *
* \return 0 if successful, or 1 if a test failed * \return 0 if successful, or 1 if a test failed
*/ */
int mbedtls_ecjpake_self_test( int verbose ); int mbedtls_ecjpake_self_test( int verbose );
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* MBEDTLS_SELF_TEST */
#endif /* ecjpake.h */ #endif /* ecjpake.h */

View file

@ -36,6 +36,8 @@
#include <string.h> #include <string.h>
#if !defined(MBEDTLS_ECJPAKE_ALT)
/* /*
* Convert a mbedtls_ecjpake_role to identifier string * Convert a mbedtls_ecjpake_role to identifier string
*/ */
@ -764,6 +766,7 @@ cleanup:
#undef ID_MINE #undef ID_MINE
#undef ID_PEER #undef ID_PEER
#endif /* ! MBEDTLS_ECJPAKE_ALT */
#if defined(MBEDTLS_SELF_TEST) #if defined(MBEDTLS_SELF_TEST)

View file

@ -108,6 +108,9 @@ static const char *features[] = {
#if defined(MBEDTLS_DHM_ALT) #if defined(MBEDTLS_DHM_ALT)
"MBEDTLS_DHM_ALT", "MBEDTLS_DHM_ALT",
#endif /* MBEDTLS_DHM_ALT */ #endif /* MBEDTLS_DHM_ALT */
#if defined(MBEDTLS_ECJPAKE_ALT)
"MBEDTLS_ECJPAKE_ALT",
#endif /* MBEDTLS_ECJPAKE_ALT */
#if defined(MBEDTLS_GCM_ALT) #if defined(MBEDTLS_GCM_ALT)
"MBEDTLS_GCM_ALT", "MBEDTLS_GCM_ALT",
#endif /* MBEDTLS_GCM_ALT */ #endif /* MBEDTLS_GCM_ALT */