mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-01-06 14:38:57 +01:00
Add debug_set_threshold() and thresholding of messages
This commit is contained in:
parent
92478c37a6
commit
c73079a78c
9 changed files with 107 additions and 34 deletions
|
|
@ -29,6 +29,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/net.h"
|
||||
#include "polarssl/debug.h"
|
||||
#include "polarssl/ssl.h"
|
||||
#include "polarssl/entropy.h"
|
||||
#include "polarssl/ctr_drbg.h"
|
||||
|
|
@ -61,11 +62,10 @@ int main( int argc, char *argv[] )
|
|||
|
||||
static void my_debug( void *ctx, int level, const char *str )
|
||||
{
|
||||
if( level < DEBUG_LEVEL )
|
||||
{
|
||||
fprintf( (FILE *) ctx, "%s", str );
|
||||
fflush( (FILE *) ctx );
|
||||
}
|
||||
((void) level);
|
||||
|
||||
fprintf( (FILE *) ctx, "%s", str );
|
||||
fflush( (FILE *) ctx );
|
||||
}
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
|
|
@ -82,6 +82,10 @@ int main( int argc, char *argv[] )
|
|||
((void) argc);
|
||||
((void) argv);
|
||||
|
||||
#if defined(POLARSSL_DEBUG_C)
|
||||
debug_set_threshold( DEBUG_LEVEL );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 0. Initialize the RNG and the session data
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include "polarssl/certs.h"
|
||||
#include "polarssl/x509.h"
|
||||
#include "polarssl/error.h"
|
||||
#include "polarssl/debug.h"
|
||||
|
||||
#if defined(POLARSSL_TIMING_C)
|
||||
#include "polarssl/timing.h"
|
||||
|
|
@ -112,11 +113,10 @@ struct options
|
|||
|
||||
static void my_debug( void *ctx, int level, const char *str )
|
||||
{
|
||||
if( level < opt.debug_level )
|
||||
{
|
||||
fprintf( (FILE *) ctx, "%s", str );
|
||||
fflush( (FILE *) ctx );
|
||||
}
|
||||
((void) level);
|
||||
|
||||
fprintf( (FILE *) ctx, "%s", str );
|
||||
fflush( (FILE *) ctx );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -589,6 +589,10 @@ int main( int argc, char *argv[] )
|
|||
goto usage;
|
||||
}
|
||||
|
||||
#if defined(POLARSSL_DEBUG_C)
|
||||
debug_set_threshold( opt.debug_level );
|
||||
#endif
|
||||
|
||||
if( opt.force_ciphersuite[0] > 0 )
|
||||
{
|
||||
const ssl_ciphersuite_t *ciphersuite_info;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include "polarssl/ssl.h"
|
||||
#include "polarssl/net.h"
|
||||
#include "polarssl/error.h"
|
||||
#include "polarssl/debug.h"
|
||||
|
||||
#if defined(POLARSSL_SSL_CACHE_C)
|
||||
#include "polarssl/ssl_cache.h"
|
||||
|
|
@ -73,11 +74,10 @@ int main( int argc, char *argv[] )
|
|||
|
||||
static void my_debug( void *ctx, int level, const char *str )
|
||||
{
|
||||
if( level < DEBUG_LEVEL )
|
||||
{
|
||||
fprintf( (FILE *) ctx, "%s", str );
|
||||
fflush( (FILE *) ctx );
|
||||
}
|
||||
((void) level);
|
||||
|
||||
fprintf( (FILE *) ctx, "%s", str );
|
||||
fflush( (FILE *) ctx );
|
||||
}
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
|
|
@ -108,6 +108,10 @@ int main( int argc, char *argv[] )
|
|||
pk_init( &pkey );
|
||||
entropy_init( &entropy );
|
||||
|
||||
#if defined(POLARSSL_DEBUG_C)
|
||||
debug_set_threshold( DEBUG_LEVEL );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 1. Load the certificates and private RSA key
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
#include "polarssl/certs.h"
|
||||
#include "polarssl/x509.h"
|
||||
#include "polarssl/error.h"
|
||||
#include "polarssl/debug.h"
|
||||
|
||||
#if defined(POLARSSL_SSL_CACHE_C)
|
||||
#include "polarssl/ssl_cache.h"
|
||||
|
|
@ -137,11 +138,10 @@ struct options
|
|||
|
||||
static void my_debug( void *ctx, int level, const char *str )
|
||||
{
|
||||
if( level < opt.debug_level )
|
||||
{
|
||||
fprintf( (FILE *) ctx, "%s", str );
|
||||
fflush( (FILE *) ctx );
|
||||
}
|
||||
((void) level);
|
||||
|
||||
fprintf( (FILE *) ctx, "%s", str );
|
||||
fflush( (FILE *) ctx );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -721,6 +721,10 @@ int main( int argc, char *argv[] )
|
|||
goto usage;
|
||||
}
|
||||
|
||||
#if defined(POLARSSL_DEBUG_C)
|
||||
debug_set_threshold( opt.debug_level );
|
||||
#endif
|
||||
|
||||
if( opt.force_ciphersuite[0] > 0 )
|
||||
{
|
||||
const ssl_ciphersuite_t *ciphersuite_info;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue