Define MBEDTLS_ECDH_LEGACY_CONTEXT in config.h
Define MBEDTLS_ECDH_LEGACY_CONTEXT in config.h instead of hard-coding this in ecdh.h so that its absence can be tested. Document it as experimental so that we reserve the right to change it in the future.
This commit is contained in:
parent
ccf8ba0e6d
commit
43f564f29d
4 changed files with 38 additions and 13 deletions
|
@ -124,6 +124,11 @@
|
||||||
#error "MBEDTLS_ECP_RESTARTABLE defined, but it cannot coexist with an alternative ECP implementation"
|
#error "MBEDTLS_ECP_RESTARTABLE defined, but it cannot coexist with an alternative ECP implementation"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_ECP_RESTARTABLE) && \
|
||||||
|
! defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
|
||||||
|
#error "MBEDTLS_ECP_RESTARTABLE defined, but not MBEDTLS_ECDH_LEGACY_CONTEXT"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECDSA_DETERMINISTIC) && !defined(MBEDTLS_HMAC_DRBG_C)
|
#if defined(MBEDTLS_ECDSA_DETERMINISTIC) && !defined(MBEDTLS_HMAC_DRBG_C)
|
||||||
#error "MBEDTLS_ECDSA_DETERMINISTIC defined, but not all prerequisites"
|
#error "MBEDTLS_ECDSA_DETERMINISTIC defined, but not all prerequisites"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -740,10 +740,39 @@
|
||||||
*
|
*
|
||||||
* \note This option only works with the default software implementation of
|
* \note This option only works with the default software implementation of
|
||||||
* elliptic curve functionality. It is incompatible with
|
* elliptic curve functionality. It is incompatible with
|
||||||
* MBEDTLS_ECP_ALT, MBEDTLS_ECDH_XXX_ALT and MBEDTLS_ECDSA_XXX_ALT.
|
* MBEDTLS_ECP_ALT, MBEDTLS_ECDH_XXX_ALT, MBEDTLS_ECDSA_XXX_ALT
|
||||||
|
* and MBEDTLS_ECDH_LEGACY_CONTEXT.
|
||||||
*/
|
*/
|
||||||
//#define MBEDTLS_ECP_RESTARTABLE
|
//#define MBEDTLS_ECP_RESTARTABLE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \def MBEDTLS_ECDH_LEGACY_CONTEXT
|
||||||
|
*
|
||||||
|
* Use a backward compatible ECDH context.
|
||||||
|
*
|
||||||
|
* Mbed TLS supports two formats for ECDH contexts (#mbedtls_ecdh_context
|
||||||
|
* defined in `ecdh.h`). For most applications, the choice of format makes
|
||||||
|
* no difference, since all library functions can work with either format,
|
||||||
|
* except that the new format is incompatible with MBEDTLS_ECP_RESTARTABLE.
|
||||||
|
|
||||||
|
* The new format used when this option is disabled is smaller
|
||||||
|
* (56 bytes on a 32-bit platform). In future versions of the library, it
|
||||||
|
* will support alternative implementations of ECDH operations.
|
||||||
|
* The new format is incompatible with applications that access
|
||||||
|
* context fields directly and with restartable ECP operations.
|
||||||
|
*
|
||||||
|
* Define this macro if you enable MBEDTLS_ECP_RESTARTABLE or if you
|
||||||
|
* want to access ECDH context fields directly. Otherwise you should
|
||||||
|
* comment out this macro definition.
|
||||||
|
*
|
||||||
|
* This option has no effect if #MBEDTLS_ECDH_C is not enabled.
|
||||||
|
*
|
||||||
|
* \note This configuration option is experimental. Future versions of the
|
||||||
|
* library may modify the way the ECDH context layout is configured
|
||||||
|
* and may modify the layout of the new context type.
|
||||||
|
*/
|
||||||
|
#define MBEDTLS_ECDH_LEGACY_CONTEXT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \def MBEDTLS_ECDSA_DETERMINISTIC
|
* \def MBEDTLS_ECDSA_DETERMINISTIC
|
||||||
*
|
*
|
||||||
|
|
|
@ -42,18 +42,6 @@
|
||||||
|
|
||||||
#include "ecp.h"
|
#include "ecp.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* Use a backward compatible ECDH context.
|
|
||||||
*
|
|
||||||
* This flag is always enabled for now and future versions might add a
|
|
||||||
* configuration option that conditionally undefines this flag.
|
|
||||||
* The configuration option in question may have a different name.
|
|
||||||
*
|
|
||||||
* Features undefining this flag, must have a warning in their description in
|
|
||||||
* config.h stating that the feature breaks backward compatibility.
|
|
||||||
*/
|
|
||||||
#define MBEDTLS_ECDH_LEGACY_CONTEXT
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -348,6 +348,9 @@ static const char *features[] = {
|
||||||
#if defined(MBEDTLS_ECP_RESTARTABLE)
|
#if defined(MBEDTLS_ECP_RESTARTABLE)
|
||||||
"MBEDTLS_ECP_RESTARTABLE",
|
"MBEDTLS_ECP_RESTARTABLE",
|
||||||
#endif /* MBEDTLS_ECP_RESTARTABLE */
|
#endif /* MBEDTLS_ECP_RESTARTABLE */
|
||||||
|
#if defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
|
||||||
|
"MBEDTLS_ECDH_LEGACY_CONTEXT",
|
||||||
|
#endif /* MBEDTLS_ECDH_LEGACY_CONTEXT */
|
||||||
#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
|
#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
|
||||||
"MBEDTLS_ECDSA_DETERMINISTIC",
|
"MBEDTLS_ECDSA_DETERMINISTIC",
|
||||||
#endif /* MBEDTLS_ECDSA_DETERMINISTIC */
|
#endif /* MBEDTLS_ECDSA_DETERMINISTIC */
|
||||||
|
|
Loading…
Reference in a new issue