Adjust more modules to new design

Add `ecp.h` anf `timing.h` to new XXX_alt design
This commit is contained in:
Ron Eldor 2018-04-01 15:59:58 +03:00
parent 1c9f9be9a2
commit 810e650c70
3 changed files with 17 additions and 25 deletions

View File

@ -39,6 +39,10 @@
#define MBEDTLS_ERR_ECP_SIG_LEN_MISMATCH -0x4C00 /**< Signature is valid but shorter than the user-supplied length. */ #define MBEDTLS_ERR_ECP_SIG_LEN_MISMATCH -0x4C00 /**< Signature is valid but shorter than the user-supplied length. */
#define MBEDTLS_ERR_ECP_HW_ACCEL_FAILED -0x4B80 /**< ECP hardware accelerator failed. */ #define MBEDTLS_ERR_ECP_HW_ACCEL_FAILED -0x4B80 /**< ECP hardware accelerator failed. */
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(MBEDTLS_ECP_ALT) #if !defined(MBEDTLS_ECP_ALT)
/* /*
* default mbed TLS elliptic curve arithmetic implementation * default mbed TLS elliptic curve arithmetic implementation
@ -48,10 +52,6 @@
* one.) * one.)
*/ */
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* Domain parameters (curve, subgroup and generator) identifiers. * Domain parameters (curve, subgroup and generator) identifiers.
* *
@ -237,6 +237,10 @@ mbedtls_ecp_keypair;
#define MBEDTLS_ECP_PF_UNCOMPRESSED 0 /**< Uncompressed point format */ #define MBEDTLS_ECP_PF_UNCOMPRESSED 0 /**< Uncompressed point format */
#define MBEDTLS_ECP_PF_COMPRESSED 1 /**< Compressed point format */ #define MBEDTLS_ECP_PF_COMPRESSED 1 /**< Compressed point format */
#else /* MBEDTLS_ECP_ALT */
#include "ecp_alt.h"
#endif /* MBEDTLS_ECP_ALT */
/* /*
* Some other constants from RFC 4492 * Some other constants from RFC 4492
*/ */
@ -679,8 +683,4 @@ int mbedtls_ecp_self_test( int verbose );
} }
#endif #endif
#else /* MBEDTLS_ECP_ALT */
#include "ecp_alt.h"
#endif /* MBEDTLS_ECP_ALT */
#endif /* ecp.h */ #endif /* ecp.h */

View File

@ -30,16 +30,16 @@
#include MBEDTLS_CONFIG_FILE #include MBEDTLS_CONFIG_FILE
#endif #endif
#if !defined(MBEDTLS_TIMING_ALT)
// Regular implementation
//
#include <stdint.h> #include <stdint.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#if !defined(MBEDTLS_TIMING_ALT)
// Regular implementation
//
/** /**
* \brief timer structure * \brief timer structure
*/ */
@ -58,6 +58,10 @@ typedef struct
uint32_t fin_ms; uint32_t fin_ms;
} mbedtls_timing_delay_context; } mbedtls_timing_delay_context;
#else /* MBEDTLS_TIMING_ALT */
#include "timing_alt.h"
#endif /* MBEDTLS_TIMING_ALT */
extern volatile int mbedtls_timing_alarmed; extern volatile int mbedtls_timing_alarmed;
/** /**
@ -133,18 +137,6 @@ void mbedtls_timing_set_delay( void *data, uint32_t int_ms, uint32_t fin_ms );
*/ */
int mbedtls_timing_get_delay( void *data ); int mbedtls_timing_get_delay( void *data );
#ifdef __cplusplus
}
#endif
#else /* MBEDTLS_TIMING_ALT */
#include "timing_alt.h"
#endif /* MBEDTLS_TIMING_ALT */
#ifdef __cplusplus
extern "C" {
#endif
#if defined(MBEDTLS_SELF_TEST) #if defined(MBEDTLS_SELF_TEST)
/** /**
* \brief Checkup routine * \brief Checkup routine