Home
last modified time | relevance | path

Searched refs:i (Results 1 – 25 of 219) sorted by relevance

123456789

/mbedtls-3.7.0/library/
Dbignum_core.c55 int i; in mbedtls_mpi_core_bitlen() local
58 for (i = ((int) A_limbs) - 1; i >= 0; i--) { in mbedtls_mpi_core_bitlen()
59 if (A[i] != 0) { in mbedtls_mpi_core_bitlen()
60 j = biL - mbedtls_mpi_core_clz(A[i]); in mbedtls_mpi_core_bitlen()
61 return (i * biL) + j; in mbedtls_mpi_core_bitlen()
123 for (size_t i = 1; i < A_limbs; i++) { in mbedtls_mpi_core_uint_le_mpi() local
124 msll_mask = mbedtls_ct_bool_or(msll_mask, mbedtls_ct_bool(A[i])); in mbedtls_mpi_core_uint_le_mpi()
138 for (size_t i = limbs; i > 0; i--) { in mbedtls_mpi_core_lt_ct() local
146 cond = mbedtls_ct_uint_lt(B[i - 1], A[i - 1]); in mbedtls_mpi_core_lt_ct()
155 cond = mbedtls_ct_uint_lt(A[i - 1], B[i - 1]); in mbedtls_mpi_core_lt_ct()
[all …]
Daria.c325 uint8_t i, j; in aria_rot128() local
333 for (i = 0; i < 4; i++) { in aria_rot128()
339 r[i] = a[i] ^ t; // store in aria_rot128()
358 int i; in mbedtls_aria_setkey_enc() local
381 i = (keybits - 128) >> 6; // index: 0, 1, 2 in mbedtls_aria_setkey_enc()
382 ctx->nr = 12 + 2 * i; // no. rounds: 12, 14, 16 in mbedtls_aria_setkey_enc()
384 aria_fo_xor(w[1], w[0], rc[i], w[1]); // W1 = FO(W0, CK1) ^ KR in mbedtls_aria_setkey_enc()
385 i = i < 2 ? i + 1 : 0; in mbedtls_aria_setkey_enc()
386 aria_fe_xor(w[2], w[1], rc[i], w[0]); // W2 = FE(W1, CK2) ^ W0 in mbedtls_aria_setkey_enc()
387 i = i < 2 ? i + 1 : 0; in mbedtls_aria_setkey_enc()
[all …]
Ddes.c314 int i; in mbedtls_des_key_set_parity() local
316 for (i = 0; i < MBEDTLS_DES_KEY_SIZE; i++) { in mbedtls_des_key_set_parity()
317 key[i] = odd_parity_table[key[i] / 2]; in mbedtls_des_key_set_parity()
326 int i; in mbedtls_des_key_check_key_parity() local
328 for (i = 0; i < MBEDTLS_DES_KEY_SIZE; i++) { in mbedtls_des_key_check_key_parity()
329 if (key[i] != odd_parity_table[key[i] / 2]) { in mbedtls_des_key_check_key_parity()
383 int i; in mbedtls_des_key_check_weak() local
385 for (i = 0; i < WEAK_KEY_COUNT; i++) { in mbedtls_des_key_check_weak()
386 if (memcmp(weak_key_table[i], key, MBEDTLS_DES_KEY_SIZE) == 0) { in mbedtls_des_key_check_weak()
397 int i; in mbedtls_des_setkey() local
[all …]
Dconstant_time.c72 size_t i = 0; in mbedtls_ct_memcmp() local
84 for (; (i + 4) <= n; i += 4) { in mbedtls_ct_memcmp()
85 uint32_t x = mbedtls_get_unaligned_volatile_uint32(A + i); in mbedtls_ct_memcmp()
86 uint32_t y = mbedtls_get_unaligned_volatile_uint32(B + i); in mbedtls_ct_memcmp()
91 for (; i < n; i++) { in mbedtls_ct_memcmp()
95 unsigned char x = A[i], y = B[i]; in mbedtls_ct_memcmp()
134 for (size_t i = 0; i < n; i++) { in mbedtls_ct_memcmp_partial() local
135 unsigned char x = A[i], y = B[i]; in mbedtls_ct_memcmp_partial()
137 mbedtls_ct_condition_t valid = mbedtls_ct_bool_and(mbedtls_ct_uint_ge(i, skip_head), in mbedtls_ct_memcmp_partial()
138 mbedtls_ct_uint_lt(i, valid_end)); in mbedtls_ct_memcmp_partial()
[all …]
Dcamellia.c239 for (i = 1; i <= 4; i++) \
240 if (shifts[(INDEX)][(OFFSET)][i -1]) \
241 ROTL(TK + i * 4, TK, (15 * i) % 32); \
243 for (i = 0; i < 20; i++) \
244 if (indexes[(INDEX)][(OFFSET)][i] != -1) { \
245 RK[indexes[(INDEX)][(OFFSET)][i]] = TK[i]; \
296 size_t i; in mbedtls_camellia_setkey_enc() local
315 for (i = 0; i < keybits / 8; ++i) { in mbedtls_camellia_setkey_enc()
316 t[i] = key[i]; in mbedtls_camellia_setkey_enc()
320 for (i = 0; i < 8; i++) { in mbedtls_camellia_setkey_enc()
[all …]
Dcommon.h191 size_t i = 0; in mbedtls_xor() local
196 for (; (i + 16) <= n; i += 16) { in mbedtls_xor()
197 uint8x16_t v1 = vld1q_u8(a + i); in mbedtls_xor()
198 uint8x16_t v2 = vld1q_u8(b + i); in mbedtls_xor()
200 vst1q_u8(r + i, x); in mbedtls_xor()
213 for (; (i + 8) <= n; i += 8) { in mbedtls_xor()
214 uint64_t x = mbedtls_get_unaligned_uint64(a + i) ^ mbedtls_get_unaligned_uint64(b + i); in mbedtls_xor()
215 mbedtls_put_unaligned_uint64(r + i, x); in mbedtls_xor()
223 for (; (i + 4) <= n; i += 4) { in mbedtls_xor()
224 uint32_t x = mbedtls_get_unaligned_uint32(a + i) ^ mbedtls_get_unaligned_uint32(b + i); in mbedtls_xor()
[all …]
Dgcm.c101 int ret, i, j; in gcm_gen_table() local
137 for (i = MBEDTLS_GCM_HTABLE_SIZE/4; i > 0; i >>= 1) { in gcm_gen_table()
138 gcm_gen_table_rightshift(ctx->H[i], ctx->H[i*2]); in gcm_gen_table()
143 for (i = MBEDTLS_GCM_HTABLE_SIZE/2; i > 0; i >>= 1) { in gcm_gen_table()
144 MBEDTLS_PUT_UINT64_BE(ctx->H[i][0], &ctx->H[i][0], 0); in gcm_gen_table()
145 MBEDTLS_PUT_UINT64_BE(ctx->H[i][1], &ctx->H[i][1], 0); in gcm_gen_table()
149 for (i = 2; i < MBEDTLS_GCM_HTABLE_SIZE; i <<= 1) { in gcm_gen_table()
150 for (j = 1; j < i; j++) { in gcm_gen_table()
151 mbedtls_xor_no_simd((unsigned char *) ctx->H[i+j], in gcm_gen_table()
152 (unsigned char *) ctx->H[i], in gcm_gen_table()
[all …]
Dsha3.c105 int i; in keccak_f1600() local
112 for (i = 0; i < 5; i++) { in keccak_f1600()
113 lane[i] = s[i] ^ s[i + 5] ^ s[i + 10] ^ s[i + 15] ^ s[i + 20]; in keccak_f1600()
115 for (i = 0; i < 5; i++) { in keccak_f1600()
116 t = lane[(i + 4) % 5] ^ ROTR64(lane[(i + 1) % 5], 63); in keccak_f1600()
117 s[i] ^= t; s[i + 5] ^= t; s[i + 10] ^= t; s[i + 15] ^= t; s[i + 20] ^= t; in keccak_f1600()
143 for (i = 1; i < 25; i += 4) { in keccak_f1600()
144 uint32_t r = rho[(i - 1) >> 2]; in keccak_f1600()
146 for (int j = i; j < i + 4; j++) { in keccak_f1600()
152 s[i + 0] = ROTR64(s[i + 0], MBEDTLS_BYTE_3(r)); in keccak_f1600()
[all …]
Dpsa_crypto_se.c58 size_t i; in psa_get_se_driver_entry() local
67 for (i = 0; i < PSA_MAX_SE_DRIVERS; i++) { in psa_get_se_driver_entry()
68 if (driver_table[i].location == location) { in psa_get_se_driver_entry()
69 return &driver_table[i]; in psa_get_se_driver_entry()
261 size_t i; in psa_init_all_se_drivers() local
262 for (i = 0; i < PSA_MAX_SE_DRIVERS; i++) { in psa_init_all_se_drivers()
263 psa_se_drv_table_entry_t *driver = &driver_table[i]; in psa_init_all_se_drivers()
295 size_t i; in psa_register_se_driver() local
313 for (i = 0; i < PSA_MAX_SE_DRIVERS; i++) { in psa_register_se_driver()
314 if (driver_table[i].location == 0) { in psa_register_se_driver()
[all …]
Dsha256.c496 unsigned int i; in mbedtls_internal_sha256_process_c() local
498 for (i = 0; i < 8; i++) { in mbedtls_internal_sha256_process_c()
499 local.A[i] = ctx->state[i]; in mbedtls_internal_sha256_process_c()
503 for (i = 0; i < 64; i++) { in mbedtls_internal_sha256_process_c()
504 if (i < 16) { in mbedtls_internal_sha256_process_c()
505 local.W[i] = MBEDTLS_GET_UINT32_BE(data, 4 * i); in mbedtls_internal_sha256_process_c()
507 R(i); in mbedtls_internal_sha256_process_c()
511 local.A[5], local.A[6], local.A[7], local.W[i], K[i]); in mbedtls_internal_sha256_process_c()
520 for (i = 0; i < 16; i++) { in mbedtls_internal_sha256_process_c()
521 local.W[i] = MBEDTLS_GET_UINT32_BE(data, 4 * i); in mbedtls_internal_sha256_process_c()
[all …]
Dbignum.c89 size_t i = mbedtls_ct_size_if_else_0(X_is_negative, 1); in mbedtls_mpi_lt_mpi_ct() local
90 mbedtls_ct_condition_t lt = mbedtls_mpi_core_lt_ct(p[i], p[i ^ 1], X->n); in mbedtls_mpi_lt_mpi_ct()
133 for (size_t i = Y->n; i < X->n; i++) { in mbedtls_mpi_safe_cond_assign() local
134 X->p[i] = mbedtls_ct_mpi_uint_if_else_0(do_not_assign, X->p[i]); in mbedtls_mpi_safe_cond_assign()
242 size_t i; in mbedtls_mpi_shrink() local
254 for (i = X->n - 1; i > 0; i--) { in mbedtls_mpi_shrink()
255 if (X->p[i] != 0) { in mbedtls_mpi_shrink()
259 i++; in mbedtls_mpi_shrink()
261 if (i < nblimbs) { in mbedtls_mpi_shrink()
262 i = nblimbs; in mbedtls_mpi_shrink()
[all …]
Dbase64.c64 size_t i, n; in mbedtls_base64_encode() local
89 for (i = 0, p = dst; i < n; i += 3) { in mbedtls_base64_encode()
102 if (i < slen) { in mbedtls_base64_encode()
104 C2 = ((i + 1) < slen) ? *src++ : 0; in mbedtls_base64_encode()
110 if ((i + 1) < slen) { in mbedtls_base64_encode()
131 size_t i; /* index in source */ in mbedtls_base64_decode() local
140 for (i = n = 0; i < slen; i++) { in mbedtls_base64_decode()
143 while (i < slen && src[i] == ' ') { in mbedtls_base64_decode()
144 ++i; in mbedtls_base64_decode()
149 if (i == slen) { in mbedtls_base64_decode()
[all …]
Dnist_kw.c115 size_t i = 0; in calc_a_xor_t() local
116 for (i = 0; i < sizeof(t); i++) { in calc_a_xor_t()
117 A[i] ^= (t >> ((sizeof(t) - 1 - i) * 8)) & 0xff; in calc_a_xor_t()
585 int i; in mbedtls_nist_kw_self_test() local
595 for (i = 0; i < num_tests; i++) { in mbedtls_nist_kw_self_test()
597 mbedtls_printf(" KW-AES-%u ", (unsigned int) key_len[i] * 8); in mbedtls_nist_kw_self_test()
601 kw_key[i], key_len[i] * 8, 1); in mbedtls_nist_kw_self_test()
610 ret = mbedtls_nist_kw_wrap(&ctx, MBEDTLS_KW_MODE_KW, kw_msg[i], in mbedtls_nist_kw_self_test()
611 kw_msg_len[i], out, &olen, sizeof(out)); in mbedtls_nist_kw_self_test()
612 if (ret != 0 || kw_out_len[i] != olen || in mbedtls_nist_kw_self_test()
[all …]
Ddebug.c121 size_t i, idx = 0; in mbedtls_debug_print_buf() local
136 for (i = 0; i < len; i++) { in mbedtls_debug_print_buf()
137 if (i >= 4096) { in mbedtls_debug_print_buf()
141 if (i % 16 == 0) { in mbedtls_debug_print_buf()
142 if (i > 0) { in mbedtls_debug_print_buf()
151 (unsigned int) i); in mbedtls_debug_print_buf()
156 (unsigned int) buf[i]); in mbedtls_debug_print_buf()
157 txt[i % 16] = (buf[i] > 31 && buf[i] < 127) ? buf[i] : '.'; in mbedtls_debug_print_buf()
161 for (/* i = i */; i % 16 != 0; i++) { in mbedtls_debug_print_buf()
198 size_t i, idx = 0; in mbedtls_debug_print_ec_coord() local
[all …]
Dsha512.c213 static void sha512_put_uint64_be(uint64_t n, unsigned char *b, uint8_t i) in sha512_put_uint64_be() argument
215 MBEDTLS_PUT_UINT64_BE(n, b, i); in sha512_put_uint64_be()
604 int i; in mbedtls_internal_sha512_process_c() local
630 for (i = 0; i < 8; i++) { in mbedtls_internal_sha512_process_c()
631 local.A[i] = ctx->state[i]; in mbedtls_internal_sha512_process_c()
635 for (i = 0; i < 80; i++) { in mbedtls_internal_sha512_process_c()
636 if (i < 16) { in mbedtls_internal_sha512_process_c()
637 local.W[i] = MBEDTLS_GET_UINT64_BE(data, i << 3); in mbedtls_internal_sha512_process_c()
639 local.W[i] = S1(local.W[i - 2]) + local.W[i - 7] + in mbedtls_internal_sha512_process_c()
640 S0(local.W[i - 15]) + local.W[i - 16]; in mbedtls_internal_sha512_process_c()
[all …]
/mbedtls-3.7.0/tests/suites/
Dtest_suite_common.function6 for (size_t i = 0; i < n; i++) {
7 a[i] = (unsigned char) i * 3;
8 b[i] = (unsigned char) i * 3 + 1;
9 r1[i] = (unsigned char) i * 3 + 2;
10 r2[i] = r1[i];
27 for (size_t i = 0; i < n; i++) {
28 r1[i] = a[i] ^ b[i];
35 for (size_t i = 0; i < n; i++) {
36 r1[i] = r1[i] ^ b[i];
43 for (size_t i = 0; i < n; i++) {
[all …]
Dtest_suite_pkcs7.function68 size_t buflen, i, k, cnt = 0, n_crts = 1;
85 for (i = 0; i < strlen(crt_files); i++) {
86 if (crt_files[i] == ' ') {
94 for (i = 0; i < strlen(crt_files); i++) {
95 for (k = i; k < strlen(crt_files); k++) {
100 TEST_CALLOC(crt_files_arr[cnt], (k-i)+1);
101 crt_files_arr[cnt][k-i] = '\0';
102 memcpy(crt_files_arr[cnt++], crt_files + i, k-i);
103 i = k;
106 for (i = 0; i < n_crts; i++) {
[all …]
Dtest_suite_alignment.function22 for (size_t i = 0; i < olen; i++) {
23 *result |= ((uint64_t) raw[i]) << ((olen - i - 1) * 8);
38 for (size_t i = 0; i < sizeof(raw); i++) {
39 x[i] = (uint8_t) i;
80 for (size_t i = 0; i < (size_t) (size / 8); i++) {
81 x[i + offset] = 0xff;
98 for (size_t i = 0; i < sizeof(x); i++) {
99 TEST_EQUAL(x[i], (uint8_t) i);
132 for (size_t i = 0; i < (size_t) (size / 8); i++) {
133 size_t s1 = i * 8;
[all …]
Dtest_suite_psa_crypto_init.function43 size_t i;
50 for (i = 0; i < *olen; i++) {
51 output[i] = i;
188 int i;
189 for (i = 0; i < count; i++) {
202 int i;
203 for (i = 0; i < count; i++) {
226 for (size_t i = 0; i < thread_count; i++) {
228 mbedtls_test_thread_create(&threads[i],
234 for (size_t i = 0; i < thread_count; i++) {
[all …]
Dtest_suite_constant_time.function181 for (size_t i = 0; i < (size_t) len; i++) {
182 buf[i] = 1;
191 for (size_t i = 0; i < (size_t) len; i++) {
192 TEST_EQUAL(buf[i], c != 0 ? 0 : 1);
253 for (int i = 0; i < size + offset; i++) {
254 a[i] = i & 0xff;
255 if (same == -1 || (i - offset) < same) {
256 b[i] = a[i];
258 b[i] = (i + 1) & 0xff;
308 for (int i = 0; i < size; i++) {
[all …]
/mbedtls-3.7.0/tests/src/
Dpsa_crypto_helpers.c29 size_t i; in mbedtls_test_uses_key_id() local
35 for (i = 0; i < num_key_ids_used; i++) { in mbedtls_test_uses_key_id()
36 if (mbedtls_svc_key_id_equal(key_id, key_ids_used_in_test[i])) { in mbedtls_test_uses_key_id()
50 size_t i; in mbedtls_test_psa_purge_key_storage() local
51 for (i = 0; i < num_key_ids_used; i++) { in mbedtls_test_psa_purge_key_storage()
52 psa_destroy_persistent_key(key_ids_used_in_test[i]); in mbedtls_test_psa_purge_key_storage()
59 size_t i; in mbedtls_test_psa_purge_key_cache() local
60 for (i = 0; i < num_key_ids_used; i++) { in mbedtls_test_psa_purge_key_cache()
61 psa_purge_key(key_ids_used_in_test[i]); in mbedtls_test_psa_purge_key_cache()
155 for (size_t i = 0; i < bin_string->len; i++) { in mbedtls_test_parse_binary_string() local
[all …]
/mbedtls-3.7.0/3rdparty/p256-m/p256-m/
Dp256-m.c72 for (unsigned i = 1; i < 8; i++) { in u256_set32() local
73 z[i] = 0; in u256_set32()
92 for (unsigned i = 0; i < 8; i++) { in u256_add() local
93 uint64_t sum = (uint64_t) carry + x[i] + y[i]; in u256_add()
94 z[i] = (uint32_t) sum; in u256_add()
116 for (unsigned i = 0; i < 8; i++) { in u256_sub() local
117 uint64_t diff = (uint64_t) x[i] - y[i] - carry; in u256_sub()
118 z[i] = (uint32_t) diff; in u256_sub()
137 for (unsigned i = 0; i < 8; i++) { in u256_cmov() local
138 z[i] = (z[i] & ~x_mask) | (x[i] & x_mask); in u256_cmov()
[all …]
/mbedtls-3.7.0/programs/ssl/
Dssl_test_lib.c51 size_t i; in dummy_entropy() local
56 for (i = 0; i < len; i++) { in dummy_entropy()
58 output[i] = (unsigned char) rand(); in dummy_entropy()
232 for (int i = 0; i < 2; i++) { in key_opaque_set_alg_usage() local
233 if (strcmp(algs[i], "rsa-sign-pkcs1") == 0) { in key_opaque_set_alg_usage()
234 *psa_algs[i] = PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_ANY_HASH); in key_opaque_set_alg_usage()
236 } else if (strcmp(algs[i], "rsa-sign-pss") == 0) { in key_opaque_set_alg_usage()
237 *psa_algs[i] = PSA_ALG_RSA_PSS(PSA_ALG_ANY_HASH); in key_opaque_set_alg_usage()
239 } else if (strcmp(algs[i], "rsa-sign-pss-sha256") == 0) { in key_opaque_set_alg_usage()
240 *psa_algs[i] = PSA_ALG_RSA_PSS(PSA_ALG_SHA_256); in key_opaque_set_alg_usage()
[all …]
/mbedtls-3.7.0/programs/hash/
Dgeneric_sum.c45 int i; in generic_print() local
52 for (i = 0; i < mbedtls_md_get_size(md_info); i++) { in generic_print()
53 mbedtls_printf("%02x", sum[i]); in generic_print()
62 int i; in generic_check() local
118 for (i = 0; i < mbedtls_md_get_size(md_info); i++) { in generic_check()
119 sprintf(buf + i * 2, "%02x", sum[i]); in generic_check()
124 for (i = 0; i < 2 * mbedtls_md_get_size(md_info); i++) { in generic_check()
125 diff |= line[i] ^ buf[i]; in generic_check()
153 int ret = 1, i; in main() local
196 for (i = 2; i < argc; i++) { in main()
[all …]
/mbedtls-3.7.0/programs/test/
Dquery_compile_time_config.c29 int i; in main() local
42 for (i = 2; i < argc; i++) { in main()
43 if (query_config(argv[i]) != 0) { in main()
51 for (i = 2; i < argc; i++) { in main()
52 if (query_config(argv[i]) == 0) { in main()
59 for (i = 1; i < argc; i++) { in main()
60 if (query_config(argv[i]) != 0) { in main()

123456789