mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 17:18:07 +00:00
Tests for MD info functions
This commit is contained in:
parent
5819db1384
commit
f3013830cc
2 changed files with 70 additions and 0 deletions
|
@ -1,3 +1,42 @@
|
|||
MD list
|
||||
md_list:
|
||||
|
||||
Information on MD2
|
||||
depends_on:POLARSSL_MD2_C
|
||||
md_info:POLARSSL_MD_MD2:"MD2":16
|
||||
|
||||
Information on MD4
|
||||
depends_on:POLARSSL_MD4_C
|
||||
md_info:POLARSSL_MD_MD4:"MD4":16
|
||||
|
||||
Information on MD5
|
||||
depends_on:POLARSSL_MD5_C
|
||||
md_info:POLARSSL_MD_MD5:"MD5":16
|
||||
|
||||
Information on RIPEMD160
|
||||
depends_on:POLARSSL_RIPEMD160_C
|
||||
md_info:POLARSSL_MD_RIPEMD160:"RIPEMD160":20
|
||||
|
||||
Information on SHA1
|
||||
depends_on:POLARSSL_SHA1_C
|
||||
md_info:POLARSSL_MD_SHA1:"SHA1":20
|
||||
|
||||
Information on SHA224
|
||||
depends_on:POLARSSL_SHA256_C
|
||||
md_info:POLARSSL_MD_SHA224:"SHA224":28
|
||||
|
||||
Information on SHA256
|
||||
depends_on:POLARSSL_SHA256_C
|
||||
md_info:POLARSSL_MD_SHA256:"SHA256":32
|
||||
|
||||
Information on SHA384
|
||||
depends_on:POLARSSL_SHA512_C
|
||||
md_info:POLARSSL_MD_SHA384:"SHA384":48
|
||||
|
||||
Information on SHA512
|
||||
depends_on:POLARSSL_SHA512_C
|
||||
md_info:POLARSSL_MD_SHA512:"SHA512":64
|
||||
|
||||
generic md2 Test vector RFC1319 #1
|
||||
depends_on:POLARSSL_MD2_C
|
||||
md_text:"md2":"":"8350e5a3e24c153df2275c9f80692773"
|
||||
|
|
|
@ -7,6 +7,37 @@
|
|||
* END_DEPENDENCIES
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void md_list( )
|
||||
{
|
||||
const int *md_type_ptr;
|
||||
|
||||
for( md_type_ptr = md_list(); *md_type_ptr != 0; md_type_ptr++ )
|
||||
TEST_ASSERT( md_info_from_type( *md_type_ptr ) != NULL );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void md_info( int md_type, char *md_name, int md_size )
|
||||
{
|
||||
const md_info_t *md_info;
|
||||
const int *md_type_ptr;
|
||||
int found;
|
||||
|
||||
TEST_ASSERT( ( md_info = md_info_from_type( md_type ) ) != NULL );
|
||||
TEST_ASSERT( md_info == md_info_from_string( md_name ) );
|
||||
|
||||
TEST_ASSERT( md_get_type( md_info ) == (md_type_t) md_type );
|
||||
TEST_ASSERT( md_get_size( md_info ) == (unsigned char) md_size );
|
||||
|
||||
found = 0;
|
||||
for( md_type_ptr = md_list(); *md_type_ptr != 0; md_type_ptr++ )
|
||||
if( *md_type_ptr == md_type )
|
||||
found = 1;
|
||||
TEST_ASSERT( found == 1 );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void md_text( char *text_md_name, char *text_src_string, char *hex_hash_string )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue