Move MBEDTLS_CHECK_RETURN to platform_util.

Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
This commit is contained in:
Mateusz Starzyk 2021-08-04 15:38:09 +02:00 committed by Gilles Peskine
parent 7820a574f1
commit e35f8f6a77
4 changed files with 22 additions and 18 deletions

View File

@ -42,6 +42,7 @@
#include "mbedtls/private_access.h"
#include "mbedtls/build_info.h"
#include "mbedtls/platform_util.h"
#include <stddef.h>
#include <stdint.h>

View File

@ -53,24 +53,6 @@
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
/** \def MBEDTLS_CHECK_RETURN
*
* This macro appearing at the beginning of the declaration of a function
* indicates that its return value should be checked.
*
* This should appear before most functions returning an error code
* (as \c int in the \c mbedtls_xxx API or
* as ::psa_status_t in the \c psa_xxx API).
*/
#if defined(__GNUC__)
#define MBEDTLS_CHECK_RETURN __attribute__((warn_unused_result))
#elif defined(_MSC_VER) && _MSC_VER >= 1700
#include <sal.h>
#define MBEDTLS_CHECK_RETURN _Check_return_
#else
#define MBEDTLS_CHECK_RETURN
#endif
#if !defined(MBEDTLS_CONFIG_FILE)
#include "mbedtls/mbedtls_config.h"
#else

View File

@ -29,6 +29,7 @@
#include "mbedtls/private_access.h"
#include "mbedtls/build_info.h"
#include "mbedtls/platform_util.h"
#include <stddef.h>
#include <stdint.h>

View File

@ -60,6 +60,26 @@ MBEDTLS_DEPRECATED typedef int mbedtls_deprecated_numeric_constant_t;
#endif /* MBEDTLS_DEPRECATED_WARNING */
#endif /* MBEDTLS_DEPRECATED_REMOVED */
/** \def MBEDTLS_CHECK_RETURN
*
* This macro appearing at the beginning of the declaration of a function
* indicates that its return value should be checked.
*
* This should appear before most functions returning an error code
* (as \c int in the \c mbedtls_xxx API or
* as ::psa_status_t in the \c psa_xxx API).
*/
#if !defined(MBEDTLS_CHECK_RETURN)
#if defined(__GNUC__)
#define MBEDTLS_CHECK_RETURN __attribute__((warn_unused_result))
#elif defined(_MSC_VER) && _MSC_VER >= 1700
#include <sal.h>
#define MBEDTLS_CHECK_RETURN _Check_return_
#else
#define MBEDTLS_CHECK_RETURN
#endif
#endif
/**
* \brief Securely zeroize a buffer
*