Change SSL debug API in the library

This commit is contained in:
Manuel Pégourié-Gonnard 2015-06-23 16:34:24 +02:00
parent 79c4e3ee59
commit fd474233c8
9 changed files with 93 additions and 149 deletions

View file

@ -120,9 +120,6 @@
#if defined MBEDTLS_DEBUG_C
#define POLARSSL_DEBUG_C MBEDTLS_DEBUG_C
#endif
#if defined MBEDTLS_DEBUG_DFL_MODE
#define POLARSSL_DEBUG_DFL_MODE MBEDTLS_DEBUG_DFL_MODE
#endif
#if defined MBEDTLS_DEPRECATED_REMOVED
#define POLARSSL_DEPRECATED_REMOVED MBEDTLS_DEPRECATED_REMOVED
#endif

View file

@ -2413,9 +2413,6 @@
*/
//#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
/* Debug options */
//#define MBEDTLS_DEBUG_DFL_MODE MBEDTLS_DEBUG_LOG_FULL /**< Default log: Full or Raw */
/* X509 options */
//#define MBEDTLS_X509_MAX_INTERMEDIATE_CA 8 /**< Maximum number of intermediate CAs in a verification chain. */

View file

@ -38,24 +38,6 @@
#if defined(MBEDTLS_DEBUG_C)
#define MBEDTLS_DEBUG_LOG_FULL 0 /**< Include file:line in log lines */
#define MBEDTLS_DEBUG_LOG_RAW 1 /**< Only log raw debug lines */
/**
* \name SECTION: Module settings
*
* The configuration options you can set for this module are in this section.
* Either change them in config.h or define them on the compiler command line.
* \{
*/
#if !defined(MBEDTLS_DEBUG_DFL_MODE)
#define MBEDTLS_DEBUG_DFL_MODE MBEDTLS_DEBUG_LOG_FULL /**< Default log: Full or Raw */
#endif
/* \} name SECTION: Module settings */
#define MBEDTLS_SSL_DEBUG_MSG( level, args ) \
mbedtls_debug_print_msg_free( ssl, level, __FILE__, __LINE__, mbedtls_debug_fmt args )
@ -95,15 +77,6 @@
extern "C" {
#endif
/**
* \brief Set the log mode for the debug functions globally
* (Default value: MBEDTLS_DEBUG_DFL_MODE)
*
* \param log_mode The log mode to use (MBEDTLS_DEBUG_LOG_FULL or
* MBEDTLS_DEBUG_LOG_RAW)
*/
void mbedtls_debug_set_log_mode( int log_mode );
/**
* \brief Set the level threshold to handle globally. Messages that have a
* level over the threshold value are ignored.

View file

@ -488,7 +488,7 @@ struct mbedtls_ssl_config
const int *ciphersuite_list[4]; /*!< allowed ciphersuites per version */
/** Callback for printing debug output */
void (*f_dbg)(void *, int, const char *);
void (*f_dbg)(void *, int, const char *, int, const char *);
void *p_dbg; /*!< context for the debug function */
/** Callback for getting (pseudo-)random numbers */
@ -957,12 +957,19 @@ void mbedtls_ssl_conf_rng( mbedtls_ssl_config *conf,
/**
* \brief Set the debug callback
*
* The callback has the following argument:
* void * opaque context for the callback
* int debug level
* const char * file name
* int line number
* const char * message
*
* \param conf SSL configuration
* \param f_dbg debug function
* \param p_dbg debug parameter
*/
void mbedtls_ssl_conf_dbg( mbedtls_ssl_config *conf,
void (*f_dbg)(void *, int, const char *),
void (*f_dbg)(void *, int, const char *, int, const char *),
void *p_dbg );
/**