2010-02-18 19:16:31 +01:00
|
|
|
BEGIN_HEADER
|
|
|
|
#include <polarssl/debug.h>
|
|
|
|
|
|
|
|
struct buffer_data
|
|
|
|
{
|
|
|
|
char buf[2000];
|
|
|
|
char *ptr;
|
|
|
|
};
|
|
|
|
|
2010-03-16 22:09:09 +01:00
|
|
|
void string_debug(void *data, int level, const char *str)
|
2010-02-18 19:16:31 +01:00
|
|
|
{
|
|
|
|
struct buffer_data *buffer = (struct buffer_data *) data;
|
2011-07-13 16:53:58 +02:00
|
|
|
((void) level);
|
2010-02-18 19:16:31 +01:00
|
|
|
|
|
|
|
memcpy(buffer->ptr, str, strlen(str));
|
|
|
|
buffer->ptr += strlen(str);
|
|
|
|
}
|
|
|
|
END_HEADER
|
|
|
|
|
2011-05-26 15:16:06 +02:00
|
|
|
BEGIN_DEPENDENCIES
|
|
|
|
depends_on:POLARSSL_DEBUG_C:POLARSSL_BIGNUM_C:POLARSSL_SSL_TLS_C:POLARSSL_RSA_C
|
|
|
|
END_DEPENDENCIES
|
|
|
|
|
2010-02-18 19:16:31 +01:00
|
|
|
BEGIN_CASE
|
2013-08-16 13:38:47 +02:00
|
|
|
debug_print_crt:crt_file:file:#line:prefix:result_str
|
2010-02-18 19:16:31 +01:00
|
|
|
{
|
|
|
|
x509_cert crt;
|
|
|
|
ssl_context ssl;
|
|
|
|
struct buffer_data buffer;
|
|
|
|
|
|
|
|
memset( &crt, 0, sizeof( x509_cert ) );
|
|
|
|
memset( &ssl, 0, sizeof( ssl_context ) );
|
|
|
|
memset( buffer.buf, 0, 2000 );
|
|
|
|
buffer.ptr = buffer.buf;
|
|
|
|
|
|
|
|
ssl_set_dbg(&ssl, string_debug, &buffer);
|
|
|
|
|
2011-12-10 22:55:01 +01:00
|
|
|
TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} ) == 0 );
|
2010-02-18 19:16:31 +01:00
|
|
|
debug_print_crt( &ssl, 0, {file}, {line}, {prefix}, &crt);
|
|
|
|
|
|
|
|
TEST_ASSERT( strcmp( buffer.buf, {result_str} ) == 0 );
|
2013-01-03 11:33:48 +01:00
|
|
|
|
|
|
|
x509_free( &crt );
|
2010-02-18 19:16:31 +01:00
|
|
|
}
|
|
|
|
END_CASE
|
2011-03-14 21:41:31 +01:00
|
|
|
|
|
|
|
BEGIN_CASE
|
2013-08-16 13:38:47 +02:00
|
|
|
debug_print_mpi:#radix:value:file:#line:prefix:result_str
|
2011-03-14 21:41:31 +01:00
|
|
|
{
|
|
|
|
ssl_context ssl;
|
|
|
|
struct buffer_data buffer;
|
|
|
|
mpi val;
|
|
|
|
|
2011-05-05 13:49:20 +02:00
|
|
|
mpi_init( &val );
|
2011-03-14 21:41:31 +01:00
|
|
|
|
|
|
|
memset( &ssl, 0, sizeof( ssl_context ) );
|
|
|
|
memset( buffer.buf, 0, 2000 );
|
|
|
|
buffer.ptr = buffer.buf;
|
|
|
|
|
|
|
|
TEST_ASSERT( mpi_read_string( &val, {radix}, {value} ) == 0 );
|
|
|
|
ssl_set_dbg(&ssl, string_debug, &buffer);
|
|
|
|
|
|
|
|
debug_print_mpi( &ssl, 0, {file}, {line}, {prefix}, &val);
|
|
|
|
|
|
|
|
TEST_ASSERT( strcmp( buffer.buf, {result_str} ) == 0 );
|
2011-05-05 13:49:20 +02:00
|
|
|
|
|
|
|
mpi_free( &val );
|
2011-03-14 21:41:31 +01:00
|
|
|
}
|
|
|
|
END_CASE
|
|
|
|
|
|
|
|
|