mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 19:28:14 +00:00
Test generic md_hmac_reset()
This commit is contained in:
parent
58319e7f5c
commit
59ba4e983b
1 changed files with 13 additions and 1 deletions
|
@ -197,11 +197,23 @@ void md_hmac_multi( char *text_md_name, int trunc_size, char *hex_key_string,
|
|||
TEST_ASSERT ( ctx.md_ctx != NULL );
|
||||
TEST_ASSERT ( 0 == md_hmac_update( &ctx, src_str, src_len ) );
|
||||
TEST_ASSERT ( 0 == md_hmac_finish( &ctx, output ) );
|
||||
|
||||
hexify( hash_str, output, md_get_size(md_info) );
|
||||
TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 );
|
||||
|
||||
/* Test again, for reset() */
|
||||
memset(hash_str, 0x00, 10000);
|
||||
memset(output, 0x00, 100);
|
||||
|
||||
TEST_ASSERT ( 0 == md_hmac_reset( &ctx ) );
|
||||
TEST_ASSERT ( 0 == md_hmac_update( &ctx, src_str, src_len ) );
|
||||
TEST_ASSERT ( 0 == md_hmac_finish( &ctx, output ) );
|
||||
TEST_ASSERT ( 0 == md_free_ctx( &ctx ) );
|
||||
|
||||
hexify( hash_str, output, md_get_size(md_info) );
|
||||
|
||||
TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 );
|
||||
|
||||
TEST_ASSERT ( 0 == md_free_ctx( &ctx ) );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
|
|
Loading…
Reference in a new issue