mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 02:55:41 +01:00
Simplify support for deprecated constants of various types
Generalize MBEDTLS_DEPRECATED_NUMERIC_CONSTANT into macros that can accommodate types other than int.
This commit is contained in:
parent
7a894f2142
commit
7b0ab6d34a
@ -28,27 +28,38 @@
|
||||
#ifndef PSA_CRYPTO_COMPAT_H
|
||||
#define PSA_CRYPTO_COMPAT_H
|
||||
|
||||
#include "mbedtls/platform_util.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING) && !defined(MBEDTLS_PSA_DEPRECATED)
|
||||
#define MBEDTLS_PSA_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_PSA_DEPRECATED
|
||||
#endif
|
||||
|
||||
typedef MBEDTLS_PSA_DEPRECATED psa_status_t mbedtls_deprecated_psa_status_t;
|
||||
|
||||
#define MBEDTLS_DEPRECATED_CONSTANT( type, value ) \
|
||||
( (mbedtls_deprecated_##type) ( value ) )
|
||||
|
||||
/*
|
||||
* Deprecated PSA Crypto error code definitions
|
||||
*/
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#define PSA_ERROR_UNKNOWN_ERROR \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_GENERIC_ERROR )
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_GENERIC_ERROR )
|
||||
#define PSA_ERROR_OCCUPIED_SLOT \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_ALREADY_EXISTS )
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_ALREADY_EXISTS )
|
||||
#define PSA_ERROR_EMPTY_SLOT \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_DOES_NOT_EXIST )
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_DOES_NOT_EXIST )
|
||||
#define PSA_ERROR_INSUFFICIENT_CAPACITY \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_INSUFFICIENT_DATA )
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_INSUFFICIENT_DATA )
|
||||
#define PSA_ERROR_TAMPERING_DETECTED \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_CORRUPTION_DETECTED )
|
||||
#endif
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_CORRUPTION_DETECTED )
|
||||
|
||||
#endif /* MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user