mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-01-10 16:41:54 +01:00
Combine hex parameters in a struct
This commit is contained in:
parent
5cfc06832e
commit
d30ca130e8
36 changed files with 756 additions and 1014 deletions
|
|
@ -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 );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue