Path: blob/master/thirdparty/mbedtls/library/debug_internal.h
9903 views
/**1* \file debug_internal.h2*3* \brief Internal part of the public "debug.h".4*/5/*6* Copyright The Mbed TLS Contributors7* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later8*/9#ifndef MBEDTLS_DEBUG_INTERNAL_H10#define MBEDTLS_DEBUG_INTERNAL_H1112#include "mbedtls/debug.h"1314/**15* \brief Print a message to the debug output. This function is always used16* through the MBEDTLS_SSL_DEBUG_MSG() macro, which supplies the ssl17* context, file and line number parameters.18*19* \param ssl SSL context20* \param level error level of the debug message21* \param file file the message has occurred in22* \param line line number the message has occurred at23* \param format format specifier, in printf format24* \param ... variables used by the format specifier25*26* \attention This function is intended for INTERNAL usage within the27* library only.28*/29void mbedtls_debug_print_msg(const mbedtls_ssl_context *ssl, int level,30const char *file, int line,31const char *format, ...) MBEDTLS_PRINTF_ATTRIBUTE(5, 6);3233/**34* \brief Print the return value of a function to the debug output. This35* function is always used through the MBEDTLS_SSL_DEBUG_RET() macro,36* which supplies the ssl context, file and line number parameters.37*38* \param ssl SSL context39* \param level error level of the debug message40* \param file file the error has occurred in41* \param line line number the error has occurred in42* \param text the name of the function that returned the error43* \param ret the return code value44*45* \attention This function is intended for INTERNAL usage within the46* library only.47*/48void mbedtls_debug_print_ret(const mbedtls_ssl_context *ssl, int level,49const char *file, int line,50const char *text, int ret);5152/**53* \brief Output a buffer of size len bytes to the debug output. This function54* is always used through the MBEDTLS_SSL_DEBUG_BUF() macro,55* which supplies the ssl context, file and line number parameters.56*57* \param ssl SSL context58* \param level error level of the debug message59* \param file file the error has occurred in60* \param line line number the error has occurred in61* \param text a name or label for the buffer being dumped. Normally the62* variable or buffer name63* \param buf the buffer to be outputted64* \param len length of the buffer65*66* \attention This function is intended for INTERNAL usage within the67* library only.68*/69void mbedtls_debug_print_buf(const mbedtls_ssl_context *ssl, int level,70const char *file, int line, const char *text,71const unsigned char *buf, size_t len);7273#if defined(MBEDTLS_BIGNUM_C)74/**75* \brief Print a MPI variable to the debug output. This function is always76* used through the MBEDTLS_SSL_DEBUG_MPI() macro, which supplies the77* ssl context, file and line number parameters.78*79* \param ssl SSL context80* \param level error level of the debug message81* \param file file the error has occurred in82* \param line line number the error has occurred in83* \param text a name or label for the MPI being output. Normally the84* variable name85* \param X the MPI variable86*87* \attention This function is intended for INTERNAL usage within the88* library only.89*/90void mbedtls_debug_print_mpi(const mbedtls_ssl_context *ssl, int level,91const char *file, int line,92const char *text, const mbedtls_mpi *X);93#endif9495#if defined(MBEDTLS_ECP_LIGHT)96/**97* \brief Print an ECP point to the debug output. This function is always98* used through the MBEDTLS_SSL_DEBUG_ECP() macro, which supplies the99* ssl context, file and line number parameters.100*101* \param ssl SSL context102* \param level error level of the debug message103* \param file file the error has occurred in104* \param line line number the error has occurred in105* \param text a name or label for the ECP point being output. Normally the106* variable name107* \param X the ECP point108*109* \attention This function is intended for INTERNAL usage within the110* library only.111*/112void mbedtls_debug_print_ecp(const mbedtls_ssl_context *ssl, int level,113const char *file, int line,114const char *text, const mbedtls_ecp_point *X);115#endif116117#if defined(MBEDTLS_X509_CRT_PARSE_C) && !defined(MBEDTLS_X509_REMOVE_INFO)118/**119* \brief Print a X.509 certificate structure to the debug output. This120* function is always used through the MBEDTLS_SSL_DEBUG_CRT() macro,121* which supplies the ssl context, file and line number parameters.122*123* \param ssl SSL context124* \param level error level of the debug message125* \param file file the error has occurred in126* \param line line number the error has occurred in127* \param text a name or label for the certificate being output128* \param crt X.509 certificate structure129*130* \attention This function is intended for INTERNAL usage within the131* library only.132*/133void mbedtls_debug_print_crt(const mbedtls_ssl_context *ssl, int level,134const char *file, int line,135const char *text, const mbedtls_x509_crt *crt);136#endif137138/* Note: the MBEDTLS_ECDH_C guard here is mandatory because this debug function139only works for the built-in implementation. */140#if defined(MBEDTLS_KEY_EXCHANGE_SOME_ECDH_OR_ECDHE_ANY_ENABLED) && \141defined(MBEDTLS_ECDH_C)142typedef enum {143MBEDTLS_DEBUG_ECDH_Q,144MBEDTLS_DEBUG_ECDH_QP,145MBEDTLS_DEBUG_ECDH_Z,146} mbedtls_debug_ecdh_attr;147148/**149* \brief Print a field of the ECDH structure in the SSL context to the debug150* output. This function is always used through the151* MBEDTLS_SSL_DEBUG_ECDH() macro, which supplies the ssl context, file152* and line number parameters.153*154* \param ssl SSL context155* \param level error level of the debug message156* \param file file the error has occurred in157* \param line line number the error has occurred in158* \param ecdh the ECDH context159* \param attr the identifier of the attribute being output160*161* \attention This function is intended for INTERNAL usage within the162* library only.163*/164void mbedtls_debug_printf_ecdh(const mbedtls_ssl_context *ssl, int level,165const char *file, int line,166const mbedtls_ecdh_context *ecdh,167mbedtls_debug_ecdh_attr attr);168#endif /* MBEDTLS_KEY_EXCHANGE_SOME_ECDH_OR_ECDHE_ANY_ENABLED &&169MBEDTLS_ECDH_C */170171#endif /* MBEDTLS_DEBUG_INTERNAL_H */172173174