| /openthread-latest/third_party/mbedtls/repo/library/ |
| D | bignum_mod.c | 26 const mbedtls_mpi_mod_modulus *N, in mbedtls_mpi_mod_residue_setup() argument 30 if (p_limbs != N->limbs || !mbedtls_mpi_core_lt_ct(p, N->p, N->limbs)) { in mbedtls_mpi_mod_residue_setup() 34 r->limbs = N->limbs; in mbedtls_mpi_mod_residue_setup() 50 void mbedtls_mpi_mod_modulus_init(mbedtls_mpi_mod_modulus *N) in mbedtls_mpi_mod_modulus_init() argument 52 if (N == NULL) { in mbedtls_mpi_mod_modulus_init() 56 N->p = NULL; in mbedtls_mpi_mod_modulus_init() 57 N->limbs = 0; in mbedtls_mpi_mod_modulus_init() 58 N->bits = 0; in mbedtls_mpi_mod_modulus_init() 59 N->int_rep = MBEDTLS_MPI_MOD_REP_INVALID; in mbedtls_mpi_mod_modulus_init() 62 void mbedtls_mpi_mod_modulus_free(mbedtls_mpi_mod_modulus *N) in mbedtls_mpi_mod_modulus_free() argument [all …]
|
| D | bignum_mod_raw.c | 28 const mbedtls_mpi_mod_modulus *N, in mbedtls_mpi_mod_raw_cond_assign() argument 31 mbedtls_mpi_core_cond_assign(X, A, N->limbs, mbedtls_ct_bool(assign)); in mbedtls_mpi_mod_raw_cond_assign() 36 const mbedtls_mpi_mod_modulus *N, in mbedtls_mpi_mod_raw_cond_swap() argument 39 mbedtls_mpi_core_cond_swap(X, Y, N->limbs, mbedtls_ct_bool(swap)); in mbedtls_mpi_mod_raw_cond_swap() 43 const mbedtls_mpi_mod_modulus *N, in mbedtls_mpi_mod_raw_read() argument 52 ret = mbedtls_mpi_core_read_le(X, N->limbs, in mbedtls_mpi_mod_raw_read() 56 ret = mbedtls_mpi_core_read_be(X, N->limbs, in mbedtls_mpi_mod_raw_read() 67 if (!mbedtls_mpi_core_lt_ct(X, N->p, N->limbs)) { in mbedtls_mpi_mod_raw_read() 78 const mbedtls_mpi_mod_modulus *N, in mbedtls_mpi_mod_raw_write() argument 85 return mbedtls_mpi_core_write_le(A, N->limbs, in mbedtls_mpi_mod_raw_write() [all …]
|
| D | bignum_mod_raw.h | 102 const mbedtls_mpi_mod_modulus *N, 128 const mbedtls_mpi_mod_modulus *N, 151 const mbedtls_mpi_mod_modulus *N, 173 const mbedtls_mpi_mod_modulus *N, 198 const mbedtls_mpi_mod_modulus *N); 232 const mbedtls_mpi_mod_modulus *N, 279 const mbedtls_mpi_uint *N, 305 const mbedtls_mpi_mod_modulus *N); 322 const mbedtls_mpi_mod_modulus *N); 339 const mbedtls_mpi_mod_modulus *N); [all …]
|
| D | bignum_mod.h | 163 const mbedtls_mpi_mod_modulus *N, 183 void mbedtls_mpi_mod_modulus_init(mbedtls_mpi_mod_modulus *N); 196 int mbedtls_mpi_mod_modulus_setup(mbedtls_mpi_mod_modulus *N, 212 int mbedtls_mpi_mod_optred_modulus_setup(mbedtls_mpi_mod_modulus *N, 227 void mbedtls_mpi_mod_modulus_free(mbedtls_mpi_mod_modulus *N); 261 const mbedtls_mpi_mod_modulus *N); 291 const mbedtls_mpi_mod_modulus *N); 320 const mbedtls_mpi_mod_modulus *N); 350 const mbedtls_mpi_mod_modulus *N); 381 const mbedtls_mpi_mod_modulus *N, [all …]
|
| D | rsa_alt_helpers.c | 50 int mbedtls_rsa_deduce_primes(mbedtls_mpi const *N, in mbedtls_rsa_deduce_primes() argument 79 if (mbedtls_mpi_cmp_int(N, 0) <= 0 || in mbedtls_rsa_deduce_primes() 81 mbedtls_mpi_cmp_mpi(D, N) >= 0 || in mbedtls_rsa_deduce_primes() 83 mbedtls_mpi_cmp_mpi(E, N) >= 0) { in mbedtls_rsa_deduce_primes() 112 if (N->p[0] % 8 == 1) { in mbedtls_rsa_deduce_primes() 120 MBEDTLS_MPI_CHK(mbedtls_mpi_gcd(P, &K, N)); in mbedtls_rsa_deduce_primes() 127 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&K, &K, &T, N, in mbedtls_rsa_deduce_primes() 139 MBEDTLS_MPI_CHK(mbedtls_mpi_gcd(P, &K, N)); in mbedtls_rsa_deduce_primes() 142 mbedtls_mpi_cmp_mpi(P, N) == -1) { in mbedtls_rsa_deduce_primes() 148 MBEDTLS_MPI_CHK(mbedtls_mpi_div_mpi(Q, NULL, N, P)); in mbedtls_rsa_deduce_primes() [all …]
|
| D | bignum_core.c | 513 mbedtls_mpi_uint mbedtls_mpi_core_montmul_init(const mbedtls_mpi_uint *N) in mbedtls_mpi_core_montmul_init() argument 515 mbedtls_mpi_uint x = N[0]; in mbedtls_mpi_core_montmul_init() 517 x += ((N[0] + 2) & 4) << 1; in mbedtls_mpi_core_montmul_init() 520 x *= (2 - (N[0] * x)); in mbedtls_mpi_core_montmul_init() 530 const mbedtls_mpi_uint *N, in mbedtls_mpi_core_montmul() argument 543 (void) mbedtls_mpi_core_mla(T, AN_limbs + 2, N, AN_limbs, u1); in mbedtls_mpi_core_montmul() 559 mbedtls_mpi_uint borrow = mbedtls_mpi_core_sub(X, T, N, AN_limbs); in mbedtls_mpi_core_montmul() 583 const mbedtls_mpi *N) in mbedtls_mpi_core_get_mont_r2_unsafe() argument 588 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_l(X, N->n * 2 * biL)); in mbedtls_mpi_core_get_mont_r2_unsafe() 589 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(X, X, N)); in mbedtls_mpi_core_get_mont_r2_unsafe() [all …]
|
| D | rsa.c | 572 const mbedtls_mpi *N, in mbedtls_rsa_import() argument 578 if ((N != NULL && (ret = mbedtls_mpi_copy(&ctx->N, N)) != 0) || in mbedtls_rsa_import() 586 if (N != NULL) { in mbedtls_rsa_import() 587 ctx->len = mbedtls_mpi_size(&ctx->N); in mbedtls_rsa_import() 594 unsigned char const *N, size_t N_len, in mbedtls_rsa_import_raw() argument 602 if (N != NULL) { in mbedtls_rsa_import_raw() 603 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->N, N, N_len)); in mbedtls_rsa_import_raw() 604 ctx->len = mbedtls_mpi_size(&ctx->N); in mbedtls_rsa_import_raw() 646 if (ctx->len != mbedtls_mpi_size(&ctx->N) || in rsa_check_context() 657 if (mbedtls_mpi_cmp_int(&ctx->N, 0) <= 0 || in rsa_check_context() [all …]
|
| D | bignum_core.h | 446 mbedtls_mpi_uint mbedtls_mpi_core_montmul_init(const mbedtls_mpi_uint *N); 486 const mbedtls_mpi_uint *N, size_t AN_limbs, 505 const mbedtls_mpi *N); 583 const mbedtls_mpi_uint *N, 636 const mbedtls_mpi_uint *N, size_t AN_limbs, 721 const mbedtls_mpi_uint *N, 758 const mbedtls_mpi_uint *N,
|
| /openthread-latest/third_party/mbedtls/repo/tests/suites/ |
| D | test_suite_bignum_mod.misc.data | 10 Test mpi_mod_mul #1 N->limbs != A->limbs 13 Test mpi_mod_mul #2 N->limbs != B->limbs 16 Test mpi_mod_mul #3 N->limbs != X->limbs 19 mpi_mod_sub base case for negative testing (N, a, b all >= 1 limb) 40 mbedtls_mpi_mod_inv non-Mont. form - base case for negative testing (N, A, A^-1) 52 mbedtls_mpi_mod_inv 32-bit Mont. form - base case for negative testing, A = 1 (N, mont(A), mont(A^-… 68 mbedtls_mpi_mod_inv 64-bit Mont. form - base case for negative testing, A = 1 (N, mont(A), mont(A^-… 84 mpi_mod_add base case for negative testing (N, a, b all >= 1 limb) 144 Test mbedtls_mpi_mod_io #1 N: "11" A: "119". 147 Test mbedtls_mpi_mod_io #2 N: "11" A: "136". [all …]
|
| D | test_suite_cipher.ccm.data | 1 AES-128-CCM test vector NIST #1 (P=0, N=7, A=0, T=4) 5 AES-128-CCM test vector NIST #2 (P=0, N=7, A=0, T=4) 9 AES-128-CCM test vector NIST #3 (P=0, N=7, A=0, T=16) 13 AES-128-CCM test vector NIST #4 (P=0, N=7, A=0, T=16) 17 AES-128-CCM test vector NIST #5 (P=0, N=13, A=0, T=4) 21 AES-128-CCM test vector NIST #6 (P=0, N=13, A=0, T=4) 25 AES-128-CCM test vector NIST #7 (P=0, N=13, A=0, T=16) 29 AES-128-CCM test vector NIST #8 (P=0, N=13, A=0, T=16) 33 AES-128-CCM test vector NIST #9 (P=24, N=7, A=0, T=4) 37 AES-128-CCM test vector NIST #10 (P=24, N=7, A=0, T=4) [all …]
|
| D | test_suite_ccm.data | 177 CCM encrypt and tag AES-128 (P=0, N=13, A=0, T=16) 181 CCM encrypt and tag NIST VTT AES-128 #1 (P=24, N=13, A=32, T=4) 185 CCM encrypt and tag NIST VTT AES-128 #2 (P=24, N=13, A=32, T=6) 189 CCM encrypt and tag NIST VTT AES-128 #3 (P=24, N=13, A=32, T=8) 193 CCM encrypt and tag NIST VTT AES-128 #4 (P=24, N=13, A=32, T=10) 197 CCM encrypt and tag NIST VTT AES-128 #5 (P=24, N=13, A=32, T=12) 201 CCM encrypt and tag NIST VTT AES-128 #6 (P=24, N=13, A=32, T=14) 205 CCM encrypt and tag NIST VTT AES-128 #7 (P=24, N=13, A=32, T=16) 209 CCM encrypt and tag NIST VTT AES-192 #1 (P=24, N=13, A=32, T=4) 213 CCM encrypt and tag NIST VTT AES-192 #2 (P=24, N=13, A=32, T=6) [all …]
|
| D | test_suite_rsa.data | 291 RSA Check Private key #4 (No N) 318 RSA Check Public key #2 (Even N) 324 RSA Check Public key #4 (N exactly 128 bits) 327 RSA Check Public key #5 (N smaller than 128 bits) 330 RSA Check Public key #6 (N exactly 8192 bits) 334 RSA Check Public key #7 (N larger than 8192 bits) 349 RSA Check Public key #9 (E has size N-2) 352 RSA Check Public key #10 (E has size N) 358 RSA Check Public-Private key #2 (Public no N) 361 RSA Check Public-Private key #3 (Private no N) [all …]
|
| D | test_suite_pkcs1_v21.function | 18 mbedtls_mpi N, E; 27 mbedtls_mpi_init(&N); mbedtls_mpi_init(&E); 36 TEST_ASSERT(mbedtls_mpi_read_binary(&N, input_N->x, input_N->len) == 0); 38 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, NULL, NULL, NULL, &E) == 0); 55 mbedtls_mpi_free(&N); mbedtls_mpi_free(&E); 71 mbedtls_mpi N, P, Q, E; 76 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); 91 TEST_ASSERT(mbedtls_mpi_read_binary(&N, input_N->x, input_N->len) == 0); 94 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 118 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); [all …]
|
| D | test_suite_bignum_mod_raw.function | 271 mbedtls_mpi_uint *N = NULL; 284 TEST_EQUAL(mbedtls_test_read_mpi_core(&N, &limbs_N, input_N), 0); 297 &m, N, limbs), 0); 329 mbedtls_free(N); 339 mbedtls_mpi_uint *N = NULL; 350 TEST_EQUAL(mbedtls_test_read_mpi_core(&N, &limbs_N, input_N), 0); 362 /* Check that 0 <= X < 2N */ 363 mbedtls_mpi_uint c = mbedtls_mpi_core_sub(tmp, X, N, limbs); 364 TEST_ASSERT(c || mbedtls_mpi_core_lt_ct(tmp, N, limbs)); 367 &m, N, limbs), 0); [all …]
|
| D | test_suite_rsa.function | 168 mbedtls_mpi N, P, Q, E; 171 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); 182 TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0); 185 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 202 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); 215 mbedtls_mpi N, E; 217 mbedtls_mpi_init(&N); mbedtls_mpi_init(&E); 222 TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0); 224 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, NULL, NULL, NULL, &E) == 0); 233 mbedtls_mpi_free(&N); mbedtls_mpi_free(&E); [all …]
|
| D | test_suite_pkcs1_v15.function | 20 mbedtls_mpi N, E; 27 mbedtls_mpi_init(&N); mbedtls_mpi_init(&E); 40 TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0); 42 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, NULL, NULL, NULL, &E) == 0); 61 mbedtls_mpi_free(&N); mbedtls_mpi_free(&E); 76 mbedtls_mpi N, P, Q, E; 79 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); 93 TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0); 96 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 121 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); [all …]
|
| D | test_suite_bignum_random.function | 208 mbedtls_mpi_mod_modulus N; 209 mbedtls_mpi_mod_modulus_init(&N); 211 TEST_EQUAL(mbedtls_test_read_mpi_modulus(&N, max_hex, rep), 0); 212 TEST_CALLOC(R_core, N.limbs); 213 TEST_CALLOC(R_mod_raw, N.limbs); 214 TEST_CALLOC(R_mod_digits, N.limbs); 215 TEST_EQUAL(mbedtls_mpi_mod_residue_setup(&R_mod, &N, 216 R_mod_digits, N.limbs), 221 min, N.p, N.limbs, 225 min, &N, [all …]
|
| D | test_suite_bignum_mod.function | 341 mbedtls_mpi_mod_residue i = { NULL, 0 }; /* expected inverse wrt N */ 345 mbedtls_mpi_mod_modulus N; 346 mbedtls_mpi_mod_modulus_init(&N); 349 mbedtls_test_read_mpi_modulus(&N, input_N, 355 TEST_EQUAL(0, test_read_residue(&a, &N, input_A, expected_ret != 0)); 356 TEST_EQUAL(0, test_read_residue(&i, &N, input_I, expected_ret != 0)); 358 size_t limbs = N.limbs; 363 TEST_EQUAL(0, mbedtls_mpi_mod_residue_setup(&x, &N, X_raw, limbs)); 365 TEST_EQUAL(expected_ret, mbedtls_mpi_mod_inv(&x, &a, &N)); 371 TEST_EQUAL(0, mbedtls_mpi_mod_inv(&x, &x, &N)); [all …]
|
| /openthread-latest/src/core/utils/ |
| D | static_counter.hpp | 39 template <int N> struct StaticInt : public StaticInt<N - 1> 42 static constexpr int kValue = N; 51 #define StaticCounterInit(N) static constexpr StaticInt<N> StaticCounter(StaticInt<N>) argument
|
| /openthread-latest/third_party/mbedtls/repo/tests/src/ |
| D | bignum_helpers.c | 78 int mbedtls_test_read_mpi_modulus(mbedtls_mpi_mod_modulus *N, in mbedtls_test_read_mpi_modulus() argument 84 if (N->limbs != 0) { in mbedtls_test_read_mpi_modulus() 94 ret = mbedtls_mpi_mod_modulus_setup(N, p, limbs); in mbedtls_test_read_mpi_modulus() 97 ret = mbedtls_mpi_mod_optred_modulus_setup(N, p, limbs, NULL); in mbedtls_test_read_mpi_modulus() 109 void mbedtls_test_mpi_mod_modulus_free_with_limbs(mbedtls_mpi_mod_modulus *N) in mbedtls_test_mpi_mod_modulus_free_with_limbs() argument 111 mbedtls_free((mbedtls_mpi_uint *) N->p); in mbedtls_test_mpi_mod_modulus_free_with_limbs() 112 mbedtls_mpi_mod_modulus_free(N); in mbedtls_test_mpi_mod_modulus_free_with_limbs()
|
| /openthread-latest/third_party/mbedtls/repo/programs/pkey/ |
| D | mpi_demo.c | 31 mbedtls_mpi E, P, Q, N, H, D, X, Y, Z; in main() local 33 mbedtls_mpi_init(&E); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); mbedtls_mpi_init(&N); in main() 40 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&N, &P, &Q)); in main() 43 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file(" N = ", &N, 10, NULL)); in main() 62 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&Y, &X, &E, &N, NULL)); in main() 63 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&Z, &Y, &D, &N, NULL)); in main() 74 mbedtls_mpi_free(&E); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); mbedtls_mpi_free(&N); in main()
|
| D | rsa_verify.c | 40 mbedtls_mpi N, E; in main() local 46 mbedtls_mpi_init(&N); in main() 68 if ((ret = mbedtls_mpi_read_file(&N, 16, f)) != 0 || in main() 70 (ret = mbedtls_rsa_import(&rsa, &N, NULL, NULL, NULL, &E) != 0)) { in main() 128 mbedtls_mpi_free(&N); in main()
|
| D | rsa_genkey.c | 47 mbedtls_mpi N, P, Q, D, E, DP, DQ, QP; in main() local 54 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); in main() 81 if ((ret = mbedtls_rsa_export(&rsa, &N, &P, &Q, &D, &E)) != 0 || in main() 92 if ((ret = mbedtls_mpi_write_file("N = ", &N, 16, fpub)) != 0 || in main() 106 if ((ret = mbedtls_mpi_write_file("N = ", &N, 16, fpriv)) != 0 || in main() 131 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); in main()
|
| D | rsa_encrypt.c | 47 mbedtls_mpi N, E; in main() local 62 mbedtls_mpi_init(&N); mbedtls_mpi_init(&E); in main() 85 if ((ret = mbedtls_mpi_read_file(&N, 16, f)) != 0 || in main() 94 if ((ret = mbedtls_rsa_import(&rsa, &N, NULL, NULL, NULL, &E)) != 0) { in main() 141 mbedtls_mpi_free(&N); mbedtls_mpi_free(&E); in main()
|
| /openthread-latest/third_party/mbedtls/repo/programs/fuzz/ |
| D | fuzz_pubkey.c | 22 mbedtls_mpi N, P, Q, D, E, DP, DQ, QP; in LLVMFuzzerTestOneInput() local 25 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); in LLVMFuzzerTestOneInput() 30 if (mbedtls_rsa_export(rsa, &N, NULL, NULL, NULL, &E) != 0) { in LLVMFuzzerTestOneInput() 33 if (mbedtls_rsa_export(rsa, &N, &P, &Q, &D, &E) != MBEDTLS_ERR_RSA_BAD_INPUT_DATA) { in LLVMFuzzerTestOneInput() 40 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); in LLVMFuzzerTestOneInput()
|