Tighten sizes in mdx.function
This commit is contained in:
parent
df2437d156
commit
130fe97055
1 changed files with 65 additions and 65 deletions
|
@ -8,18 +8,18 @@
|
|||
/* BEGIN_CASE depends_on:POLARSSL_MD2_C */
|
||||
void md2_text( char *text_src_string, char *hex_hash_string )
|
||||
{
|
||||
unsigned char src_str[1000];
|
||||
unsigned char hash_str[1000];
|
||||
unsigned char output[33];
|
||||
unsigned char src_str[100];
|
||||
unsigned char hash_str[33];
|
||||
unsigned char output[16];
|
||||
|
||||
memset(src_str, 0x00, 1000);
|
||||
memset(hash_str, 0x00, 1000);
|
||||
memset(output, 0x00, 33);
|
||||
memset( src_str, 0x00, sizeof src_str );
|
||||
memset( hash_str, 0x00, sizeof hash_str );
|
||||
memset( output, 0x00, sizeof output );
|
||||
|
||||
strcpy( (char *) src_str, text_src_string );
|
||||
|
||||
md2( src_str, strlen( (char *) src_str ), output );
|
||||
hexify( hash_str, output, 16 );
|
||||
hexify( hash_str, output, sizeof output );
|
||||
|
||||
TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 );
|
||||
}
|
||||
|
@ -28,18 +28,18 @@ void md2_text( char *text_src_string, char *hex_hash_string )
|
|||
/* BEGIN_CASE depends_on:POLARSSL_MD4_C */
|
||||
void md4_text( char *text_src_string, char *hex_hash_string )
|
||||
{
|
||||
unsigned char src_str[1000];
|
||||
unsigned char hash_str[1000];
|
||||
unsigned char output[33];
|
||||
unsigned char src_str[100];
|
||||
unsigned char hash_str[33];
|
||||
unsigned char output[16];
|
||||
|
||||
memset(src_str, 0x00, 1000);
|
||||
memset(hash_str, 0x00, 1000);
|
||||
memset(output, 0x00, 33);
|
||||
memset( src_str, 0x00, sizeof src_str );
|
||||
memset( hash_str, 0x00, sizeof hash_str );
|
||||
memset( output, 0x00, sizeof output );
|
||||
|
||||
strcpy( (char *) src_str, text_src_string );
|
||||
|
||||
md4( src_str, strlen( (char *) src_str ), output );
|
||||
hexify( hash_str, output, 16 );
|
||||
hexify( hash_str, output, sizeof output );
|
||||
|
||||
TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 );
|
||||
}
|
||||
|
@ -48,18 +48,18 @@ void md4_text( char *text_src_string, char *hex_hash_string )
|
|||
/* BEGIN_CASE depends_on:POLARSSL_MD5_C */
|
||||
void md5_text( char *text_src_string, char *hex_hash_string )
|
||||
{
|
||||
unsigned char src_str[1000];
|
||||
unsigned char hash_str[1000];
|
||||
unsigned char output[33];
|
||||
unsigned char src_str[100];
|
||||
unsigned char hash_str[33];
|
||||
unsigned char output[16];
|
||||
|
||||
memset(src_str, 0x00, 1000);
|
||||
memset(hash_str, 0x00, 1000);
|
||||
memset(output, 0x00, 33);
|
||||
memset( src_str, 0x00, sizeof src_str );
|
||||
memset( hash_str, 0x00, sizeof hash_str );
|
||||
memset( output, 0x00, sizeof output );
|
||||
|
||||
strcpy( (char *) src_str, text_src_string );
|
||||
|
||||
md5( src_str, strlen( (char *) src_str ), output );
|
||||
hexify( hash_str, output, 16 );
|
||||
hexify( hash_str, output, sizeof output );
|
||||
|
||||
TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 );
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ void md5_text( char *text_src_string, char *hex_hash_string )
|
|||
/* BEGIN_CASE depends_on:POLARSSL_RMD160_C */
|
||||
void rmd160_text( char *text_src_string, char *hex_hash_string )
|
||||
{
|
||||
unsigned char src_str[1000];
|
||||
unsigned char src_str[100];
|
||||
unsigned char hash_str[41];
|
||||
unsigned char output[20];
|
||||
|
||||
|
@ -89,22 +89,22 @@ void rmd160_text( char *text_src_string, char *hex_hash_string )
|
|||
void md2_hmac( int trunc_size, char *hex_key_string, char *hex_src_string,
|
||||
char *hex_hash_string )
|
||||
{
|
||||
unsigned char src_str[10000];
|
||||
unsigned char key_str[10000];
|
||||
unsigned char hash_str[10000];
|
||||
unsigned char output[33];
|
||||
unsigned char src_str[200];
|
||||
unsigned char key_str[200];
|
||||
unsigned char hash_str[33];
|
||||
unsigned char output[16];
|
||||
int key_len, src_len;
|
||||
|
||||
memset(src_str, 0x00, 10000);
|
||||
memset(key_str, 0x00, 10000);
|
||||
memset(hash_str, 0x00, 10000);
|
||||
memset(output, 0x00, 33);
|
||||
memset( src_str, 0x00, sizeof src_str );
|
||||
memset( key_str, 0x00, sizeof key_str );
|
||||
memset( hash_str, 0x00, sizeof hash_str );
|
||||
memset( output, 0x00, sizeof output );
|
||||
|
||||
key_len = unhexify( key_str, hex_key_string );
|
||||
src_len = unhexify( src_str, hex_src_string );
|
||||
|
||||
md2_hmac( key_str, key_len, src_str, src_len, output );
|
||||
hexify( hash_str, output, 16 );
|
||||
hexify( hash_str, output, sizeof output );
|
||||
|
||||
TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 );
|
||||
}
|
||||
|
@ -114,22 +114,22 @@ void md2_hmac( int trunc_size, char *hex_key_string, char *hex_src_string,
|
|||
void md4_hmac( int trunc_size, char *hex_key_string, char *hex_src_string,
|
||||
char *hex_hash_string )
|
||||
{
|
||||
unsigned char src_str[10000];
|
||||
unsigned char key_str[10000];
|
||||
unsigned char hash_str[10000];
|
||||
unsigned char output[33];
|
||||
unsigned char src_str[200];
|
||||
unsigned char key_str[200];
|
||||
unsigned char hash_str[33];
|
||||
unsigned char output[16];
|
||||
int key_len, src_len;
|
||||
|
||||
memset(src_str, 0x00, 10000);
|
||||
memset(key_str, 0x00, 10000);
|
||||
memset(hash_str, 0x00, 10000);
|
||||
memset(output, 0x00, 33);
|
||||
memset( src_str, 0x00, sizeof src_str );
|
||||
memset( key_str, 0x00, sizeof key_str );
|
||||
memset( hash_str, 0x00, sizeof hash_str );
|
||||
memset( output, 0x00, sizeof output );
|
||||
|
||||
key_len = unhexify( key_str, hex_key_string );
|
||||
src_len = unhexify( src_str, hex_src_string );
|
||||
|
||||
md4_hmac( key_str, key_len, src_str, src_len, output );
|
||||
hexify( hash_str, output, 16 );
|
||||
hexify( hash_str, output, sizeof output );
|
||||
|
||||
TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 );
|
||||
}
|
||||
|
@ -139,22 +139,22 @@ void md4_hmac( int trunc_size, char *hex_key_string, char *hex_src_string,
|
|||
void md5_hmac( int trunc_size, char *hex_key_string, char *hex_src_string,
|
||||
char *hex_hash_string )
|
||||
{
|
||||
unsigned char src_str[10000];
|
||||
unsigned char key_str[10000];
|
||||
unsigned char hash_str[10000];
|
||||
unsigned char output[33];
|
||||
unsigned char src_str[200];
|
||||
unsigned char key_str[200];
|
||||
unsigned char hash_str[33];
|
||||
unsigned char output[16];
|
||||
int key_len, src_len;
|
||||
|
||||
memset(src_str, 0x00, 10000);
|
||||
memset(key_str, 0x00, 10000);
|
||||
memset(hash_str, 0x00, 10000);
|
||||
memset(output, 0x00, 33);
|
||||
memset( src_str, 0x00, sizeof src_str );
|
||||
memset( key_str, 0x00, sizeof key_str );
|
||||
memset( hash_str, 0x00, sizeof hash_str );
|
||||
memset( output, 0x00, sizeof output );
|
||||
|
||||
key_len = unhexify( key_str, hex_key_string );
|
||||
src_len = unhexify( src_str, hex_src_string );
|
||||
|
||||
md5_hmac( key_str, key_len, src_str, src_len, output );
|
||||
hexify( hash_str, output, 16 );
|
||||
hexify( hash_str, output, sizeof output );
|
||||
|
||||
TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 );
|
||||
}
|
||||
|
@ -163,14 +163,14 @@ void md5_hmac( int trunc_size, char *hex_key_string, char *hex_src_string,
|
|||
/* BEGIN_CASE depends_on:POLARSSL_MD2_C:POLARSSL_FS_IO */
|
||||
void md2_file( char *filename, char *hex_hash_string )
|
||||
{
|
||||
unsigned char hash_str[65];
|
||||
unsigned char output[33];
|
||||
unsigned char hash_str[33];
|
||||
unsigned char output[16];
|
||||
|
||||
memset(hash_str, 0x00, 65);
|
||||
memset(output, 0x00, 33);
|
||||
memset( hash_str, 0x00, sizeof hash_str );
|
||||
memset( output, 0x00, sizeof output );
|
||||
|
||||
md2_file( filename, output);
|
||||
hexify( hash_str, output, 16 );
|
||||
hexify( hash_str, output, sizeof output );
|
||||
|
||||
TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 );
|
||||
}
|
||||
|
@ -179,14 +179,14 @@ void md2_file( char *filename, char *hex_hash_string )
|
|||
/* BEGIN_CASE depends_on:POLARSSL_MD4_C:POLARSSL_FS_IO */
|
||||
void md4_file( char *filename, char *hex_hash_string )
|
||||
{
|
||||
unsigned char hash_str[65];
|
||||
unsigned char output[33];
|
||||
unsigned char hash_str[33];
|
||||
unsigned char output[16];
|
||||
|
||||
memset(hash_str, 0x00, 65);
|
||||
memset(output, 0x00, 33);
|
||||
memset( hash_str, 0x00, sizeof hash_str );
|
||||
memset( output, 0x00, sizeof output );
|
||||
|
||||
md4_file( filename, output);
|
||||
hexify( hash_str, output, 16 );
|
||||
hexify( hash_str, output, sizeof output );
|
||||
|
||||
TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 );
|
||||
}
|
||||
|
@ -195,14 +195,14 @@ void md4_file( char *filename, char *hex_hash_string )
|
|||
/* BEGIN_CASE depends_on:POLARSSL_MD5_C:POLARSSL_FS_IO */
|
||||
void md5_file( char *filename, char *hex_hash_string )
|
||||
{
|
||||
unsigned char hash_str[65];
|
||||
unsigned char output[33];
|
||||
unsigned char hash_str[33];
|
||||
unsigned char output[16];
|
||||
|
||||
memset(hash_str, 0x00, 65);
|
||||
memset(output, 0x00, 33);
|
||||
memset( hash_str, 0x00, sizeof hash_str );
|
||||
memset( output, 0x00, sizeof output );
|
||||
|
||||
md5_file( filename, output);
|
||||
hexify( hash_str, output, 16 );
|
||||
hexify( hash_str, output, sizeof output );
|
||||
|
||||
TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 );
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ void rmd160_file( char *filename, char *hex_hash_string )
|
|||
memset(output, 0x00, sizeof output );
|
||||
|
||||
rmd160_file( filename, output);
|
||||
hexify( hash_str, output, 20 );
|
||||
hexify( hash_str, output, sizeof output );
|
||||
|
||||
TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue