mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-02-19 00:39:46 +00:00
Combine hex parameters in a struct
This commit is contained in:
committed by
Mohammad Azim Khan
parent
5cfc06832e
commit
d30ca130e8
@@ -8,10 +8,8 @@
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void mbedtls_arc4_crypt( uint8_t * src_str, uint32_t src_len,
|
||||
uint8_t * key_str, uint32_t key_len,
|
||||
uint8_t * hex_dst_string, uint32_t hex_dst_string_len
|
||||
)
|
||||
void mbedtls_arc4_crypt( HexParam_t * src_str, HexParam_t * key_str,
|
||||
HexParam_t * hex_dst_string )
|
||||
{
|
||||
unsigned char dst_str[1000];
|
||||
mbedtls_arc4_context ctx;
|
||||
@@ -20,10 +18,10 @@ void mbedtls_arc4_crypt( uint8_t * src_str, uint32_t src_len,
|
||||
mbedtls_arc4_init( &ctx );
|
||||
|
||||
|
||||
mbedtls_arc4_setup(&ctx, key_str, key_len);
|
||||
TEST_ASSERT( mbedtls_arc4_crypt(&ctx, src_len, src_str, dst_str ) == 0 );
|
||||
mbedtls_arc4_setup(&ctx, key_str->x, key_str->len);
|
||||
TEST_ASSERT( mbedtls_arc4_crypt(&ctx, src_str->len, src_str->x, dst_str ) == 0 );
|
||||
|
||||
TEST_ASSERT( hexcmp( dst_str, hex_dst_string, src_len, hex_dst_string_len ) == 0 );
|
||||
TEST_ASSERT( hexcmp( dst_str, hex_dst_string->x, src_str->len, hex_dst_string->len ) == 0 );
|
||||
|
||||
exit:
|
||||
mbedtls_arc4_free( &ctx );
|
||||
|
||||
Reference in New Issue
Block a user