47#if !defined(MBEDTLS_CONFIG_FILE)
50#include MBEDTLS_CONFIG_FILE
53#if defined(MBEDTLS_DEBUG_C)
55#if defined(MBEDTLS_PLATFORM_C)
59#define mbedtls_calloc calloc
60#define mbedtls_free free
61#define mbedtls_time_t time_t
62#define mbedtls_snprintf snprintf
71#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
72 !defined(inline) && !defined(__cplusplus)
73#define inline __inline
76#define DEBUG_BUF_SIZE 512
78static int debug_threshold = 0;
82 debug_threshold = threshold;
97#if defined(MBEDTLS_THREADING_C)
98 char idstr[20 + DEBUG_BUF_SIZE];
111 char str[DEBUG_BUF_SIZE];
117 level > debug_threshold )
124#if defined(_TRUNCATE) && !defined(__MINGW32__)
128 if(
ret < 0 || (
size_t)
ret == DEBUG_BUF_SIZE )
130 str[DEBUG_BUF_SIZE-1] =
'\0';
139 if(
ret >= 0 &&
ret < DEBUG_BUF_SIZE - 1 )
152 char str[DEBUG_BUF_SIZE];
157 level > debug_threshold )
178 const unsigned char *
buf,
size_t len )
180 char str[DEBUG_BUF_SIZE];
187 level > debug_threshold )
198 memset( txt, 0,
sizeof( txt ) );
199 for(
i = 0;
i <
len;
i++ )
212 memset( txt, 0,
sizeof( txt ) );
221 (
unsigned int)
buf[
i] );
222 txt[
i % 16] = (
buf[
i] > 31 &&
buf[
i] < 127 ) ?
buf[
i] :
'.' ;
227 for( ;
i % 16 != 0;
i++ )
235#if defined(MBEDTLS_ECP_C)
240 char str[DEBUG_BUF_SIZE];
245 level > debug_threshold )
258#if defined(MBEDTLS_BIGNUM_C)
263 char str[DEBUG_BUF_SIZE];
271 level > debug_threshold )
279 text, (
unsigned) bitlen );
284 str[0] =
' ';
str[1] =
'0';
str[2] =
'0';
290 for(
n = (
int) ( ( bitlen - 1 ) / 8 );
n >= 0;
n-- )
294 unsigned char octet =
295 (
X->p[limb_offset] >> ( offset_in_limb * 8 ) ) & 0xff;
316#if defined(MBEDTLS_X509_CRT_PARSE_C)
330 "invalid PK context\n" );
345#if defined(MBEDTLS_ECP_C)
351 "should not happen\n" );
358 char str[DEBUG_BUF_SIZE];
367 if(
len > DEBUG_BUF_SIZE - 1 )
368 len = DEBUG_BUF_SIZE - 1;
384 char str[DEBUG_BUF_SIZE];
391 level > debug_threshold )
413#if defined(MBEDTLS_ECDH_C)
420#if defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
423 const mbedtls_ecdh_context_mbed*
ctx = &ecdh->ctx.mbed_ecdh;
450#if defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
456 mbedtls_debug_printf_ecdh_internal( ssl,
level,
file,
line, ecdh,
int _vsnprintf_s(char *buffer, size_t sizeOfBuffer, size_t count, const char *format, va_list argptr)
size_t mbedtls_mpi_bitlen(const mbedtls_mpi *X)
Return the number of bits up to and including the most significant bit of value 1.
uint32_t mbedtls_mpi_uint
GLuint GLuint GLsizei GLenum type
GLenum GLuint GLenum GLsizei const GLchar * buf
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
int mbedtls_x509_crt_info(char *buf, size_t size, const char *prefix, const mbedtls_x509_crt *crt)
Returns an informational string about the certificate.
struct mbedtls_x509_crt * next
#define memcpy(s1, s2, n)
int mbedtls_pk_debug(const mbedtls_pk_context *ctx, mbedtls_pk_debug_item *items)
Export debug information.
#define MBEDTLS_PK_DEBUG_MAX_ITEMS
Configuration options (set of defines)
Functions for controlling and providing debug output from the library.
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...
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()...
#define MBEDTLS_ERR_SSL_WANT_READ
The ECDH context structure.
The ECP point structure, in Jacobian coordinates.
Item to send to the debug module.
void(* f_dbg)(void *, int, const char *, int, const char *)
const mbedtls_ssl_config * conf