/* BEGIN_HEADER */
#include "mbedtls/aria.h"

/* Maxium size of data used by test vectors
 * WARNING: to be adapted if and when adding larger test cases */
#define ARIA_MAX_DATASIZE  160

/* Maximum sizes of hexified things */
#define ARIA_MAX_KEY_STR    ( 2 * MBEDTLS_ARIA_MAX_KEYSIZE + 1 )
#define ARIA_BLOCK_STR      ( 2 * MBEDTLS_ARIA_BLOCKSIZE + 1 )
#define ARIA_MAX_DATA_STR   ( 2 * ARIA_MAX_DATASIZE + 1 )
/* END_HEADER */

/* BEGIN_DEPENDENCIES
 * depends_on:MBEDTLS_ARIA_C
 * END_DEPENDENCIES
 */

/* BEGIN_CASE */
void aria_valid_param( )
{
    TEST_VALID_PARAM( mbedtls_aria_free( NULL ) );
}
/* END_CASE */

/* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
void aria_invalid_param( )
{
    mbedtls_aria_context ctx;
    unsigned char key[128 / 8] = { 0 };
    unsigned char input[MBEDTLS_ARIA_BLOCKSIZE] = { 0 };
    unsigned char output[MBEDTLS_ARIA_BLOCKSIZE] = { 0 };
    unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE] = { 0 };
    size_t iv_off = 0;

    ((void) iv_off);
    ((void) iv);

    TEST_INVALID_PARAM( mbedtls_aria_init( NULL ) );

    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_setkey_enc( NULL, key,
                                                     sizeof( key ) ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_setkey_enc( &ctx, NULL,
                                                     sizeof( key ) ) );

    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_setkey_dec( NULL, key,
                                                     sizeof( key ) ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_setkey_dec( &ctx, NULL,
                                                     sizeof( key ) ) );

    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_ecb( NULL, input, output ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_ecb( &ctx, NULL, output ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_ecb( &ctx, input, NULL ) );

#if defined(MBEDTLS_CIPHER_MODE_CBC)
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_cbc( NULL,
                                                    MBEDTLS_ARIA_ENCRYPT,
                                                    sizeof( input ),
                                                    iv,
                                                    input,
                                                    output ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_cbc( &ctx,
                                                    42 /* invalid mode */,
                                                    sizeof( input ),
                                                    iv,
                                                    input,
                                                    output ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_cbc( &ctx,
                                                    MBEDTLS_ARIA_ENCRYPT,
                                                    sizeof( input ),
                                                    NULL,
                                                    input,
                                                    output ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_cbc( &ctx,
                                                    MBEDTLS_ARIA_ENCRYPT,
                                                    sizeof( input ),
                                                    iv,
                                                    NULL,
                                                    output ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_cbc( &ctx,
                                                    MBEDTLS_ARIA_ENCRYPT,
                                                    sizeof( input ),
                                                    iv,
                                                    input,
                                                    NULL ) );
#endif /* MBEDTLS_CIPHER_MODE_CBC */

#if defined(MBEDTLS_CIPHER_MODE_CFB)
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_cfb128( NULL,
                                                    MBEDTLS_ARIA_ENCRYPT,
                                                    sizeof( input ),
                                                    &iv_off,
                                                    iv,
                                                    input,
                                                    output ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_cfb128( &ctx,
                                                    42, /* invalid mode */
                                                    sizeof( input ),
                                                    &iv_off,
                                                    iv,
                                                    input,
                                                    output ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_cfb128( &ctx,
                                                    MBEDTLS_ARIA_ENCRYPT,
                                                    sizeof( input ),
                                                    NULL,
                                                    iv,
                                                    input,
                                                    output ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_cfb128( &ctx,
                                                    MBEDTLS_ARIA_ENCRYPT,
                                                    sizeof( input ),
                                                    &iv_off,
                                                    NULL,
                                                    input,
                                                    output ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_cfb128( &ctx,
                                                    MBEDTLS_ARIA_ENCRYPT,
                                                    sizeof( input ),
                                                    &iv_off,
                                                    iv,
                                                    NULL,
                                                    output ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_cfb128( &ctx,
                                                    MBEDTLS_ARIA_ENCRYPT,
                                                    sizeof( input ),
                                                    &iv_off,
                                                    iv,
                                                    input,
                                                    NULL ) );
#endif /* MBEDTLS_CIPHER_MODE_CFB */

#if defined(MBEDTLS_CIPHER_MODE_CTR)
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_ctr( NULL,
                                                    sizeof( input ),
                                                    &iv_off,
                                                    iv,
                                                    iv,
                                                    input,
                                                    output ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_ctr( &ctx,
                                                    sizeof( input ),
                                                    NULL,
                                                    iv,
                                                    iv,
                                                    input,
                                                    output ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_ctr( &ctx,
                                                    sizeof( input ),
                                                    &iv_off,
                                                    NULL,
                                                    iv,
                                                    input,
                                                    output ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_ctr( &ctx,
                                                    sizeof( input ),
                                                    &iv_off,
                                                    iv,
                                                    NULL,
                                                    input,
                                                    output ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_ctr( &ctx,
                                                    sizeof( input ),
                                                    &iv_off,
                                                    iv,
                                                    iv,
                                                    NULL,
                                                    output ) );
    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
                            mbedtls_aria_crypt_ctr( &ctx,
                                                    sizeof( input ),
                                                    &iv_off,
                                                    iv,
                                                    iv,
                                                    input,
                                                    NULL ) );
#endif /* MBEDTLS_CIPHER_MODE_CTR */

exit:
    return;

}
/* END_CASE */

/* BEGIN_CASE */
void aria_encrypt_ecb( data_t *key_str, data_t *src_str,
                       char *hex_dst_string, int setkey_result )
{
    unsigned char dst_str[ARIA_MAX_DATA_STR];
    unsigned char output[ARIA_MAX_DATASIZE];
    mbedtls_aria_context ctx;
    size_t i;

    memset( dst_str, 0x00, sizeof( dst_str ) );
    memset( output, 0x00, sizeof( output ) );
    mbedtls_aria_init( &ctx );

    TEST_ASSERT( mbedtls_aria_setkey_enc( &ctx, key_str->x, key_str->len * 8 )
                 == setkey_result );
    if( setkey_result == 0 )
    {
        for( i = 0; i < src_str->len; i += MBEDTLS_ARIA_BLOCKSIZE )
        {
            TEST_ASSERT( mbedtls_aria_crypt_ecb( &ctx, src_str->x + i,
                                                 output + i ) == 0 );
        }
        mbedtls_test_hexify( dst_str, output, src_str->len );

        TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 );
    }

exit:
    mbedtls_aria_free( &ctx );
}
/* END_CASE */

/* BEGIN_CASE */
void aria_decrypt_ecb( data_t *key_str, data_t *src_str,
                       char *hex_dst_string, int setkey_result )
{
    unsigned char dst_str[ARIA_MAX_DATA_STR];
    unsigned char output[ARIA_MAX_DATASIZE];
    mbedtls_aria_context ctx;
    size_t i;

    memset( dst_str, 0x00, sizeof( dst_str ) );
    memset( output, 0x00, sizeof( output ) );
    mbedtls_aria_init( &ctx );

    TEST_ASSERT( mbedtls_aria_setkey_dec( &ctx, key_str->x, key_str->len * 8 )
                 == setkey_result );
    if( setkey_result == 0 )
    {
        for( i = 0; i < src_str->len; i += MBEDTLS_ARIA_BLOCKSIZE )
        {
            TEST_ASSERT( mbedtls_aria_crypt_ecb( &ctx, src_str->x + i,
                                                 output + i ) == 0 );
        }
        mbedtls_test_hexify( dst_str, output, src_str->len );

        TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 );
    }

exit:
    mbedtls_aria_free( &ctx );
}
/* END_CASE */

/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
void aria_encrypt_cbc( data_t *key_str, data_t *iv_str,
                       data_t *src_str, char *hex_dst_string,
                       int cbc_result )
{
    unsigned char dst_str[ARIA_MAX_DATA_STR];
    unsigned char output[ARIA_MAX_DATASIZE];
    mbedtls_aria_context ctx;

    memset( dst_str, 0x00, sizeof( dst_str ) );
    memset( output, 0x00, sizeof( output ) );
    mbedtls_aria_init( &ctx );

    mbedtls_aria_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
    TEST_ASSERT( mbedtls_aria_crypt_cbc( &ctx, MBEDTLS_ARIA_ENCRYPT,
                                         src_str->len, iv_str->x, src_str->x,
                                         output ) == cbc_result );
    if( cbc_result == 0 )
    {
        mbedtls_test_hexify( dst_str, output, src_str->len );

        TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 );
    }

exit:
    mbedtls_aria_free( &ctx );
}
/* END_CASE */

/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
void aria_decrypt_cbc( data_t *key_str, data_t *iv_str,
                       data_t *src_str, char *hex_dst_string,
                       int cbc_result )
{
    unsigned char dst_str[ARIA_MAX_DATA_STR];
    unsigned char output[ARIA_MAX_DATASIZE];
    mbedtls_aria_context ctx;

    memset( dst_str, 0x00, sizeof( dst_str ) );
    memset( output, 0x00, sizeof( output ) );
    mbedtls_aria_init( &ctx );

    mbedtls_aria_setkey_dec( &ctx, key_str->x, key_str->len * 8 );
    TEST_ASSERT( mbedtls_aria_crypt_cbc( &ctx, MBEDTLS_ARIA_DECRYPT,
                                         src_str->len, iv_str->x, src_str->x,
                                         output ) == cbc_result );
    if( cbc_result == 0 )
    {
        mbedtls_test_hexify( dst_str, output, src_str->len );

        TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 );
    }

exit:
    mbedtls_aria_free( &ctx );
}
/* END_CASE */

/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
void aria_encrypt_cfb128( data_t *key_str, data_t *iv_str,
                          data_t *src_str, char *hex_dst_string,
                          int result )
{
    unsigned char dst_str[ARIA_MAX_DATA_STR];
    unsigned char output[ARIA_MAX_DATASIZE];
    mbedtls_aria_context ctx;
    size_t iv_offset = 0;

    memset( dst_str, 0x00, sizeof( dst_str ) );
    memset( output, 0x00, sizeof( output ) );
    mbedtls_aria_init( &ctx );

    mbedtls_aria_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
    TEST_ASSERT( mbedtls_aria_crypt_cfb128( &ctx, MBEDTLS_ARIA_ENCRYPT,
                                            src_str->len, &iv_offset,
                                            iv_str->x, src_str->x, output )
                 == result );
    mbedtls_test_hexify( dst_str, output, src_str->len );

    TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 );

exit:
    mbedtls_aria_free( &ctx );
}
/* END_CASE */

/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
void aria_decrypt_cfb128( data_t *key_str, data_t *iv_str,
                          data_t *src_str, char *hex_dst_string,
                          int result  )
{
    unsigned char dst_str[ARIA_MAX_DATA_STR];
    unsigned char output[ARIA_MAX_DATASIZE];
    mbedtls_aria_context ctx;
    size_t iv_offset = 0;

    memset( dst_str, 0x00, sizeof( dst_str ) );
    memset( output, 0x00, sizeof( output ) );
    mbedtls_aria_init( &ctx );

    mbedtls_aria_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
    TEST_ASSERT( mbedtls_aria_crypt_cfb128( &ctx, MBEDTLS_ARIA_DECRYPT,
                                            src_str->len, &iv_offset,
                                            iv_str->x, src_str->x, output )
                 == result );
    mbedtls_test_hexify( dst_str, output, src_str->len );

    TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 );

exit:
    mbedtls_aria_free( &ctx );
}
/* END_CASE */

