22 #ifndef MBEDTLS_DEBUG_H 23 #define MBEDTLS_DEBUG_H 25 #if !defined(MBEDTLS_CONFIG_FILE) 28 #include MBEDTLS_CONFIG_FILE 33 #if defined(MBEDTLS_ECP_C) 37 #if defined(MBEDTLS_DEBUG_C) 39 #define MBEDTLS_DEBUG_STRIP_PARENS( ... ) __VA_ARGS__ 41 #define MBEDTLS_SSL_DEBUG_MSG( level, args ) \ 42 mbedtls_debug_print_msg( ssl, level, __FILE__, __LINE__, \ 43 MBEDTLS_DEBUG_STRIP_PARENS args ) 45 #define MBEDTLS_SSL_DEBUG_RET( level, text, ret ) \ 46 mbedtls_debug_print_ret( ssl, level, __FILE__, __LINE__, text, ret ) 48 #define MBEDTLS_SSL_DEBUG_BUF( level, text, buf, len ) \ 49 mbedtls_debug_print_buf( ssl, level, __FILE__, __LINE__, text, buf, len ) 51 #if defined(MBEDTLS_BIGNUM_C) 52 #define MBEDTLS_SSL_DEBUG_MPI( level, text, X ) \ 53 mbedtls_debug_print_mpi( ssl, level, __FILE__, __LINE__, text, X ) 56 #if defined(MBEDTLS_ECP_C) 57 #define MBEDTLS_SSL_DEBUG_ECP( level, text, X ) \ 58 mbedtls_debug_print_ecp( ssl, level, __FILE__, __LINE__, text, X ) 61 #if defined(MBEDTLS_X509_CRT_PARSE_C) 62 #define MBEDTLS_SSL_DEBUG_CRT( level, text, crt ) \ 63 mbedtls_debug_print_crt( ssl, level, __FILE__, __LINE__, text, crt ) 66 #if defined(MBEDTLS_ECDH_C) 67 #define MBEDTLS_SSL_DEBUG_ECDH( level, ecdh, attr ) \ 68 mbedtls_debug_printf_ecdh( ssl, level, __FILE__, __LINE__, ecdh, attr ) 73 #define MBEDTLS_SSL_DEBUG_MSG( level, args ) do { } while( 0 ) 74 #define MBEDTLS_SSL_DEBUG_RET( level, text, ret ) do { } while( 0 ) 75 #define MBEDTLS_SSL_DEBUG_BUF( level, text, buf, len ) do { } while( 0 ) 76 #define MBEDTLS_SSL_DEBUG_MPI( level, text, X ) do { } while( 0 ) 77 #define MBEDTLS_SSL_DEBUG_ECP( level, text, X ) do { } while( 0 ) 78 #define MBEDTLS_SSL_DEBUG_CRT( level, text, crt ) do { } while( 0 ) 79 #define MBEDTLS_SSL_DEBUG_ECDH( level, ecdh, attr ) do { } while( 0 ) 95 #if defined(__has_attribute) 96 #if __has_attribute(format) 97 #if defined(__MINGW32__) && __USE_MINGW_ANSI_STDIO == 1 98 #define MBEDTLS_PRINTF_ATTRIBUTE(string_index, first_to_check) \ 99 __attribute__((__format__ (gnu_printf, string_index, first_to_check))) 101 #define MBEDTLS_PRINTF_ATTRIBUTE(string_index, first_to_check) \ 102 __attribute__((format(printf, string_index, first_to_check))) 105 #define MBEDTLS_PRINTF_ATTRIBUTE(string_index, first_to_check) 108 #define MBEDTLS_PRINTF_ATTRIBUTE(string_index, first_to_check) 123 #if (defined(__MINGW32__) && __USE_MINGW_ANSI_STDIO == 0) || (defined(_MSC_VER) && _MSC_VER < 1800) 124 #include <inttypes.h> 125 #define MBEDTLS_PRINTF_SIZET PRIuPTR 126 #define MBEDTLS_PRINTF_LONGLONG "I64d" 128 #define MBEDTLS_PRINTF_SIZET "zu" 129 #define MBEDTLS_PRINTF_LONGLONG "lld" 169 const char *file,
int line,
188 const char *file,
int line,
189 const char *text,
int ret );
209 const char *file,
int line,
const char *text,
210 const unsigned char *buf,
size_t len );
212 #if defined(MBEDTLS_BIGNUM_C) 230 const char *file,
int line,
234 #if defined(MBEDTLS_ECP_C) 252 const char *file,
int line,
256 #if defined(MBEDTLS_X509_CRT_PARSE_C) 273 const char *file,
int line,
277 #if defined(MBEDTLS_ECDH_C) 302 const char *file,
int line,
#define MBEDTLS_PRINTF_ATTRIBUTE(string_index, first_to_check)
void mbedtls_debug_print_crt(const mbedtls_ssl_context *ssl, int level, const char *file, int line, const char *text, const mbedtls_x509_crt *crt)
Print a X.509 certificate structure to the debug output. This function is always used through the MBE...
void mbedtls_debug_print_mpi(const mbedtls_ssl_context *ssl, int level, const char *file, int line, const char *text, const mbedtls_mpi *X)
Print a MPI variable to the debug output. This function is always used through the MBEDTLS_SSL_DEBUG_...
This file provides an API for Elliptic Curves over GF(P) (ECP).
Configuration options (set of defines)
void void mbedtls_debug_print_ret(const mbedtls_ssl_context *ssl, int level, const char *file, int line, const char *text, int ret)
Print the return value of a function to the debug output. This function is always used through the MB...
void mbedtls_debug_set_threshold(int threshold)
Set the threshold error level to handle globally all debug output. Debug messages that have a level o...
void mbedtls_debug_print_msg(const mbedtls_ssl_context *ssl, int level, const char *file, int line, const char *format,...) MBEDTLS_PRINTF_ATTRIBUTE(5
Print a message to the debug output. This function is always used through the MBEDTLS_SSL_DEBUG_MSG()...
void mbedtls_debug_printf_ecdh(const mbedtls_ssl_context *ssl, int level, const char *file, int line, const mbedtls_ecdh_context *ecdh, mbedtls_debug_ecdh_attr attr)
Print a field of the ECDH structure in the SSL context to the debug output. This function is always u...
The ECDH context structure.
The ECP point structure, in Jacobian coordinates.
void mbedtls_debug_print_ecp(const mbedtls_ssl_context *ssl, int level, const char *file, int line, const char *text, const mbedtls_ecp_point *X)
Print an ECP point to the debug output. This function is always used through the MBEDTLS_SSL_DEBUG_EC...
void mbedtls_debug_print_buf(const mbedtls_ssl_context *ssl, int level, const char *file, int line, const char *text, const unsigned char *buf, size_t len)
Output a buffer of size len bytes to the debug output. This function is always used through the MBEDT...