1/* BEGIN_HEADER */ 2#include "mbedtls/arc4.h" 3/* END_HEADER */ 4 5/* BEGIN_DEPENDENCIES 6 * depends_on:MBEDTLS_ARC4_C 7 * END_DEPENDENCIES 8 */ 9 10/* BEGIN_CASE */ 11void mbedtls_arc4_crypt( data_t * src_str, data_t * key_str, data_t * dst ) 12{ 13 unsigned char dst_str[1000]; 14 mbedtls_arc4_context ctx; 15 16 memset(dst_str, 0x00, 1000); 17 mbedtls_arc4_init( &ctx ); 18 19 20 mbedtls_arc4_setup(&ctx, key_str->x, key_str->len); 21 TEST_ASSERT( mbedtls_arc4_crypt(&ctx, src_str->len, 22 src_str->x, dst_str ) == 0 ); 23 24 TEST_ASSERT( mbedtls_test_hexcmp( dst_str, dst->x, 25 src_str->len, dst->len ) == 0 ); 26 27exit: 28 mbedtls_arc4_free( &ctx ); 29} 30/* END_CASE */ 31 32/* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */ 33void arc4_selftest( ) 34{ 35 TEST_ASSERT( mbedtls_arc4_self_test( 1 ) == 0 ); 36} 37/* END_CASE */ 38