/mbedtls-3.5.0/tests/suites/ |
D | test_suite_common.function | 6 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 …]
|
D | test_suite_pkcs7.function | 66 size_t buflen, i, k, cnt = 0, n_crts = 1; 80 for (i = 0; i < strlen(crt_files); i++) { 81 if (crt_files[i] == ' ') { 89 for (i = 0; i < strlen(crt_files); i++) { 90 for (k = i; k < strlen(crt_files); k++) { 95 ASSERT_ALLOC(crt_files_arr[cnt], (k-i)+1); 96 crt_files_arr[cnt][k-i] = '\0'; 97 memcpy(crt_files_arr[cnt++], crt_files + i, k-i); 98 i = k; 102 for (i = 0; i < n_crts; i++) { [all …]
|
D | test_suite_alignment.function | 21 for (size_t i = 0; i < olen; i++) { 23 *result |= ((uint64_t) raw[i]) << (i * 8); 25 *result |= ((uint64_t) raw[i]) << ((olen - i - 1) * 8); 41 for (size_t i = 0; i < sizeof(raw); i++) { 42 x[i] = (uint8_t) i; 62 for (uint8_t i = 0; i < 8; i++) { 69 shift = 7 - (i * 8); 79 shift = i * 8; 81 uint64_t b = offset + i; 98 for (size_t i = 0; i < (size_t) (size / 8); i++) { [all …]
|
D | test_suite_constant_time.function | 42 for (int i = 0; i < size + offset; i++) { 43 a[i] = i & 0xff; 44 if (same == -1 || (i - offset) < same) { 45 b[i] = a[i]; 47 b[i] = (i + 1) & 0xff; 77 for (int i = 0; i < size + offset; i++) { 78 src[i] = 1; 79 result[i] = 0xff; 80 expected[i] = eq ? 1 : 0xff; 96 for (int i = 0; i < size + offset; i++) { [all …]
|
/mbedtls-3.5.0/library/ |
D | bignum_core.c | 54 size_t i, j; in mbedtls_mpi_core_bitlen() local 60 for (i = A_limbs - 1; i > 0; i--) { in mbedtls_mpi_core_bitlen() 61 if (A[i] != 0) { in mbedtls_mpi_core_bitlen() 66 j = biL - mbedtls_mpi_core_clz(A[i]); in mbedtls_mpi_core_bitlen() 68 return (i * biL) + j; in mbedtls_mpi_core_bitlen() 75 uint8_t i; in mpi_bigendian_to_host_c() local 79 for (i = 0, a_ptr = (unsigned char *) &a; i < ciL; i++, a_ptr++) { in mpi_bigendian_to_host_c() 147 for (size_t i = 1; i < A_limbs; i++) { in mbedtls_mpi_core_uint_le_mpi() local 148 msll_mask |= A[i]; in mbedtls_mpi_core_uint_le_mpi() 182 for (size_t i = 0; i < limbs; i++) { in mbedtls_mpi_core_cond_swap() local [all …]
|
D | des.c | 326 int i; in mbedtls_des_key_set_parity() local 328 for (i = 0; i < MBEDTLS_DES_KEY_SIZE; i++) { in mbedtls_des_key_set_parity() 329 key[i] = odd_parity_table[key[i] / 2]; in mbedtls_des_key_set_parity() 338 int i; in mbedtls_des_key_check_key_parity() local 340 for (i = 0; i < MBEDTLS_DES_KEY_SIZE; i++) { in mbedtls_des_key_check_key_parity() 341 if (key[i] != odd_parity_table[key[i] / 2]) { in mbedtls_des_key_check_key_parity() 395 int i; in mbedtls_des_key_check_weak() local 397 for (i = 0; i < WEAK_KEY_COUNT; i++) { in mbedtls_des_key_check_weak() 398 if (memcmp(weak_key_table[i], key, MBEDTLS_DES_KEY_SIZE) == 0) { in mbedtls_des_key_check_weak() 409 int i; in mbedtls_des_setkey() local [all …]
|
D | camellia.c | 251 for (i = 1; i <= 4; i++) \ 252 if (shifts[(INDEX)][(OFFSET)][i -1]) \ 253 ROTL(TK + i * 4, TK, (15 * i) % 32); \ 255 for (i = 0; i < 20; i++) \ 256 if (indexes[(INDEX)][(OFFSET)][i] != -1) { \ 257 RK[indexes[(INDEX)][(OFFSET)][i]] = TK[i]; \ 308 size_t i; in mbedtls_camellia_setkey_enc() local 327 for (i = 0; i < keybits / 8; ++i) { in mbedtls_camellia_setkey_enc() 328 t[i] = key[i]; in mbedtls_camellia_setkey_enc() 332 for (i = 0; i < 8; i++) { in mbedtls_camellia_setkey_enc() [all …]
|
D | aria.c | 343 uint8_t i, j; in aria_rot128() local 351 for (i = 0; i < 4; i++) { in aria_rot128() 357 r[i] = a[i] ^ t; // store in aria_rot128() 376 int i; in mbedtls_aria_setkey_enc() local 401 i = (keybits - 128) >> 6; // index: 0, 1, 2 in mbedtls_aria_setkey_enc() 402 ctx->nr = 12 + 2 * i; // no. rounds: 12, 14, 16 in mbedtls_aria_setkey_enc() 404 aria_fo_xor(w[1], w[0], rc[i], w[1]); // W1 = FO(W0, CK1) ^ KR in mbedtls_aria_setkey_enc() 405 i = i < 2 ? i + 1 : 0; in mbedtls_aria_setkey_enc() 406 aria_fe_xor(w[2], w[1], rc[i], w[0]); // W2 = FE(W1, CK2) ^ W0 in mbedtls_aria_setkey_enc() 407 i = i < 2 ? i + 1 : 0; in mbedtls_aria_setkey_enc() [all …]
|
D | gcm.c | 69 int ret, i, j; in gcm_gen_table() local 110 for (i = 4; i > 0; i >>= 1) { in gcm_gen_table() 115 ctx->HL[i] = vl; in gcm_gen_table() 116 ctx->HH[i] = vh; in gcm_gen_table() 119 for (i = 2; i <= 8; i *= 2) { in gcm_gen_table() 120 uint64_t *HiL = ctx->HL + i, *HiH = ctx->HH + i; in gcm_gen_table() 123 for (j = 1; j < i; j++) { in gcm_gen_table() 192 int i = 0; in gcm_mult() local 231 for (i = 15; i >= 0; i--) { in gcm_mult() 232 lo = x[i] & 0xf; in gcm_mult() [all …]
|
D | constant_time.c | 92 size_t i = 0; in mbedtls_ct_memcmp() local 104 for (; (i + 4) <= n; i += 4) { in mbedtls_ct_memcmp() 105 uint32_t x = mbedtls_get_unaligned_volatile_uint32(A + i); in mbedtls_ct_memcmp() 106 uint32_t y = mbedtls_get_unaligned_volatile_uint32(B + i); in mbedtls_ct_memcmp() 111 for (; i < n; i++) { in mbedtls_ct_memcmp() 115 unsigned char x = A[i], y = B[i]; in mbedtls_ct_memcmp() 358 size_t i; in mbedtls_ct_mpi_uint_cond_assign() local 374 for (i = 0; i < n; i++) { in mbedtls_ct_mpi_uint_cond_assign() 375 dest[i] = (src[i] & mask) | (dest[i] & ~mask); in mbedtls_ct_mpi_uint_cond_assign() 439 size_t i, n; in mbedtls_ct_mem_move_to_left() local [all …]
|
D | base64.c | 42 size_t i, n; in mbedtls_base64_encode() local 67 for (i = 0, p = dst; i < n; i += 3) { in mbedtls_base64_encode() 80 if (i < slen) { in mbedtls_base64_encode() 82 C2 = ((i + 1) < slen) ? *src++ : 0; in mbedtls_base64_encode() 88 if ((i + 1) < slen) { in mbedtls_base64_encode() 109 size_t i; /* index in source */ in mbedtls_base64_decode() local 118 for (i = n = 0; i < slen; i++) { in mbedtls_base64_decode() 121 while (i < slen && src[i] == ' ') { in mbedtls_base64_decode() 122 ++i; in mbedtls_base64_decode() 127 if (i == slen) { in mbedtls_base64_decode() [all …]
|
D | nist_kw.c | 126 size_t i = 0; in calc_a_xor_t() local 127 for (i = 0; i < sizeof(t); i++) { in calc_a_xor_t() 128 A[i] ^= (t >> ((sizeof(t) - 1 - i) * 8)) & 0xff; in calc_a_xor_t() 336 size_t i, olen; in mbedtls_nist_kw_unwrap() local 429 for (diff = 0, i = 0; i < KW_SEMIBLOCK_LENGTH; i++) { in mbedtls_nist_kw_unwrap() 430 if (i >= KW_SEMIBLOCK_LENGTH - padlen) { in mbedtls_nist_kw_unwrap() 431 diff |= output[*out_len - KW_SEMIBLOCK_LENGTH + i]; in mbedtls_nist_kw_unwrap() 433 bad_padding |= output[*out_len - KW_SEMIBLOCK_LENGTH + i]; in mbedtls_nist_kw_unwrap() 561 int i; in mbedtls_nist_kw_self_test() local 565 for (i = 0; i < KW_TESTS; i++) { in mbedtls_nist_kw_self_test() [all …]
|
D | psa_crypto_se.c | 70 size_t i; in psa_get_se_driver_entry() local 79 for (i = 0; i < PSA_MAX_SE_DRIVERS; i++) { in psa_get_se_driver_entry() 80 if (driver_table[i].location == location) { in psa_get_se_driver_entry() 81 return &driver_table[i]; in psa_get_se_driver_entry() 273 size_t i; in psa_init_all_se_drivers() local 274 for (i = 0; i < PSA_MAX_SE_DRIVERS; i++) { in psa_init_all_se_drivers() 275 psa_se_drv_table_entry_t *driver = &driver_table[i]; in psa_init_all_se_drivers() 307 size_t i; in psa_register_se_driver() local 325 for (i = 0; i < PSA_MAX_SE_DRIVERS; i++) { in psa_register_se_driver() 326 if (driver_table[i].location == 0) { in psa_register_se_driver() [all …]
|
D | bignum.c | 133 size_t i; in mbedtls_mpi_shrink() local 146 for (i = X->n - 1; i > 0; i--) { in mbedtls_mpi_shrink() 147 if (X->p[i] != 0) { in mbedtls_mpi_shrink() 151 i++; in mbedtls_mpi_shrink() 153 if (i < nblimbs) { in mbedtls_mpi_shrink() 154 i = nblimbs; in mbedtls_mpi_shrink() 157 if ((p = (mbedtls_mpi_uint *) mbedtls_calloc(i, ciL)) == NULL) { in mbedtls_mpi_shrink() 162 memcpy(p, X->p, i * ciL); in mbedtls_mpi_shrink() 167 X->n = i; in mbedtls_mpi_shrink() 201 size_t i; in mbedtls_mpi_copy() local [all …]
|
D | sha256.c | 463 unsigned int i; in mbedtls_internal_sha256_process_c() local 465 for (i = 0; i < 8; i++) { in mbedtls_internal_sha256_process_c() 466 local.A[i] = ctx->state[i]; in mbedtls_internal_sha256_process_c() 470 for (i = 0; i < 64; i++) { in mbedtls_internal_sha256_process_c() 471 if (i < 16) { in mbedtls_internal_sha256_process_c() 472 local.W[i] = MBEDTLS_GET_UINT32_BE(data, 4 * i); in mbedtls_internal_sha256_process_c() 474 R(i); in mbedtls_internal_sha256_process_c() 478 local.A[5], local.A[6], local.A[7], local.W[i], K[i]); in mbedtls_internal_sha256_process_c() 487 for (i = 0; i < 16; i++) { in mbedtls_internal_sha256_process_c() 488 local.W[i] = MBEDTLS_GET_UINT32_BE(data, 4 * i); in mbedtls_internal_sha256_process_c() [all …]
|
D | pkcs12.c | 101 size_t i; in pkcs12_pbe_derive_key_iv() local 116 for (i = 0; i < pwdlen; i++) { in pkcs12_pbe_derive_key_iv() 117 unipwd[i * 2 + 1] = pwd[i]; in pkcs12_pbe_derive_key_iv() 239 size_t i; in calculate_hashes() local 278 for (i = 1; i < (size_t) iterations; i++) { in calculate_hashes() 293 size_t i, out_len, out_size = PSA_HASH_LENGTH(alg); in calculate_hashes() 326 for (i = 1; i < (size_t) iterations; i++) { in calculate_hashes() 359 size_t hlen, use_len, v, i; in mbedtls_pkcs12_derivation() local 416 for (i = v; i > 0; i--) { in mbedtls_pkcs12_derivation() 417 if (++hash_block[i - 1] != 0) { in mbedtls_pkcs12_derivation() [all …]
|
D | ccm.c | 145 unsigned char i; in ccm_calculate_first_block_if_ready() local 182 for (i = 0, len_left = ctx->plaintext_len; i < ctx->q; i++, len_left >>= 8) { in ccm_calculate_first_block_if_ready() 183 ctx->y[15-i] = MBEDTLS_BYTE_0(len_left); in ccm_calculate_first_block_if_ready() 335 unsigned char i; in mbedtls_ccm_update() local 415 for (i = 0; i < ctx->q; i++) { in mbedtls_ccm_update() 416 if (++(ctx->ctr)[15-i] != 0) { in mbedtls_ccm_update() 437 unsigned char i; in mbedtls_ccm_finish() local 454 for (i = 0; i < ctx->q; i++) { in mbedtls_ccm_finish() 455 ctx->ctr[15-i] = 0; in mbedtls_ccm_finish() 536 unsigned char i; in mbedtls_ccm_compare_tags() local [all …]
|
D | sha512.c | 211 static void sha512_put_uint64_be(uint64_t n, unsigned char *b, uint8_t i) in sha512_put_uint64_be() argument 213 MBEDTLS_PUT_UINT64_BE(n, b, i); in sha512_put_uint64_be() 602 int i; in mbedtls_internal_sha512_process_c() local 628 for (i = 0; i < 8; i++) { in mbedtls_internal_sha512_process_c() 629 local.A[i] = ctx->state[i]; in mbedtls_internal_sha512_process_c() 633 for (i = 0; i < 80; i++) { in mbedtls_internal_sha512_process_c() 634 if (i < 16) { in mbedtls_internal_sha512_process_c() 635 local.W[i] = MBEDTLS_GET_UINT64_BE(data, i << 3); in mbedtls_internal_sha512_process_c() 637 local.W[i] = S1(local.W[i - 2]) + local.W[i - 7] + in mbedtls_internal_sha512_process_c() 638 S0(local.W[i - 15]) + local.W[i - 16]; in mbedtls_internal_sha512_process_c() [all …]
|
/mbedtls-3.5.0/programs/hash/ |
D | generic_sum.c | 57 int i; in generic_print() local 64 for (i = 0; i < mbedtls_md_get_size(md_info); i++) { in generic_print() 65 mbedtls_printf("%02x", sum[i]); in generic_print() 74 int i; in generic_check() local 130 for (i = 0; i < mbedtls_md_get_size(md_info); i++) { in generic_check() 131 sprintf(buf + i * 2, "%02x", sum[i]); in generic_check() 136 for (i = 0; i < 2 * mbedtls_md_get_size(md_info); i++) { in generic_check() 137 diff |= line[i] ^ buf[i]; in generic_check() 165 int ret = 1, i; in main() local 208 for (i = 2; i < argc; i++) { in main() [all …]
|
/mbedtls-3.5.0/programs/test/ |
D | query_compile_time_config.c | 41 int i; in main() local 54 for (i = 2; i < argc; i++) { in main() 55 if (query_config(argv[i]) != 0) { in main() 63 for (i = 2; i < argc; i++) { in main() 64 if (query_config(argv[i]) == 0) { in main() 71 for (i = 1; i < argc; i++) { in main() 72 if (query_config(argv[i]) != 0) { in main()
|
/mbedtls-3.5.0/tests/src/ |
D | psa_crypto_helpers.c | 41 size_t i; in mbedtls_test_uses_key_id() local 47 for (i = 0; i < num_key_ids_used; i++) { in mbedtls_test_uses_key_id() 48 if (mbedtls_svc_key_id_equal(key_id, key_ids_used_in_test[i])) { in mbedtls_test_uses_key_id() 62 size_t i; in mbedtls_test_psa_purge_key_storage() local 63 for (i = 0; i < num_key_ids_used; i++) { in mbedtls_test_psa_purge_key_storage() 64 psa_destroy_persistent_key(key_ids_used_in_test[i]); in mbedtls_test_psa_purge_key_storage() 71 size_t i; in mbedtls_test_psa_purge_key_cache() local 72 for (i = 0; i < num_key_ids_used; i++) { in mbedtls_test_psa_purge_key_cache() 73 psa_purge_key(key_ids_used_in_test[i]); in mbedtls_test_psa_purge_key_cache()
|
/mbedtls-3.5.0/programs/ssl/ |
D | ssl_test_lib.c | 62 size_t i; in dummy_entropy() local 67 for (i = 0; i < len; i++) { in dummy_entropy() 69 output[i] = (unsigned char) rand(); in dummy_entropy() 243 for (int i = 0; i < 2; i++) { in key_opaque_set_alg_usage() local 244 if (strcmp(algs[i], "rsa-sign-pkcs1") == 0) { in key_opaque_set_alg_usage() 245 *psa_algs[i] = PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_ANY_HASH); in key_opaque_set_alg_usage() 247 } else if (strcmp(algs[i], "rsa-sign-pss") == 0) { in key_opaque_set_alg_usage() 248 *psa_algs[i] = PSA_ALG_RSA_PSS(PSA_ALG_ANY_HASH); in key_opaque_set_alg_usage() 250 } else if (strcmp(algs[i], "rsa-sign-pss-sha256") == 0) { in key_opaque_set_alg_usage() 251 *psa_algs[i] = PSA_ALG_RSA_PSS(PSA_ALG_SHA_256); in key_opaque_set_alg_usage() [all …]
|
/mbedtls-3.5.0/3rdparty/everest/library/ |
D | Hacl_Curve25519.c | 43 uint32_t i; in Hacl_Bignum_Fproduct_copy_from_wide_() local 44 for (i = (uint32_t)0U; i < (uint32_t)5U; i = i + (uint32_t)1U) in Hacl_Bignum_Fproduct_copy_from_wide_() 46 uint128_t xi = input[i]; in Hacl_Bignum_Fproduct_copy_from_wide_() 47 output[i] = (uint64_t)xi; in Hacl_Bignum_Fproduct_copy_from_wide_() 54 uint32_t i; in Hacl_Bignum_Fproduct_sum_scalar_multiplication_() local 55 for (i = (uint32_t)0U; i < (uint32_t)5U; i = i + (uint32_t)1U) in Hacl_Bignum_Fproduct_sum_scalar_multiplication_() 57 uint128_t xi = output[i]; in Hacl_Bignum_Fproduct_sum_scalar_multiplication_() 58 uint64_t yi = input[i]; in Hacl_Bignum_Fproduct_sum_scalar_multiplication_() 59 output[i] = xi + (uint128_t)yi * s; in Hacl_Bignum_Fproduct_sum_scalar_multiplication_() 65 uint32_t i; in Hacl_Bignum_Fproduct_carry_wide_() local [all …]
|
/mbedtls-3.5.0/3rdparty/everest/library/legacy/ |
D | Hacl_Curve25519.c | 47 uint32_t i; in Hacl_Bignum_Fproduct_copy_from_wide_() local 48 for (i = (uint32_t)0U; i < (uint32_t)5U; i = i + (uint32_t)1U) in Hacl_Bignum_Fproduct_copy_from_wide_() 50 FStar_UInt128_uint128 xi = input[i]; in Hacl_Bignum_Fproduct_copy_from_wide_() 51 output[i] = FStar_UInt128_uint128_to_uint64(xi); in Hacl_Bignum_Fproduct_copy_from_wide_() 62 uint32_t i; in Hacl_Bignum_Fproduct_sum_scalar_multiplication_() local 63 for (i = (uint32_t)0U; i < (uint32_t)5U; i = i + (uint32_t)1U) in Hacl_Bignum_Fproduct_sum_scalar_multiplication_() 65 FStar_UInt128_uint128 xi = output[i]; in Hacl_Bignum_Fproduct_sum_scalar_multiplication_() 66 uint64_t yi = input[i]; in Hacl_Bignum_Fproduct_sum_scalar_multiplication_() 67 output[i] = FStar_UInt128_add_mod(xi, FStar_UInt128_mul_wide(yi, s)); in Hacl_Bignum_Fproduct_sum_scalar_multiplication_() 73 uint32_t i; in Hacl_Bignum_Fproduct_carry_wide_() local [all …]
|
/mbedtls-3.5.0/tests/scripts/ |
D | generate_pkcs7_tests.py | 72 i = 0 73 while i < len(lines): 74 if "depends" in lines[i+1]: 75 tests.append(Test(lines[i], lines[i+1], lines[i+2])) 76 i += 3 78 tests.append(Test(lines[i], None, lines[i+1])) 79 i += 2 119 i = 0 120 while i < len(data): 121 tag_i = i [all …]
|