early-access version 1676
This commit is contained in:
@@ -13,13 +13,22 @@ void mbedtls_base64_encode( char * src_string, char * dst_string,
|
||||
{
|
||||
unsigned char src_str[1000];
|
||||
unsigned char dst_str[1000];
|
||||
size_t len;
|
||||
size_t len, src_len;
|
||||
|
||||
memset(src_str, 0x00, 1000);
|
||||
memset(dst_str, 0x00, 1000);
|
||||
|
||||
strncpy( (char *) src_str, src_string, sizeof(src_str) - 1 );
|
||||
TEST_ASSERT( mbedtls_base64_encode( dst_str, dst_buf_size, &len, src_str, strlen( (char *) src_str ) ) == result );
|
||||
src_len = strlen( (char *) src_str );
|
||||
|
||||
TEST_CF_SECRET( src_str, sizeof( src_str ) );
|
||||
TEST_ASSERT( mbedtls_base64_encode( dst_str, dst_buf_size, &len, src_str, src_len) == result );
|
||||
TEST_CF_PUBLIC( src_str, sizeof( src_str ) );
|
||||
|
||||
/* dest_str will have had tainted data copied to it, prevent the TEST_ASSERT below from triggering
|
||||
CF failures by unmarking it. */
|
||||
TEST_CF_PUBLIC( dst_str, len );
|
||||
|
||||
if( result == 0 )
|
||||
{
|
||||
TEST_ASSERT( strcmp( (char *) dst_str, dst_string ) == 0 );
|
||||
@@ -57,7 +66,14 @@ void base64_encode_hex( data_t * src, char * dst, int dst_buf_size,
|
||||
|
||||
res = zero_alloc( dst_buf_size );
|
||||
|
||||
TEST_CF_SECRET( src->x, src->len );
|
||||
TEST_ASSERT( mbedtls_base64_encode( res, dst_buf_size, &len, src->x, src->len ) == result );
|
||||
TEST_CF_PUBLIC( src->x, src->len );
|
||||
|
||||
/* res will have had tainted data copied to it, prevent the TEST_ASSERT below from triggering
|
||||
CF failures by unmarking it. */
|
||||
TEST_CF_PUBLIC( res, len );
|
||||
|
||||
if( result == 0 )
|
||||
{
|
||||
TEST_ASSERT( len == strlen( dst ) );
|
||||
|
Reference in New Issue
Block a user