/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CTR */
void aria_encrypt_ctr( data_t *key_str, data_t *iv_str,
                       data_t *src_str, char *hex_dst_string,
                       int result )
{
    unsigned char dst_str[ARIA_MAX_DATA_STR];
    unsigned char output[ARIA_MAX_DATASIZE];
    unsigned char blk[MBEDTLS_ARIA_BLOCKSIZE];
    mbedtls_aria_context ctx;
    size_t iv_offset = 0;

    memset( dst_str, 0x00, sizeof( dst_str ) );
    memset( output, 0x00, sizeof( output ) );
    mbedtls_aria_init( &ctx );

    mbedtls_aria_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
    TEST_ASSERT( mbedtls_aria_crypt_ctr( &ctx, src_str->len, &iv_offset,
                                         iv_str->x, blk, src_str->x, output )
                 == result );
    mbedtls_test_hexify( dst_str, output, src_str->len );

    TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 );

exit:
    mbedtls_aria_free( &ctx );
}
/* END_CASE */

/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CTR */
void aria_decrypt_ctr( data_t *key_str, data_t *iv_str,
                       data_t *src_str, char *hex_dst_string,
                       int result )
{
    unsigned char dst_str[ARIA_MAX_DATA_STR];
    unsigned char output[ARIA_MAX_DATASIZE];
    unsigned char blk[MBEDTLS_ARIA_BLOCKSIZE];
    mbedtls_aria_context ctx;
    size_t iv_offset = 0;

    memset( dst_str, 0x00, sizeof( dst_str ) );
    memset( output, 0x00, sizeof( output ) );
    mbedtls_aria_init( &ctx );

    mbedtls_aria_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
    TEST_ASSERT( mbedtls_aria_crypt_ctr( &ctx, src_str->len, &iv_offset,
                                         iv_str->x, blk, src_str->x, output )
                 == result );
    mbedtls_test_hexify( dst_str, output, src_str->len );

    TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 );

exit:
    mbedtls_aria_free( &ctx );
}
/* END_CASE */

/* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
void aria_selftest()
{
    TEST_ASSERT( mbedtls_aria_self_test( 1 ) == 0 );
}
/* END_CASE */
