mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
PolarSSL: update to current stable version (1.3.4)
I just removed Externals/polarssl/, added the new version, then deleted the following files/directories: DartConfiguration.tcl Makefile doxygen/ library/Makefile programs/ scripts/ tests/ visualc/
This commit is contained in:
82
Externals/polarssl/library/debug.c
vendored
82
Externals/polarssl/library/debug.c
vendored
@ -32,13 +32,19 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined _MSC_VER && !defined snprintf
|
||||
#if defined(EFIX64) || defined(EFI32)
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
|
||||
#if !defined snprintf
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#if defined _MSC_VER && !defined vsnprintf
|
||||
#if !defined vsnprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
char *debug_fmt( const char *format, ... )
|
||||
{
|
||||
@ -128,6 +134,29 @@ void debug_print_buf( const ssl_context *ssl, int level,
|
||||
ssl->f_dbg( ssl->p_dbg, level, "\n" );
|
||||
}
|
||||
|
||||
#if defined(POLARSSL_ECP_C)
|
||||
void debug_print_ecp( const ssl_context *ssl, int level,
|
||||
const char *file, int line,
|
||||
const char *text, const ecp_point *X )
|
||||
{
|
||||
char str[512];
|
||||
int maxlen = sizeof( str ) - 1;
|
||||
|
||||
snprintf( str, maxlen, "%s(X)", text );
|
||||
str[maxlen] = '\0';
|
||||
debug_print_mpi( ssl, level, file, line, str, &X->X );
|
||||
|
||||
snprintf( str, maxlen, "%s(Y)", text );
|
||||
str[maxlen] = '\0';
|
||||
debug_print_mpi( ssl, level, file, line, str, &X->Y );
|
||||
|
||||
snprintf( str, maxlen, "%s(Z)", text );
|
||||
str[maxlen] = '\0';
|
||||
debug_print_mpi( ssl, level, file, line, str, &X->Z );
|
||||
}
|
||||
#endif /* POLARSSL_ECP_C */
|
||||
|
||||
#if defined(POLARSSL_BIGNUM_C)
|
||||
void debug_print_mpi( const ssl_context *ssl, int level,
|
||||
const char *file, int line,
|
||||
const char *text, const mpi *X )
|
||||
@ -199,10 +228,48 @@ void debug_print_mpi( const ssl_context *ssl, int level,
|
||||
|
||||
ssl->f_dbg( ssl->p_dbg, level, "\n" );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C */
|
||||
|
||||
#if defined(POLARSSL_X509_CRT_PARSE_C)
|
||||
static void debug_print_pk( const ssl_context *ssl, int level,
|
||||
const char *file, int line,
|
||||
const char *text, const pk_context *pk )
|
||||
{
|
||||
size_t i;
|
||||
pk_debug_item items[POLARSSL_PK_DEBUG_MAX_ITEMS];
|
||||
char name[16];
|
||||
|
||||
memset( items, 0, sizeof( items ) );
|
||||
|
||||
if( pk_debug( pk, items ) != 0 )
|
||||
{
|
||||
debug_print_msg( ssl, level, file, line, "invalid PK context" );
|
||||
return;
|
||||
}
|
||||
|
||||
for( i = 0; i < sizeof( items ); i++ )
|
||||
{
|
||||
if( items[i].type == POLARSSL_PK_DEBUG_NONE )
|
||||
return;
|
||||
|
||||
snprintf( name, sizeof( name ), "%s%s", text, items[i].name );
|
||||
name[sizeof( name ) - 1] = '\0';
|
||||
|
||||
if( items[i].type == POLARSSL_PK_DEBUG_MPI )
|
||||
debug_print_mpi( ssl, level, file, line, name, items[i].value );
|
||||
else
|
||||
#if defined(POLARSSL_ECP_C)
|
||||
if( items[i].type == POLARSSL_PK_DEBUG_ECP )
|
||||
debug_print_ecp( ssl, level, file, line, name, items[i].value );
|
||||
else
|
||||
#endif
|
||||
debug_print_msg( ssl, level, file, line, "should not happen" );
|
||||
}
|
||||
}
|
||||
|
||||
void debug_print_crt( const ssl_context *ssl, int level,
|
||||
const char *file, int line,
|
||||
const char *text, const x509_cert *crt )
|
||||
const char *text, const x509_crt *crt )
|
||||
{
|
||||
char str[1024], prefix[64];
|
||||
int i = 0, maxlen = sizeof( prefix ) - 1;
|
||||
@ -217,7 +284,7 @@ void debug_print_crt( const ssl_context *ssl, int level,
|
||||
while( crt != NULL )
|
||||
{
|
||||
char buf[1024];
|
||||
x509parse_cert_info( buf, sizeof( buf ) - 1, prefix, crt );
|
||||
x509_crt_info( buf, sizeof( buf ) - 1, prefix, crt );
|
||||
|
||||
snprintf( str, maxlen, "%s(%04d): %s #%d:\n%s",
|
||||
file, line, text, ++i, buf );
|
||||
@ -225,14 +292,11 @@ void debug_print_crt( const ssl_context *ssl, int level,
|
||||
str[maxlen] = '\0';
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
|
||||
debug_print_mpi( ssl, level, file, line,
|
||||
"crt->rsa.N", &crt->rsa.N );
|
||||
|
||||
debug_print_mpi( ssl, level, file, line,
|
||||
"crt->rsa.E", &crt->rsa.E );
|
||||
debug_print_pk( ssl, level, file, line, "crt->", &crt->pk );
|
||||
|
||||
crt = crt->next;
|
||||
}
|
||||
}
|
||||
#endif /* POLARSSL_X509_CRT_PARSE_C */
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user