10#ifndef MBEDTLS_DEBUG_H
11#define MBEDTLS_DEBUG_H
17#if defined(MBEDTLS_ECP_C)
21#if defined(MBEDTLS_DEBUG_C)
23#define MBEDTLS_DEBUG_STRIP_PARENS(...) __VA_ARGS__
25#define MBEDTLS_SSL_DEBUG_MSG(level, args) \
26 mbedtls_debug_print_msg(ssl, level, __FILE__, __LINE__, \
27 MBEDTLS_DEBUG_STRIP_PARENS args)
29#define MBEDTLS_SSL_DEBUG_RET(level, text, ret) \
30 mbedtls_debug_print_ret(ssl, level, __FILE__, __LINE__, text, ret)
32#define MBEDTLS_SSL_DEBUG_BUF(level, text, buf, len) \
33 mbedtls_debug_print_buf(ssl, level, __FILE__, __LINE__, text, buf, len)
35#if defined(MBEDTLS_BIGNUM_C)
36#define MBEDTLS_SSL_DEBUG_MPI(level, text, X) \
37 mbedtls_debug_print_mpi(ssl, level, __FILE__, __LINE__, text, X)
40#if defined(MBEDTLS_ECP_C)
41#define MBEDTLS_SSL_DEBUG_ECP(level, text, X) \
42 mbedtls_debug_print_ecp(ssl, level, __FILE__, __LINE__, text, X)
45#if defined(MBEDTLS_X509_CRT_PARSE_C)
46#if !defined(MBEDTLS_X509_REMOVE_INFO)
47#define MBEDTLS_SSL_DEBUG_CRT(level, text, crt) \
48 mbedtls_debug_print_crt(ssl, level, __FILE__, __LINE__, text, crt)
50#define MBEDTLS_SSL_DEBUG_CRT(level, text, crt) do { } while (0)
54#if defined(MBEDTLS_ECDH_C)
55#define MBEDTLS_SSL_DEBUG_ECDH(level, ecdh, attr) \
56 mbedtls_debug_printf_ecdh(ssl, level, __FILE__, __LINE__, ecdh, attr)
61#define MBEDTLS_SSL_DEBUG_MSG(level, args) do { } while (0)
62#define MBEDTLS_SSL_DEBUG_RET(level, text, ret) do { } while (0)
63#define MBEDTLS_SSL_DEBUG_BUF(level, text, buf, len) do { } while (0)
64#define MBEDTLS_SSL_DEBUG_MPI(level, text, X) do { } while (0)
65#define MBEDTLS_SSL_DEBUG_ECP(level, text, X) do { } while (0)
66#define MBEDTLS_SSL_DEBUG_CRT(level, text, crt) do { } while (0)
67#define MBEDTLS_SSL_DEBUG_ECDH(level, ecdh, attr) do { } while (0)
83#if defined(__has_attribute)
84#if __has_attribute(format)
85#if defined(__MINGW32__) && __USE_MINGW_ANSI_STDIO == 1
86#define MBEDTLS_PRINTF_ATTRIBUTE(string_index, first_to_check) \
87 __attribute__((__format__(gnu_printf, string_index, first_to_check)))
89#define MBEDTLS_PRINTF_ATTRIBUTE(string_index, first_to_check) \
90 __attribute__((format(printf, string_index, first_to_check)))
93#define MBEDTLS_PRINTF_ATTRIBUTE(string_index, first_to_check)
96#define MBEDTLS_PRINTF_ATTRIBUTE(string_index, first_to_check)
111#if (defined(__MINGW32__) && __USE_MINGW_ANSI_STDIO == 0) || (defined(_MSC_VER) && _MSC_VER < 1800)
112 #include <inttypes.h>
113 #define MBEDTLS_PRINTF_SIZET PRIuPTR
114 #define MBEDTLS_PRINTF_LONGLONG "I64d"
117 #define MBEDTLS_PRINTF_SIZET "zu"
118 #define MBEDTLS_PRINTF_LONGLONG "lld"
122#if !defined(MBEDTLS_PRINTF_MS_TIME)
123#define MBEDTLS_PRINTF_MS_TIME PRId64
163 const char *file,
int line,
182 const
char *file,
int line,
183 const
char *text,
int ret);
203 const
char *file,
int line, const
char *text,
204 const
unsigned char *buf,
size_t len);
206#if defined(MBEDTLS_BIGNUM_C)
224 const char *file,
int line,
228#if defined(MBEDTLS_ECP_C)
246 const char *file,
int line,
250#if defined(MBEDTLS_X509_CRT_PARSE_C) && !defined(MBEDTLS_X509_REMOVE_INFO)
267 const char *file,
int line,
273#if defined(MBEDTLS_KEY_EXCHANGE_SOME_ECDH_OR_ECDHE_ANY_ENABLED) && \
274 defined(MBEDTLS_ECDH_C)
298 const char *file,
int line,
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...
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_...
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_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...
#define MBEDTLS_PRINTF_ATTRIBUTE(string_index, first_to_check)
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...
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_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_msg(const mbedtls_ssl_context *ssl, int level, const char *file, int line, const char *format,...)
Print a message to the debug output. This function is always used through the MBEDTLS_SSL_DEBUG_MSG()...
This file provides an API for Elliptic Curves over GF(P) (ECP).
Build-time configuration info.
The ECDH context structure.
The ECP point structure, in Jacobian coordinates.