mbedtls/tests/suites/test_suite_mdx.function
Paul Bakker 367dae44b2 - Added CMake makefiles as alternative to regular Makefiles.
- Added preliminary Code Coverage tests for AES, ARC4, Base64, MPI, SHA-family, MD-family and  HMAC-SHA-family.
2009-06-28 21:50:27 +00:00

66 lines
1.5 KiB
Plaintext

BEGIN_HEADER
#include <polarssl/md2.h>
#include <polarssl/md4.h>
#include <polarssl/md5.h>
END_HEADER
BEGIN_CASE
md2_text:text_src_string:hex_hash_string
{
unsigned char src_str[1000];
unsigned char hash_str[1000];
unsigned char output[33];
memset(src_str, 0x00, 1000);
memset(hash_str, 0x00, 1000);
memset(output, 0x00, 33);
strcpy( (char *) src_str, {text_src_string} );
md2( src_str, strlen( (char *) src_str ), output );
hexify( hash_str, output, 16 );
TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 );
}
END_CASE
BEGIN_CASE
md4_text:text_src_string:hex_hash_string
{
unsigned char src_str[1000];
unsigned char hash_str[1000];
unsigned char output[33];
memset(src_str, 0x00, 1000);
memset(hash_str, 0x00, 1000);
memset(output, 0x00, 33);
strcpy( (char *) src_str, {text_src_string} );
md4( src_str, strlen( (char *) src_str ), output );
hexify( hash_str, output, 16 );
TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 );
}
END_CASE
BEGIN_CASE
md5_text:text_src_string:hex_hash_string
{
unsigned char src_str[1000];
unsigned char hash_str[1000];
unsigned char output[33];
memset(src_str, 0x00, 1000);
memset(hash_str, 0x00, 1000);
memset(output, 0x00, 33);
strcpy( (char *) src_str, {text_src_string} );
md5( src_str, strlen( (char *) src_str ), output );
hexify( hash_str, output, 16 );
TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 );
}
END_CASE