mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-24 00:06:32 +01:00
Add HMAC support to RIPEMD-160
This commit is contained in:
parent
1744d72902
commit
ff40c3ac34
4 changed files with 268 additions and 17 deletions
|
|
@ -160,6 +160,31 @@ void md5_hmac( int trunc_size, char *hex_key_string, char *hex_src_string,
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:POLARSSL_RMD160_C */
|
||||
void rmd160_hmac( int trunc_size, char *hex_key_string, char *hex_src_string,
|
||||
char *hex_hash_string )
|
||||
{
|
||||
unsigned char src_str[200];
|
||||
unsigned char key_str[200];
|
||||
unsigned char hash_str[41];
|
||||
unsigned char output[20];
|
||||
int key_len, src_len;
|
||||
|
||||
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 );
|
||||
|
||||
rmd160_hmac( key_str, key_len, src_str, src_len, output );
|
||||
hexify( hash_str, output, sizeof output );
|
||||
|
||||
TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:POLARSSL_MD2_C:POLARSSL_FS_IO */
|
||||
void md2_file( char *filename, char *hex_hash_string )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue