Lines Matching refs:i

62 #define GET_UINT32_LE( n, b, i )                \  argument
64 (n) = ( (uint32_t) (b)[(i) ] ) \
65 | ( (uint32_t) (b)[(i) + 1] << 8 ) \
66 | ( (uint32_t) (b)[(i) + 2] << 16 ) \
67 | ( (uint32_t) (b)[(i) + 3] << 24 ); \
72 #define PUT_UINT32_LE( n, b, i ) \ argument
74 (b)[(i) ] = (unsigned char) ( ( (n) ) & 0xFF ); \
75 (b)[(i) + 1] = (unsigned char) ( ( (n) >> 8 ) & 0xFF ); \
76 (b)[(i) + 2] = (unsigned char) ( ( (n) >> 16 ) & 0xFF ); \
77 (b)[(i) + 3] = (unsigned char) ( ( (n) >> 24 ) & 0xFF ); \
416 uint8_t i, j; in aria_rot128() local
424 for( i = 0; i < 4; i++ ) in aria_rot128()
431 r[i] = a[i] ^ t; // store in aria_rot128()
450 int i; in mbedtls_aria_setkey_enc() local
476 i = ( keybits - 128 ) >> 6; // index: 0, 1, 2 in mbedtls_aria_setkey_enc()
477 ctx->nr = 12 + 2 * i; // no. rounds: 12, 14, 16 in mbedtls_aria_setkey_enc()
479 aria_fo_xor( w[1], w[0], rc[i], w[1] ); // W1 = FO(W0, CK1) ^ KR in mbedtls_aria_setkey_enc()
480 i = i < 2 ? i + 1 : 0; in mbedtls_aria_setkey_enc()
481 aria_fe_xor( w[2], w[1], rc[i], w[0] ); // W2 = FE(W1, CK2) ^ W0 in mbedtls_aria_setkey_enc()
482 i = i < 2 ? i + 1 : 0; in mbedtls_aria_setkey_enc()
483 aria_fo_xor( w[3], w[2], rc[i], w[1] ); // W3 = FO(W2, CK3) ^ W1 in mbedtls_aria_setkey_enc()
485 for( i = 0; i < 4; i++ ) // create round keys in mbedtls_aria_setkey_enc()
487 w2 = w[(i + 1) & 3]; in mbedtls_aria_setkey_enc()
488 aria_rot128( ctx->rk[i ], w[i], w2, 128 - 19 ); in mbedtls_aria_setkey_enc()
489 aria_rot128( ctx->rk[i + 4], w[i], w2, 128 - 31 ); in mbedtls_aria_setkey_enc()
490 aria_rot128( ctx->rk[i + 8], w[i], w2, 61 ); in mbedtls_aria_setkey_enc()
491 aria_rot128( ctx->rk[i + 12], w[i], w2, 31 ); in mbedtls_aria_setkey_enc()
507 int i, j, k, ret; in mbedtls_aria_setkey_dec() local
516 for( i = 0, j = ctx->nr; i < j; i++, j-- ) in mbedtls_aria_setkey_dec()
520 uint32_t t = ctx->rk[i][k]; in mbedtls_aria_setkey_dec()
521 ctx->rk[i][k] = ctx->rk[j][k]; in mbedtls_aria_setkey_dec()
527 for( i = 1; i < ctx->nr; i++ ) in mbedtls_aria_setkey_dec()
529 aria_a( &ctx->rk[i][0], &ctx->rk[i][1], in mbedtls_aria_setkey_dec()
530 &ctx->rk[i][2], &ctx->rk[i][3] ); in mbedtls_aria_setkey_dec()
543 int i; in mbedtls_aria_crypt_ecb() local
555 i = 0; 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()
562 i++; in mbedtls_aria_crypt_ecb()
567 a ^= ctx->rk[i][0]; in mbedtls_aria_crypt_ecb()
568 b ^= ctx->rk[i][1]; in mbedtls_aria_crypt_ecb()
569 c ^= ctx->rk[i][2]; in mbedtls_aria_crypt_ecb()
570 d ^= ctx->rk[i][3]; in mbedtls_aria_crypt_ecb()
571 i++; in mbedtls_aria_crypt_ecb()
574 if( i >= ctx->nr ) in mbedtls_aria_crypt_ecb()
580 a ^= ctx->rk[i][0]; in mbedtls_aria_crypt_ecb()
581 b ^= ctx->rk[i][1]; in mbedtls_aria_crypt_ecb()
582 c ^= ctx->rk[i][2]; in mbedtls_aria_crypt_ecb()
583 d ^= ctx->rk[i][3]; in mbedtls_aria_crypt_ecb()
620 int i; in mbedtls_aria_crypt_cbc() local
640 for( i = 0; i < MBEDTLS_ARIA_BLOCKSIZE; i++ ) in mbedtls_aria_crypt_cbc()
641 output[i] = (unsigned char)( output[i] ^ iv[i] ); in mbedtls_aria_crypt_cbc()
654 for( i = 0; i < MBEDTLS_ARIA_BLOCKSIZE; i++ ) in mbedtls_aria_crypt_cbc()
655 output[i] = (unsigned char)( input[i] ^ iv[i] ); in mbedtls_aria_crypt_cbc()
746 int c, i; in mbedtls_aria_crypt_ctr() local
769 for( i = MBEDTLS_ARIA_BLOCKSIZE; i > 0; i-- ) in mbedtls_aria_crypt_ctr()
770 if( ++nonce_counter[i - 1] != 0 ) in mbedtls_aria_crypt_ctr()
935 int i; in mbedtls_aria_self_test() local
955 for( i = 0; i < 3; i++ ) in mbedtls_aria_self_test()
959 mbedtls_printf( " ARIA-ECB-%d (enc): ", 128 + 64 * i ); in mbedtls_aria_self_test()
960 mbedtls_aria_setkey_enc( &ctx, aria_test1_ecb_key, 128 + 64 * i ); in mbedtls_aria_self_test()
962 if( memcmp( blk, aria_test1_ecb_ct[i], MBEDTLS_ARIA_BLOCKSIZE ) != 0 ) in mbedtls_aria_self_test()
967 mbedtls_printf( " ARIA-ECB-%d (dec): ", 128 + 64 * i ); in mbedtls_aria_self_test()
968 mbedtls_aria_setkey_dec( &ctx, aria_test1_ecb_key, 128 + 64 * i ); in mbedtls_aria_self_test()
969 mbedtls_aria_crypt_ecb( &ctx, aria_test1_ecb_ct[i], blk ); in mbedtls_aria_self_test()
980 for( i = 0; i < 3; i++ ) in mbedtls_aria_self_test()
984 mbedtls_printf( " ARIA-CBC-%d (enc): ", 128 + 64 * i ); in mbedtls_aria_self_test()
985 mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i ); in mbedtls_aria_self_test()
990 if( memcmp( buf, aria_test2_cbc_ct[i], 48 ) != 0 ) in mbedtls_aria_self_test()
995 mbedtls_printf( " ARIA-CBC-%d (dec): ", 128 + 64 * i ); in mbedtls_aria_self_test()
996 mbedtls_aria_setkey_dec( &ctx, aria_test2_key, 128 + 64 * i ); in mbedtls_aria_self_test()
1000 aria_test2_cbc_ct[i], buf ); in mbedtls_aria_self_test()
1010 for( i = 0; i < 3; i++ ) in mbedtls_aria_self_test()
1014 mbedtls_printf( " ARIA-CFB-%d (enc): ", 128 + 64 * i ); in mbedtls_aria_self_test()
1015 mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i ); in mbedtls_aria_self_test()
1021 if( memcmp( buf, aria_test2_cfb_ct[i], 48 ) != 0 ) in mbedtls_aria_self_test()
1026 mbedtls_printf( " ARIA-CFB-%d (dec): ", 128 + 64 * i ); in mbedtls_aria_self_test()
1027 mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i ); in mbedtls_aria_self_test()
1032 iv, aria_test2_cfb_ct[i], buf ); in mbedtls_aria_self_test()
1041 for( i = 0; i < 3; i++ ) in mbedtls_aria_self_test()
1045 mbedtls_printf( " ARIA-CTR-%d (enc): ", 128 + 64 * i ); in mbedtls_aria_self_test()
1046 mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i ); in mbedtls_aria_self_test()
1052 if( memcmp( buf, aria_test2_ctr_ct[i], 48 ) != 0 ) in mbedtls_aria_self_test()
1057 mbedtls_printf( " ARIA-CTR-%d (dec): ", 128 + 64 * i ); in mbedtls_aria_self_test()
1058 mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i ); in mbedtls_aria_self_test()
1063 aria_test2_ctr_ct[i], buf ); in mbedtls_aria_self_test()