mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-22 17:42:27 +00:00
Introduce macros to deprecate constants in the API
This commit introduces macros * MBEDTLS_DEPRECATED_STRING_CONSTANT * MBEDTLS_DEPRECATED_NUMERIC_CONSTANT to platform_util.h which can be used to deprecate public macro constants. Their definition is essentially taken from dhm.h where the MBEDTLS_DEPRECATED_STRING_CONSTANT was used to deprecate insecure hardcoded DHM primes.
This commit is contained in:
parent
8ef1f48a52
commit
6d0816a8ae
@ -353,15 +353,6 @@ int mbedtls_dhm_self_test( int verbose );
|
|||||||
|
|
||||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||||
|
|
||||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
|
||||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
|
||||||
MBEDTLS_DEPRECATED typedef char const * mbedtls_deprecated_constant_t;
|
|
||||||
#define MBEDTLS_DEPRECATED_STRING_CONSTANT( VAL ) \
|
|
||||||
( (mbedtls_deprecated_constant_t) ( VAL ) )
|
|
||||||
#else
|
|
||||||
#define MBEDTLS_DEPRECATED_STRING_CONSTANT( VAL ) VAL
|
|
||||||
#endif /* ! MBEDTLS_DEPRECATED_WARNING */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \warning The origin of the primes in RFC 5114 is not documented and
|
* \warning The origin of the primes in RFC 5114 is not documented and
|
||||||
* their use therefore constitutes a security risk!
|
* their use therefore constitutes a security risk!
|
||||||
|
@ -41,6 +41,27 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Internal helper macros for deprecating API constants. */
|
||||||
|
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||||
|
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||||
|
/* Deliberately don't (yet) define MBEDTLS_DEPRECATED here to avoid
|
||||||
|
* conflict with other headers which define and use it, too.
|
||||||
|
* We might want to move all these definitions here at some point
|
||||||
|
* for uniformity. */
|
||||||
|
__attribute__((deprecated))
|
||||||
|
typedef char const * mbedtls_deprecated_string_constant_t;
|
||||||
|
#define MBEDTLS_DEPRECATED_STRING_CONSTANT( VAL ) \
|
||||||
|
( (mbedtls_deprecated_string_constant_t) ( VAL ) )
|
||||||
|
__attribute__((deprecated))
|
||||||
|
typedef int mbedtls_deprecated_numeric_constant_t;
|
||||||
|
#define MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( VAL ) \
|
||||||
|
( (mbedtls_deprecated_numeric_constant_t) ( VAL ) )
|
||||||
|
#else /* MBEDTLS_DEPRECATED_WARNING */
|
||||||
|
#define MBEDTLS_DEPRECATED_STRING_CONSTANT( VAL ) VAL
|
||||||
|
#define MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( VAL ) VAL
|
||||||
|
#endif /* MBEDTLS_DEPRECATED_WARNING */
|
||||||
|
#endif /* MBEDTLS_DEPRECATED_REMOVED */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Securely zeroize a buffer
|
* \brief Securely zeroize a buffer
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user