mbed TLS v1.3.21
debug.h
Go to the documentation of this file.
1 
24 #ifndef POLARSSL_DEBUG_H
25 #define POLARSSL_DEBUG_H
26 
27 #if !defined(POLARSSL_CONFIG_FILE)
28 #include "config.h"
29 #else
30 #include POLARSSL_CONFIG_FILE
31 #endif
32 
33 #include "ssl.h"
34 
35 #if defined(POLARSSL_ECP_C)
36 #include "ecp.h"
37 #endif
38 
39 #if defined(POLARSSL_DEBUG_C)
40 
41 #define POLARSSL_DEBUG_LOG_FULL 0
42 #define POLARSSL_DEBUG_LOG_RAW 1
52 #if !defined(POLARSSL_DEBUG_DFL_MODE)
53 #define POLARSSL_DEBUG_DFL_MODE POLARSSL_DEBUG_LOG_FULL
54 #endif
55 
56 /* \} name SECTION: Module settings */
57 
58 
59 #define SSL_DEBUG_MSG( level, args ) \
60  debug_print_msg_free( ssl, level, __FILE__, __LINE__, debug_fmt args );
61 
62 #define SSL_DEBUG_RET( level, text, ret ) \
63  debug_print_ret( ssl, level, __FILE__, __LINE__, text, ret );
64 
65 #define SSL_DEBUG_BUF( level, text, buf, len ) \
66  debug_print_buf( ssl, level, __FILE__, __LINE__, text, buf, len );
67 
68 #if defined(POLARSSL_BIGNUM_C)
69 #define SSL_DEBUG_MPI( level, text, X ) \
70  debug_print_mpi( ssl, level, __FILE__, __LINE__, text, X );
71 #endif
72 
73 #if defined(POLARSSL_ECP_C)
74 #define SSL_DEBUG_ECP( level, text, X ) \
75  debug_print_ecp( ssl, level, __FILE__, __LINE__, text, X );
76 #endif
77 
78 #if defined(POLARSSL_X509_CRT_PARSE_C)
79 #define SSL_DEBUG_CRT( level, text, crt ) \
80  debug_print_crt( ssl, level, __FILE__, __LINE__, text, crt );
81 #endif
82 
83 #else /* POLARSSL_DEBUG_C */
84 
85 #define SSL_DEBUG_MSG( level, args ) do { } while( 0 )
86 #define SSL_DEBUG_RET( level, text, ret ) do { } while( 0 )
87 #define SSL_DEBUG_BUF( level, text, buf, len ) do { } while( 0 )
88 #define SSL_DEBUG_MPI( level, text, X ) do { } while( 0 )
89 #define SSL_DEBUG_ECP( level, text, X ) do { } while( 0 )
90 #define SSL_DEBUG_CRT( level, text, crt ) do { } while( 0 )
91 
92 #endif /* POLARSSL_DEBUG_C */
93 
94 #ifdef __cplusplus
95 extern "C" {
96 #endif
97 
105 void debug_set_log_mode( int log_mode );
106 
114 void debug_set_threshold( int threshold );
115 
116 char *debug_fmt( const char *format, ... );
117 
118 void debug_print_msg_free( const ssl_context *ssl, int level,
119  const char *file, int line, char *text );
120 
121 void debug_print_msg( const ssl_context *ssl, int level,
122  const char *file, int line, const char *text );
123 
124 void debug_print_ret( const ssl_context *ssl, int level,
125  const char *file, int line,
126  const char *text, int ret );
127 
128 void debug_print_buf( const ssl_context *ssl, int level,
129  const char *file, int line, const char *text,
130  unsigned char *buf, size_t len );
131 
132 #if defined(POLARSSL_BIGNUM_C)
133 void debug_print_mpi( const ssl_context *ssl, int level,
134  const char *file, int line,
135  const char *text, const mpi *X );
136 #endif
137 
138 #if defined(POLARSSL_ECP_C)
139 void debug_print_ecp( const ssl_context *ssl, int level,
140  const char *file, int line,
141  const char *text, const ecp_point *X );
142 #endif
143 
144 #if defined(POLARSSL_X509_CRT_PARSE_C)
145 void debug_print_crt( const ssl_context *ssl, int level,
146  const char *file, int line,
147  const char *text, const x509_crt *crt );
148 #endif
149 
150 #ifdef __cplusplus
151 }
152 #endif
153 
154 #endif /* debug.h */
void debug_print_crt(const ssl_context *ssl, int level, const char *file, int line, const char *text, const x509_crt *crt)
Elliptic curves over GF(p)
void debug_print_msg(const ssl_context *ssl, int level, const char *file, int line, const char *text)
Configuration options (set of defines)
MPI structure.
Definition: bignum.h:183
void debug_print_ecp(const ssl_context *ssl, int level, const char *file, int line, const char *text, const ecp_point *X)
Container for an X.509 certificate.
Definition: x509_crt.h:53
ECP point structure (jacobian coordinates)
Definition: ecp.h:101
void debug_print_mpi(const ssl_context *ssl, int level, const char *file, int line, const char *text, const mpi *X)
void debug_print_buf(const ssl_context *ssl, int level, const char *file, int line, const char *text, unsigned char *buf, size_t len)
void debug_print_ret(const ssl_context *ssl, int level, const char *file, int line, const char *text, int ret)
void debug_print_msg_free(const ssl_context *ssl, int level, const char *file, int line, char *text)
void debug_set_threshold(int threshold)
Set the level threshold to handle globally.
SSL/TLS functions.
void debug_set_log_mode(int log_mode)
Set the log mode for the debug functions globally (Default value: POLARSSL_DEBUG_DFL_MODE) ...
char * debug_fmt(const char *format,...)