mbed TLS v2.6.0
debug.h
Go to the documentation of this file.
1 
25 #ifndef MBEDTLS_DEBUG_H
26 #define MBEDTLS_DEBUG_H
27 
28 #if !defined(MBEDTLS_CONFIG_FILE)
29 #include "config.h"
30 #else
31 #include MBEDTLS_CONFIG_FILE
32 #endif
33 
34 #include "ssl.h"
35 
36 #if defined(MBEDTLS_ECP_C)
37 #include "ecp.h"
38 #endif
39 
40 #if defined(MBEDTLS_DEBUG_C)
41 
42 #define MBEDTLS_DEBUG_STRIP_PARENS( ... ) __VA_ARGS__
43 
44 #define MBEDTLS_SSL_DEBUG_MSG( level, args ) \
45  mbedtls_debug_print_msg( ssl, level, __FILE__, __LINE__, \
46  MBEDTLS_DEBUG_STRIP_PARENS args )
47 
48 #define MBEDTLS_SSL_DEBUG_RET( level, text, ret ) \
49  mbedtls_debug_print_ret( ssl, level, __FILE__, __LINE__, text, ret )
50 
51 #define MBEDTLS_SSL_DEBUG_BUF( level, text, buf, len ) \
52  mbedtls_debug_print_buf( ssl, level, __FILE__, __LINE__, text, buf, len )
53 
54 #if defined(MBEDTLS_BIGNUM_C)
55 #define MBEDTLS_SSL_DEBUG_MPI( level, text, X ) \
56  mbedtls_debug_print_mpi( ssl, level, __FILE__, __LINE__, text, X )
57 #endif
58 
59 #if defined(MBEDTLS_ECP_C)
60 #define MBEDTLS_SSL_DEBUG_ECP( level, text, X ) \
61  mbedtls_debug_print_ecp( ssl, level, __FILE__, __LINE__, text, X )
62 #endif
63 
64 #if defined(MBEDTLS_X509_CRT_PARSE_C)
65 #define MBEDTLS_SSL_DEBUG_CRT( level, text, crt ) \
66  mbedtls_debug_print_crt( ssl, level, __FILE__, __LINE__, text, crt )
67 #endif
68 
69 #else /* MBEDTLS_DEBUG_C */
70 
71 #define MBEDTLS_SSL_DEBUG_MSG( level, args ) do { } while( 0 )
72 #define MBEDTLS_SSL_DEBUG_RET( level, text, ret ) do { } while( 0 )
73 #define MBEDTLS_SSL_DEBUG_BUF( level, text, buf, len ) do { } while( 0 )
74 #define MBEDTLS_SSL_DEBUG_MPI( level, text, X ) do { } while( 0 )
75 #define MBEDTLS_SSL_DEBUG_ECP( level, text, X ) do { } while( 0 )
76 #define MBEDTLS_SSL_DEBUG_CRT( level, text, crt ) do { } while( 0 )
77 
78 #endif /* MBEDTLS_DEBUG_C */
79 
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
83 
99 void mbedtls_debug_set_threshold( int threshold );
100 
116 void mbedtls_debug_print_msg( const mbedtls_ssl_context *ssl, int level,
117  const char *file, int line,
118  const char *format, ... );
119 
135 void mbedtls_debug_print_ret( const mbedtls_ssl_context *ssl, int level,
136  const char *file, int line,
137  const char *text, int ret );
138 
156 void mbedtls_debug_print_buf( const mbedtls_ssl_context *ssl, int level,
157  const char *file, int line, const char *text,
158  const unsigned char *buf, size_t len );
159 
160 #if defined(MBEDTLS_BIGNUM_C)
161 
177 void mbedtls_debug_print_mpi( const mbedtls_ssl_context *ssl, int level,
178  const char *file, int line,
179  const char *text, const mbedtls_mpi *X );
180 #endif
181 
182 #if defined(MBEDTLS_ECP_C)
183 
199 void mbedtls_debug_print_ecp( const mbedtls_ssl_context *ssl, int level,
200  const char *file, int line,
201  const char *text, const mbedtls_ecp_point *X );
202 #endif
203 
204 #if defined(MBEDTLS_X509_CRT_PARSE_C)
205 
220 void mbedtls_debug_print_crt( const mbedtls_ssl_context *ssl, int level,
221  const char *file, int line,
222  const char *text, const mbedtls_x509_crt *crt );
223 #endif
224 
225 #ifdef __cplusplus
226 }
227 #endif
228 
229 #endif /* debug.h */
230 
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.
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.
Elliptic curves over GF(p)
Configuration options (set of defines)
void mbedtls_debug_set_threshold(int threshold)
Set the threshold error level to handle globally all debug output.
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.
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.
MPI structure.
Definition: bignum.h:181
Container for an X.509 certificate.
Definition: x509_crt.h:54
SSL/TLS functions.
ECP point structure (jacobian coordinates)
Definition: ecp.h:108
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.
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.