Lines Matching refs:i

394     uint8_t i, j;  in aria_rot128()  local
402 for( i = 0; i < 4; i++ ) in aria_rot128()
409 r[i] = a[i] ^ t; // store in aria_rot128()
428 int i; in mbedtls_aria_setkey_enc() local
454 i = ( keybits - 128 ) >> 6; // index: 0, 1, 2 in mbedtls_aria_setkey_enc()
455 ctx->nr = 12 + 2 * i; // no. rounds: 12, 14, 16 in mbedtls_aria_setkey_enc()
457 aria_fo_xor( w[1], w[0], rc[i], w[1] ); // W1 = FO(W0, CK1) ^ KR in mbedtls_aria_setkey_enc()
458 i = i < 2 ? i + 1 : 0; in mbedtls_aria_setkey_enc()
459 aria_fe_xor( w[2], w[1], rc[i], w[0] ); // W2 = FE(W1, CK2) ^ W0 in mbedtls_aria_setkey_enc()
460 i = i < 2 ? i + 1 : 0; in mbedtls_aria_setkey_enc()
461 aria_fo_xor( w[3], w[2], rc[i], w[1] ); // W3 = FO(W2, CK3) ^ W1 in mbedtls_aria_setkey_enc()
463 for( i = 0; i < 4; i++ ) // create round keys in mbedtls_aria_setkey_enc()
465 w2 = w[(i + 1) & 3]; in mbedtls_aria_setkey_enc()
466 aria_rot128( ctx->rk[i ], w[i], w2, 128 - 19 ); in mbedtls_aria_setkey_enc()
467 aria_rot128( ctx->rk[i + 4], w[i], w2, 128 - 31 ); in mbedtls_aria_setkey_enc()
468 aria_rot128( ctx->rk[i + 8], w[i], w2, 61 ); in mbedtls_aria_setkey_enc()
469 aria_rot128( ctx->rk[i + 12], w[i], w2, 31 ); in mbedtls_aria_setkey_enc()
485 int i, j, k, ret; in mbedtls_aria_setkey_dec() local
494 for( i = 0, j = ctx->nr; i < j; i++, j-- ) in mbedtls_aria_setkey_dec()
498 uint32_t t = ctx->rk[i][k]; in mbedtls_aria_setkey_dec()
499 ctx->rk[i][k] = ctx->rk[j][k]; in mbedtls_aria_setkey_dec()
505 for( i = 1; i < ctx->nr; i++ ) in mbedtls_aria_setkey_dec()
507 aria_a( &ctx->rk[i][0], &ctx->rk[i][1], in mbedtls_aria_setkey_dec()
508 &ctx->rk[i][2], &ctx->rk[i][3] ); in mbedtls_aria_setkey_dec()
521 int i; in mbedtls_aria_crypt_ecb() local
533 i = 0; in mbedtls_aria_crypt_ecb()
536 a ^= ctx->rk[i][0]; in mbedtls_aria_crypt_ecb()
537 b ^= ctx->rk[i][1]; in mbedtls_aria_crypt_ecb()
538 c ^= ctx->rk[i][2]; in mbedtls_aria_crypt_ecb()
539 d ^= ctx->rk[i][3]; in mbedtls_aria_crypt_ecb()
540 i++; in mbedtls_aria_crypt_ecb()
545 a ^= ctx->rk[i][0]; in mbedtls_aria_crypt_ecb()
546 b ^= ctx->rk[i][1]; in mbedtls_aria_crypt_ecb()
547 c ^= ctx->rk[i][2]; in mbedtls_aria_crypt_ecb()
548 d ^= ctx->rk[i][3]; in mbedtls_aria_crypt_ecb()
549 i++; in mbedtls_aria_crypt_ecb()
552 if( i >= ctx->nr ) in mbedtls_aria_crypt_ecb()
558 a ^= ctx->rk[i][0]; in mbedtls_aria_crypt_ecb()
559 b ^= ctx->rk[i][1]; in mbedtls_aria_crypt_ecb()
560 c ^= ctx->rk[i][2]; in mbedtls_aria_crypt_ecb()
561 d ^= ctx->rk[i][3]; in mbedtls_aria_crypt_ecb()
598 int i; in mbedtls_aria_crypt_cbc() local
618 for( i = 0; i < MBEDTLS_ARIA_BLOCKSIZE; i++ ) in mbedtls_aria_crypt_cbc()
619 output[i] = (unsigned char)( output[i] ^ iv[i] ); in mbedtls_aria_crypt_cbc()
632 for( i = 0; i < MBEDTLS_ARIA_BLOCKSIZE; i++ ) in mbedtls_aria_crypt_cbc()
633 output[i] = (unsigned char)( input[i] ^ iv[i] ); in mbedtls_aria_crypt_cbc()
724 int c, i; in mbedtls_aria_crypt_ctr() local
747 for( i = MBEDTLS_ARIA_BLOCKSIZE; i > 0; i-- ) in mbedtls_aria_crypt_ctr()
748 if( ++nonce_counter[i - 1] != 0 ) in mbedtls_aria_crypt_ctr()
913 int i; in mbedtls_aria_self_test() local
933 for( i = 0; i < 3; i++ ) in mbedtls_aria_self_test()
937 mbedtls_printf( " ARIA-ECB-%d (enc): ", 128 + 64 * i ); in mbedtls_aria_self_test()
938 mbedtls_aria_setkey_enc( &ctx, aria_test1_ecb_key, 128 + 64 * i ); in mbedtls_aria_self_test()
940 if( memcmp( blk, aria_test1_ecb_ct[i], MBEDTLS_ARIA_BLOCKSIZE ) != 0 ) in mbedtls_aria_self_test()
945 mbedtls_printf( " ARIA-ECB-%d (dec): ", 128 + 64 * i ); in mbedtls_aria_self_test()
946 mbedtls_aria_setkey_dec( &ctx, aria_test1_ecb_key, 128 + 64 * i ); in mbedtls_aria_self_test()
947 mbedtls_aria_crypt_ecb( &ctx, aria_test1_ecb_ct[i], blk ); in mbedtls_aria_self_test()
958 for( i = 0; i < 3; i++ ) in mbedtls_aria_self_test()
962 mbedtls_printf( " ARIA-CBC-%d (enc): ", 128 + 64 * i ); in mbedtls_aria_self_test()
963 mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i ); in mbedtls_aria_self_test()
968 if( memcmp( buf, aria_test2_cbc_ct[i], 48 ) != 0 ) in mbedtls_aria_self_test()
973 mbedtls_printf( " ARIA-CBC-%d (dec): ", 128 + 64 * i ); in mbedtls_aria_self_test()
974 mbedtls_aria_setkey_dec( &ctx, aria_test2_key, 128 + 64 * i ); in mbedtls_aria_self_test()
978 aria_test2_cbc_ct[i], buf ); in mbedtls_aria_self_test()
988 for( i = 0; i < 3; i++ ) in mbedtls_aria_self_test()
992 mbedtls_printf( " ARIA-CFB-%d (enc): ", 128 + 64 * i ); in mbedtls_aria_self_test()
993 mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i ); in mbedtls_aria_self_test()
999 if( memcmp( buf, aria_test2_cfb_ct[i], 48 ) != 0 ) in mbedtls_aria_self_test()
1004 mbedtls_printf( " ARIA-CFB-%d (dec): ", 128 + 64 * i ); in mbedtls_aria_self_test()
1005 mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i ); in mbedtls_aria_self_test()
1010 iv, aria_test2_cfb_ct[i], buf ); in mbedtls_aria_self_test()
1019 for( i = 0; i < 3; i++ ) in mbedtls_aria_self_test()
1023 mbedtls_printf( " ARIA-CTR-%d (enc): ", 128 + 64 * i ); in mbedtls_aria_self_test()
1024 mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i ); in mbedtls_aria_self_test()
1030 if( memcmp( buf, aria_test2_ctr_ct[i], 48 ) != 0 ) in mbedtls_aria_self_test()
1035 mbedtls_printf( " ARIA-CTR-%d (dec): ", 128 + 64 * i ); in mbedtls_aria_self_test()
1036 mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i ); in mbedtls_aria_self_test()
1041 aria_test2_ctr_ct[i], buf ); in mbedtls_aria_self_test()