1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-28 00:21:48 +03:00

modify proc_chk macros

- change the parameter
- remove debug output
- remove return value modify

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
Jerry Yu
2021-09-02 13:53:46 +08:00
parent 0c63af6ed6
commit 2c0fbf3405
3 changed files with 18 additions and 24 deletions

View File

@ -26,7 +26,6 @@
#include "mbedtls/ssl.h"
#include "mbedtls/cipher.h"
#include "mbedtls/debug.h"
#if defined(MBEDTLS_USE_PSA_CRYPTO)
#include "psa/crypto.h"
@ -135,33 +134,25 @@
/*
* Helper macros for function call with returen check.
*/
/* utils for strip parens in marcro */
#define MBEDTLS_SSL_PROC_STRIP_PARENS( ... ) __VA_ARGS__
/*
* Exit and print debug message when return none zero value
*/
#define MBEDTLS_SSL_PROC_CHK( fn, args ) \
#define MBEDTLS_SSL_PROC_CHK( f ) \
do { \
ret = fn(MBEDTLS_SSL_PROC_STRIP_PARENS args); \
ret = ( f ); \
if( ret != 0 ) \
{ \
if( ret > 0 ) \
ret = MBEDTLS_ERR_SSL_INTERNAL_ERROR; \
MBEDTLS_SSL_DEBUG_RET( 1, #fn, ret ); \
goto cleanup; \
} \
} while( 0 )
/*
* Exit and print debug message when return negative value
*/
#define MBEDTLS_SSL_PROC_CHK_NEG( fn, args ) \
#define MBEDTLS_SSL_PROC_CHK_NEG( f ) \
do { \
ret = fn(MBEDTLS_SSL_PROC_STRIP_PARENS args); \
ret = ( f ); \
if( ret < 0 ) \
{ \
MBEDTLS_SSL_DEBUG_RET( 1, #fn, ret ); \
goto cleanup; \
} \
} while( 0 )