mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
- 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.
This commit is contained in:
65
tests/suites/test_suite_mdx.function
Normal file
65
tests/suites/test_suite_mdx.function
Normal file
@@ -0,0 +1,65 @@
|
||||
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
|
Reference in New Issue
Block a user