/mbedtls-3.4.0/library/ |
D | des.c | 316 int i; in mbedtls_des_key_set_parity() local 318 for( i = 0; i < MBEDTLS_DES_KEY_SIZE; i++ ) in mbedtls_des_key_set_parity() 319 key[i] = odd_parity_table[key[i] / 2]; in mbedtls_des_key_set_parity() 327 int i; in mbedtls_des_key_check_key_parity() local 329 for( i = 0; i < MBEDTLS_DES_KEY_SIZE; i++ ) in mbedtls_des_key_check_key_parity() 330 if( key[i] != odd_parity_table[key[i] / 2] ) in mbedtls_des_key_check_key_parity() 382 int i; in mbedtls_des_key_check_weak() local 384 for( i = 0; i < WEAK_KEY_COUNT; i++ ) in mbedtls_des_key_check_weak() 385 if( memcmp( weak_key_table[i], key, MBEDTLS_DES_KEY_SIZE) == 0 ) in mbedtls_des_key_check_weak() 394 int i; in mbedtls_des_setkey() local [all …]
|
D | gcm.c | 65 int ret, i, j; in gcm_gen_table() local 98 for( i = 4; i > 0; i >>= 1 ) in gcm_gen_table() 104 ctx->HL[i] = vl; in gcm_gen_table() 105 ctx->HH[i] = vh; in gcm_gen_table() 108 for( i = 2; i <= 8; i *= 2 ) in gcm_gen_table() 110 uint64_t *HiL = ctx->HL + i, *HiH = ctx->HH + i; in gcm_gen_table() 113 for( j = 1; j < i; j++ ) in gcm_gen_table() 179 int i = 0; in gcm_mult() local 202 for( i = 15; i >= 0; i-- ) in gcm_mult() 204 lo = x[i] & 0xf; in gcm_mult() [all …]
|
D | bignum_core.c | 53 size_t i, j; in mbedtls_mpi_core_bitlen() local 58 for( i = A_limbs - 1; i > 0; i-- ) in mbedtls_mpi_core_bitlen() 59 if( A[i] != 0 ) in mbedtls_mpi_core_bitlen() 62 j = biL - mbedtls_mpi_core_clz( A[i] ); in mbedtls_mpi_core_bitlen() 64 return( ( i * biL ) + j ); in mbedtls_mpi_core_bitlen() 71 uint8_t i; in mpi_bigendian_to_host_c() local 75 for( i = 0, a_ptr = (unsigned char *) &a; i < ciL; i++, a_ptr++ ) in mpi_bigendian_to_host_c() 179 for( size_t i = 0; i < limbs; i++ ) in mbedtls_mpi_core_cond_swap() local 181 mbedtls_mpi_uint tmp = X[i]; in mbedtls_mpi_core_cond_swap() 182 X[i] = ( X[i] & ~limb_mask ) | ( Y[i] & limb_mask ); in mbedtls_mpi_core_cond_swap() [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 ]; \ 307 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() 331 for( i = 0; i < 8; i++ ) in mbedtls_camellia_setkey_enc() [all …]
|
D | aria.c | 382 uint8_t i, j; in aria_rot128() local 390 for( i = 0; i < 4; i++ ) in aria_rot128() 397 r[i] = a[i] ^ t; // store in aria_rot128() 416 int i; in mbedtls_aria_setkey_enc() local 442 i = ( keybits - 128 ) >> 6; // index: 0, 1, 2 in mbedtls_aria_setkey_enc() 443 ctx->nr = 12 + 2 * i; // no. rounds: 12, 14, 16 in mbedtls_aria_setkey_enc() 445 aria_fo_xor( w[1], w[0], rc[i], w[1] ); // W1 = FO(W0, CK1) ^ KR in mbedtls_aria_setkey_enc() 446 i = i < 2 ? i + 1 : 0; in mbedtls_aria_setkey_enc() 447 aria_fe_xor( w[2], w[1], rc[i], w[0] ); // W2 = FE(W1, CK2) ^ W0 in mbedtls_aria_setkey_enc() 448 i = i < 2 ? i + 1 : 0; in mbedtls_aria_setkey_enc() [all …]
|
D | chacha20.c | 119 size_t i; in chacha20_block() local 125 for( i = 0U; i < 10U; i++ ) in chacha20_block() 145 for( i = 0U; i < 16; i++ ) in chacha20_block() 147 size_t offset = i * 4U; in chacha20_block() 149 MBEDTLS_PUT_UINT32_LE(working_state[i], keystream, offset); in chacha20_block() 220 size_t i; in mbedtls_chacha20_update() local 240 for( i = 0U; i < 64U; i += 8U ) in mbedtls_chacha20_update() 242 output[offset + i ] = input[offset + i ] ^ ctx->keystream8[i ]; in mbedtls_chacha20_update() 243 output[offset + i+1] = input[offset + i+1] ^ ctx->keystream8[i+1]; in mbedtls_chacha20_update() 244 output[offset + i+2] = input[offset + i+2] ^ ctx->keystream8[i+2]; in mbedtls_chacha20_update() [all …]
|
D | constant_time.c | 54 size_t i; in mbedtls_ct_memcmp() local 59 for( i = 0; i < n; i++ ) in mbedtls_ct_memcmp() 64 unsigned char x = A[i], y = B[i]; in mbedtls_ct_memcmp() 307 size_t i; in mbedtls_ct_mpi_uint_cond_assign() local 323 for( i = 0; i < n; i++ ) in mbedtls_ct_mpi_uint_cond_assign() 324 dest[i] = ( src[i] & mask ) | ( dest[i] & ~mask ); in mbedtls_ct_mpi_uint_cond_assign() 387 size_t i, n; in mbedtls_ct_mem_move_to_left() local 390 for( i = 0; i < total; i++ ) in mbedtls_ct_mem_move_to_left() 392 unsigned no_op = mbedtls_ct_size_gt( total - offset, i ); in mbedtls_ct_mem_move_to_left() 421 for( size_t i = 0; i < len; i++ ) in mbedtls_ct_memcpy_if_eq() local [all …]
|
D | ccm.c | 115 size_t i; in mbedtls_ccm_crypt() local 128 for( i = 0; i < use_len; i++ ) in mbedtls_ccm_crypt() 129 output[i] = input[i] ^ tmp_buf[offset + i]; in mbedtls_ccm_crypt() 144 unsigned char i; in ccm_calculate_first_block_if_ready() local 184 for( i = 0, len_left = ctx->plaintext_len; i < ctx->q; i++, len_left >>= 8 ) in ccm_calculate_first_block_if_ready() 185 ctx->y[15-i] = MBEDTLS_BYTE_0( len_left ); in ccm_calculate_first_block_if_ready() 272 unsigned char i; in mbedtls_ccm_update_ad() local 313 for( i = 0; i < use_len; i++ ) in mbedtls_ccm_update_ad() 314 ctx->y[i + offset] ^= add[i]; in mbedtls_ccm_update_ad() 346 unsigned char i; in mbedtls_ccm_update() local [all …]
|
D | base64.c | 42 size_t i, n; in mbedtls_base64_encode() local 70 for( i = 0, p = dst; i < n; i += 3 ) in mbedtls_base64_encode() 84 if( i < slen ) in mbedtls_base64_encode() 87 C2 = ( ( i + 1 ) < slen ) ? *src++ : 0; in mbedtls_base64_encode() 93 if( ( i + 1 ) < slen ) in mbedtls_base64_encode() 112 size_t i; /* index in source */ in mbedtls_base64_decode() local 121 for( i = n = 0; i < slen; i++ ) in mbedtls_base64_decode() 125 while( i < slen && src[i] == ' ' ) in mbedtls_base64_decode() 127 ++i; in mbedtls_base64_decode() 132 if( i == slen ) in mbedtls_base64_decode() [all …]
|
D | nist_kw.c | 123 size_t i = 0; in calc_a_xor_t() local 124 for( i = 0; i < sizeof( t ); i++ ) in calc_a_xor_t() 126 A[i] ^= ( t >> ( ( sizeof( t ) - 1 - i ) * 8 ) ) & 0xff; in calc_a_xor_t() 344 size_t i, olen; in mbedtls_nist_kw_unwrap() local 446 for( diff = 0, i = 0; i < KW_SEMIBLOCK_LENGTH; i++ ) in mbedtls_nist_kw_unwrap() 448 if( i >= KW_SEMIBLOCK_LENGTH - padlen ) in mbedtls_nist_kw_unwrap() 449 diff |= output[*out_len - KW_SEMIBLOCK_LENGTH + i]; in mbedtls_nist_kw_unwrap() 451 bad_padding |= output[*out_len - KW_SEMIBLOCK_LENGTH + i]; in mbedtls_nist_kw_unwrap() 583 int i; in mbedtls_nist_kw_self_test() local 587 for( i = 0; i < KW_TESTS; i++ ) in mbedtls_nist_kw_self_test() [all …]
|
D | psa_crypto_se.c | 74 size_t i; in psa_get_se_driver_entry() local 82 for( i = 0; i < PSA_MAX_SE_DRIVERS; i++ ) in psa_get_se_driver_entry() 84 if( driver_table[i].location == location ) in psa_get_se_driver_entry() 85 return( &driver_table[i] ); in psa_get_se_driver_entry() 271 size_t i; in psa_init_all_se_drivers() local 272 for( i = 0; i < PSA_MAX_SE_DRIVERS; i++ ) in psa_init_all_se_drivers() 274 psa_se_drv_table_entry_t *driver = &driver_table[i]; in psa_init_all_se_drivers() 304 size_t i; in psa_register_se_driver() local 320 for( i = 0; i < PSA_MAX_SE_DRIVERS; i++ ) in psa_register_se_driver() 322 if( driver_table[i].location == 0 ) in psa_register_se_driver() [all …]
|
D | sha256.c | 409 unsigned int i; in mbedtls_internal_sha256_process_c() local 411 for( i = 0; i < 8; i++ ) in mbedtls_internal_sha256_process_c() 412 local.A[i] = ctx->state[i]; in mbedtls_internal_sha256_process_c() 415 for( i = 0; i < 64; i++ ) in mbedtls_internal_sha256_process_c() 417 if( i < 16 ) in mbedtls_internal_sha256_process_c() 418 local.W[i] = MBEDTLS_GET_UINT32_BE( data, 4 * i ); in mbedtls_internal_sha256_process_c() 420 R( i ); in mbedtls_internal_sha256_process_c() 423 local.A[5], local.A[6], local.A[7], local.W[i], K[i] ); in mbedtls_internal_sha256_process_c() 432 for( i = 0; i < 16; i++ ) in mbedtls_internal_sha256_process_c() 433 local.W[i] = MBEDTLS_GET_UINT32_BE( data, 4 * i ); in mbedtls_internal_sha256_process_c() [all …]
|
D | bignum.c | 133 size_t i; in mbedtls_mpi_shrink() local 144 for( i = X->n - 1; i > 0; i-- ) in mbedtls_mpi_shrink() 145 if( X->p[i] != 0 ) in mbedtls_mpi_shrink() 147 i++; in mbedtls_mpi_shrink() 149 if( i < nblimbs ) in mbedtls_mpi_shrink() 150 i = nblimbs; in mbedtls_mpi_shrink() 152 if( ( p = (mbedtls_mpi_uint*)mbedtls_calloc( i, ciL ) ) == NULL ) in mbedtls_mpi_shrink() 157 memcpy( p, X->p, i * ciL ); in mbedtls_mpi_shrink() 162 X->n = i; in mbedtls_mpi_shrink() 201 size_t i; in mbedtls_mpi_copy() local [all …]
|
D | pkcs12.c | 90 size_t i; in pkcs12_pbe_derive_key_iv() local 103 for( i = 0; i < pwdlen; i++ ) in pkcs12_pbe_derive_key_iv() 104 unipwd[i * 2 + 1] = pwd[i]; in pkcs12_pbe_derive_key_iv() 223 size_t i; in calculate_hashes() local 257 for( i = 1; i < (size_t) iterations; i++ ) in calculate_hashes() 272 size_t i, out_len, out_size = PSA_HASH_LENGTH( alg ); in calculate_hashes() 301 for( i = 1; i < (size_t) iterations; i++ ) in calculate_hashes() 333 size_t hlen, use_len, v, i; in mbedtls_pkcs12_derivation() local 389 for( i = v; i > 0; i-- ) in mbedtls_pkcs12_derivation() 390 if( ++hash_block[i - 1] != 0 ) in mbedtls_pkcs12_derivation() [all …]
|
D | sha512.c | 162 static void sha512_put_uint64_be( uint64_t n, unsigned char *b, uint8_t i ) in sha512_put_uint64_be() argument 164 MBEDTLS_PUT_UINT64_BE(n, b, i); in sha512_put_uint64_be() 547 int i; in mbedtls_internal_sha512_process_c() local 574 for( i = 0; i < 8; i++ ) in mbedtls_internal_sha512_process_c() 575 local.A[i] = ctx->state[i]; in mbedtls_internal_sha512_process_c() 578 for( i = 0; i < 80; i++ ) in mbedtls_internal_sha512_process_c() 580 if( i < 16 ) in mbedtls_internal_sha512_process_c() 582 local.W[i] = MBEDTLS_GET_UINT64_BE( data, i << 3 ); in mbedtls_internal_sha512_process_c() 586 local.W[i] = S1(local.W[i - 2]) + local.W[i - 7] + in mbedtls_internal_sha512_process_c() 587 S0(local.W[i - 15]) + local.W[i - 16]; in mbedtls_internal_sha512_process_c() [all …]
|
D | aes.c | 365 int i, x, y, z; in aes_gen_tables() local 372 for( i = 0, x = 1; i < 256; i++ ) in aes_gen_tables() 374 pow[i] = x; in aes_gen_tables() 375 log[x] = i; in aes_gen_tables() 382 for( i = 0, x = 1; i < 10; i++ ) in aes_gen_tables() 384 RCON[i] = (uint32_t) x; in aes_gen_tables() 394 for( i = 1; i < 256; i++ ) in aes_gen_tables() 396 x = pow[255 - log[i]]; in aes_gen_tables() 404 FSb[i] = (unsigned char) x; in aes_gen_tables() 405 RSb[x] = (unsigned char) i; in aes_gen_tables() [all …]
|
D | pkcs5.c | 215 unsigned int i; in pkcs5_pbkdf2_hmac() local 251 for( i = 1; i < iteration_count; i++ ) in pkcs5_pbkdf2_hmac() 276 for( i = 4; i > 0; i-- ) in pkcs5_pbkdf2_hmac() 277 if( ++counter[i - 1] != 0 ) in pkcs5_pbkdf2_hmac() 328 unsigned int i; in mbedtls_pkcs5_pbkdf2_hmac_ext() 384 for( i = 1; i < iteration_count; i++ ) in mbedtls_pkcs5_pbkdf2_hmac_ext() 409 for( i = 4; i > 0; i-- ) in mbedtls_pkcs5_pbkdf2_hmac_ext() 410 if( ++counter[i - 1] != 0 ) in mbedtls_pkcs5_pbkdf2_hmac_ext() 494 int ret, i; in mbedtls_pkcs5_self_test() local 497 for( i = 0; i < MAX_TESTS; i++ ) in mbedtls_pkcs5_self_test() [all …]
|
D | debug.c | 127 size_t i, idx = 0; in mbedtls_debug_print_buf() local 144 for( i = 0; i < len; i++ ) in mbedtls_debug_print_buf() 146 if( i >= 4096 ) in mbedtls_debug_print_buf() 149 if( i % 16 == 0 ) in mbedtls_debug_print_buf() 151 if( i > 0 ) in mbedtls_debug_print_buf() 161 (unsigned int) i ); in mbedtls_debug_print_buf() 166 (unsigned int) buf[i] ); in mbedtls_debug_print_buf() 167 txt[i % 16] = ( buf[i] > 31 && buf[i] < 127 ) ? buf[i] : '.' ; in mbedtls_debug_print_buf() 172 for( /* i = i */; i % 16 != 0; i++ ) in mbedtls_debug_print_buf() 266 size_t i; in debug_print_pk() local [all …]
|
/mbedtls-3.4.0/programs/hash/ |
D | generic_sum.c | 55 int i; in generic_print() local 61 for( i = 0; i < mbedtls_md_get_size( md_info ); i++ ) in generic_print() 62 mbedtls_printf( "%02x", sum[i] ); in generic_print() 70 int i; in generic_check() local 126 for( i = 0; i < mbedtls_md_get_size( md_info ); i++ ) in generic_check() 127 sprintf( buf + i * 2, "%02x", sum[i] ); in generic_check() 131 for( i = 0; i < 2 * mbedtls_md_get_size( md_info ); i++ ) in generic_check() 132 diff |= line[i] ^ buf[i]; in generic_check() 162 int ret = 1, i; in main() local 210 for( i = 2; i < argc; i++ ) in main() [all …]
|
/mbedtls-3.4.0/programs/test/ |
D | query_compile_time_config.c | 41 int i; in main() local 57 for( i = 2; i < argc; i++ ) in main() 59 if( query_config( argv[i] ) != 0 ) in main() 67 for( i = 2; i < argc; i++ ) in main() 69 if( query_config( argv[i] ) == 0 ) in main() 75 for( i = 1; i < argc; i++ ) in main() 77 if( query_config( argv[i] ) != 0 ) in main()
|
/mbedtls-3.4.0/tests/src/ |
D | psa_crypto_helpers.c | 41 size_t i; in mbedtls_test_uses_key_id() local 48 for( i = 0; i < num_key_ids_used ; i++ ) in mbedtls_test_uses_key_id() 50 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() 70 size_t i; in mbedtls_test_psa_purge_key_cache() local 71 for( i = 0; i < num_key_ids_used; i++ ) in mbedtls_test_psa_purge_key_cache() 72 psa_purge_key( key_ids_used_in_test[i] ); in mbedtls_test_psa_purge_key_cache()
|
/mbedtls-3.4.0/programs/ssl/ |
D | ssl_test_lib.c | 60 size_t i; in dummy_entropy() local 65 for( i = 0; i < len; i++ ) in dummy_entropy() 68 output[i] = (unsigned char) rand(); in dummy_entropy() 242 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() 246 *psa_algs[i] = PSA_ALG_RSA_PKCS1V15_SIGN( PSA_ALG_ANY_HASH ); in key_opaque_set_alg_usage() 249 else if( strcmp( algs[i], "rsa-sign-pss" ) == 0 ) in key_opaque_set_alg_usage() 251 *psa_algs[i] = PSA_ALG_RSA_PSS( PSA_ALG_ANY_HASH ); in key_opaque_set_alg_usage() 254 else if( strcmp( algs[i], "rsa-sign-pss-sha256" ) == 0 ) in key_opaque_set_alg_usage() 256 *psa_algs[i] = PSA_ALG_RSA_PSS( PSA_ALG_SHA_256 ); in key_opaque_set_alg_usage() [all …]
|
/mbedtls-3.4.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.4.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.4.0/programs/x509/ |
D | load_roots.c | 125 unsigned i, j; in main() local 139 for( i = 1; i < (unsigned) argc; i++ ) in main() 141 char *p = argv[i]; in main() 152 if( argv[i][j] >= 'A' && argv[i][j] <= 'Z' ) in main() 153 argv[i][j] |= 0x20; in main() 172 opt.filenames = (const char**) argv + i; in main() 179 mbedtls_printf( "Parsing %u certificates", argc - i ); in main() 188 for( i = 1; i <= opt.iterations; i++ ) in main()
|