Adapt code for scripting out hexify/unhexify code

This commit is contained in:
Azim Khan 2017-05-30 00:57:11 +01:00 committed by Mohammad Azim Khan
parent 3499a9e41b
commit 9079170f6e
2 changed files with 11 additions and 7 deletions

View file

@ -18,7 +18,9 @@ void mbedtls_asn1_write_octet_string( char *hex_str, char *hex_asn1,
unsigned char buf[150]; unsigned char buf[150];
unsigned char str[150] = { 0 }; unsigned char str[150] = { 0 };
unsigned char asn1[150] = { 0 }; unsigned char asn1[150] = { 0 };
size_t str_len, asn1_len, i; size_t str_len;
size_t asn1_len;
size_t i;
unsigned char *p; unsigned char *p;
memset( buf, GUARD_VAL, sizeof( buf ) ); memset( buf, GUARD_VAL, sizeof( buf ) );
@ -54,7 +56,9 @@ void mbedtls_asn1_write_ia5_string( char *str, char *hex_asn1,
int ret; int ret;
unsigned char buf[150]; unsigned char buf[150];
unsigned char asn1[150] = { 0 }; unsigned char asn1[150] = { 0 };
size_t str_len, asn1_len, i; size_t str_len;
size_t asn1_len;
size_t i;
unsigned char *p; unsigned char *p;
memset( buf, GUARD_VAL, sizeof( buf ) ); memset( buf, GUARD_VAL, sizeof( buf ) );
@ -91,7 +95,9 @@ void mbedtls_asn1_write_len( int len, char *check_str, int buf_len,
unsigned char buf[150]; unsigned char buf[150];
unsigned char asn1[150]; unsigned char asn1[150];
unsigned char *p; unsigned char *p;
size_t asn1_len, i, read_len; size_t asn1_len;
size_t i;
size_t read_len;
memset( buf, GUARD_VAL, sizeof( buf ) ); memset( buf, GUARD_VAL, sizeof( buf ) );
memset( asn1, 0, sizeof( asn1 ) ); memset( asn1, 0, sizeof( asn1 ) );

View file

@ -519,8 +519,7 @@ void mbedtls_rsa_private( char *message_hex_string, int mod, int radix_P, char *
{ {
hexify( output_str, output, ctx.len ); hexify( output_str, output, ctx.len );
TEST_ASSERT( strcasecmp( (char *) output_str, TEST_ASSERT( strcasecmp( (char *) output_str, result_hex_str ) == 0 );
result_hex_str ) == 0 );
} }
} }
@ -539,8 +538,7 @@ void mbedtls_rsa_private( char *message_hex_string, int mod, int radix_P, char *
{ {
hexify( output_str, output, ctx2.len ); hexify( output_str, output, ctx2.len );
TEST_ASSERT( strcasecmp( (char *) output_str, TEST_ASSERT( strcasecmp( (char *) output_str, result_hex_str ) == 0 );
result_hex_str ) == 0 );
} }
exit: exit: