/mbedtls-3.5.0/library/ |
D | rsa_alt_helpers.c | 64 mbedtls_mpi *P, mbedtls_mpi *Q) in mbedtls_rsa_deduce_primes() argument 87 if (P == NULL || Q == NULL || P->p != NULL || Q->p != NULL) { in mbedtls_rsa_deduce_primes() 140 Q /* temporarily use Q for storing Montgomery in mbedtls_rsa_deduce_primes() 160 MBEDTLS_MPI_CHK(mbedtls_mpi_div_mpi(Q, NULL, N, P)); in mbedtls_rsa_deduce_primes() 195 mbedtls_mpi const *Q, in mbedtls_rsa_deduce_private_exponent() argument 207 mbedtls_mpi_cmp_int(Q, 1) <= 0 || in mbedtls_rsa_deduce_private_exponent() 217 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&L, Q, 1)); in mbedtls_rsa_deduce_private_exponent() 237 int mbedtls_rsa_deduce_crt(const mbedtls_mpi *P, const mbedtls_mpi *Q, in mbedtls_rsa_deduce_crt() argument 253 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&K, Q, 1)); in mbedtls_rsa_deduce_crt() 259 MBEDTLS_MPI_CHK(mbedtls_mpi_inv_mod(QP, Q, P)); in mbedtls_rsa_deduce_crt() [all …]
|
D | ecdh.c | 67 mbedtls_mpi *d, mbedtls_ecp_point *Q, in ecdh_gen_public_restartable() argument 83 MBEDTLS_MPI_CHK(mbedtls_ecp_mul_restartable(grp, Q, d, &grp->G, in ecdh_gen_public_restartable() 93 int mbedtls_ecdh_gen_public(mbedtls_ecp_group *grp, mbedtls_mpi *d, mbedtls_ecp_point *Q, in mbedtls_ecdh_gen_public() argument 97 return ecdh_gen_public_restartable(grp, d, Q, f_rng, p_rng, NULL); in mbedtls_ecdh_gen_public() 107 const mbedtls_ecp_point *Q, const mbedtls_mpi *d, in ecdh_compute_shared_restartable() argument 117 MBEDTLS_MPI_CHK(mbedtls_ecp_mul_restartable(grp, &P, d, Q, in ecdh_compute_shared_restartable() 137 const mbedtls_ecp_point *Q, const mbedtls_mpi *d, in mbedtls_ecdh_compute_shared() argument 141 return ecdh_compute_shared_restartable(grp, z, Q, d, in mbedtls_ecdh_compute_shared() 150 mbedtls_ecp_point_init(&ctx->Q); in ecdh_init_internal() 223 mbedtls_ecp_point_free(&ctx->Q); in ecdh_free_internal() [all …]
|
D | rsa.c | 75 const mbedtls_mpi *P, const mbedtls_mpi *Q, in mbedtls_rsa_import() argument 82 (Q != NULL && (ret = mbedtls_mpi_copy(&ctx->Q, Q)) != 0) || in mbedtls_rsa_import() 98 unsigned char const *Q, size_t Q_len, in mbedtls_rsa_import_raw() argument 113 if (Q != NULL) { in mbedtls_rsa_import_raw() 114 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->Q, Q, Q_len)); in mbedtls_rsa_import_raw() 171 mbedtls_mpi_cmp_int(&ctx->Q, 0) <= 0 || in rsa_check_context() 172 mbedtls_mpi_get_bit(&ctx->Q, 0) == 0)) { in rsa_check_context() 206 mbedtls_mpi_cmp_int(&ctx->Q, 0) <= 0)) { in rsa_check_context() 234 have_Q = (mbedtls_mpi_cmp_int(&ctx->Q, 0) != 0); in mbedtls_rsa_complete() 272 &ctx->Q)) != 0) { in mbedtls_rsa_complete() [all …]
|
D | rsa_alt_helpers.h | 93 mbedtls_mpi *P, mbedtls_mpi *Q); 117 mbedtls_mpi const *Q, 142 int mbedtls_rsa_deduce_crt(const mbedtls_mpi *P, const mbedtls_mpi *Q, 178 const mbedtls_mpi *Q, const mbedtls_mpi *D, 212 int mbedtls_rsa_validate_crt(const mbedtls_mpi *P, const mbedtls_mpi *Q,
|
D | ecp.c | 543 mbedtls_ecp_point_init(&key->Q); in mbedtls_ecp_keypair_init() 611 mbedtls_ecp_point_free(&key->Q); in mbedtls_ecp_keypair_free() 617 int mbedtls_ecp_copy(mbedtls_ecp_point *P, const mbedtls_ecp_point *Q) in mbedtls_ecp_copy() argument 620 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&P->X, &Q->X)); in mbedtls_ecp_copy() 621 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&P->Y, &Q->Y)); in mbedtls_ecp_copy() 622 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&P->Z, &Q->Z)); in mbedtls_ecp_copy() 662 const mbedtls_ecp_point *Q) in mbedtls_ecp_point_cmp() argument 664 if (mbedtls_mpi_cmp_mpi(&P->X, &Q->X) == 0 && in mbedtls_ecp_point_cmp() 665 mbedtls_mpi_cmp_mpi(&P->Y, &Q->Y) == 0 && in mbedtls_ecp_point_cmp() 666 mbedtls_mpi_cmp_mpi(&P->Z, &Q->Z) == 0) { in mbedtls_ecp_point_cmp() [all …]
|
/mbedtls-3.5.0/tests/suites/ |
D | test_suite_ecdsa.function | 20 mbedtls_ecp_point Q; 26 mbedtls_ecp_point_init(&Q); 32 TEST_ASSERT(mbedtls_ecp_gen_keypair(&grp, &d, &Q, 39 TEST_ASSERT(mbedtls_ecdsa_verify(&grp, buf, sizeof(buf), &Q, &r, &s) == 0); 43 mbedtls_ecp_point_free(&Q); 52 mbedtls_ecp_point Q; 58 mbedtls_ecp_point_init(&Q); 67 TEST_ASSERT(mbedtls_ecp_gen_keypair(&grp, &d, &Q, 74 TEST_ASSERT(mbedtls_ecdsa_verify(&grp, buf, sizeof(buf), &Q, &r, &s) == 0); 78 mbedtls_ecp_point_free(&Q); [all …]
|
D | test_suite_rsa.function | 169 mbedtls_mpi N, P, Q, E; 173 mbedtls_mpi_init(&Q); mbedtls_mpi_init(&E); 182 TEST_ASSERT(mbedtls_test_read_mpi(&Q, input_Q) == 0); 186 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 203 mbedtls_mpi_free(&Q); mbedtls_mpi_free(&E); 247 mbedtls_mpi N, P, Q, E; 252 mbedtls_mpi_init(&Q); mbedtls_mpi_init(&E); 261 TEST_ASSERT(mbedtls_test_read_mpi(&Q, input_Q) == 0); 265 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 282 mbedtls_mpi_free(&Q); mbedtls_mpi_free(&E); [all …]
|
D | test_suite_rsa.data | 288 RSA Check Private key #3 (No Q) 464 RSA Import (N,P,Q,D,E) 467 RSA Import (N,P,Q,D,E), inconsistent 470 RSA Import (N,P,Q,D,E), successive 473 RSA Import (N,P,Q,D,E), successive, inconsistent 476 RSA Import (-,P,Q,D,E) 479 RSA Import (-,P,Q,D,E), successive 488 RSA Import (N,P,Q,-,E) 491 RSA Import (N,P,Q,-,E), successive 494 RSA Import (-,P,Q,-,E) [all …]
|
D | test_suite_pkcs1_v21.function | 69 mbedtls_mpi N, P, Q, E; 73 mbedtls_mpi_init(&Q); mbedtls_mpi_init(&E); 86 TEST_ASSERT(mbedtls_mpi_read_binary(&Q, input_Q->x, input_Q->len) == 0); 90 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 115 mbedtls_mpi_free(&Q); mbedtls_mpi_free(&E); 130 mbedtls_mpi N, P, Q, E; 138 mbedtls_mpi_init(&Q); mbedtls_mpi_init(&E); 149 TEST_ASSERT(mbedtls_mpi_read_binary(&Q, input_Q->x, input_Q->len) == 0); 153 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 180 mbedtls_mpi_free(&Q); mbedtls_mpi_free(&E);
|
D | test_suite_pkcs1_v15.function | 78 mbedtls_mpi N, P, Q, E; 82 mbedtls_mpi_init(&Q); mbedtls_mpi_init(&E); 94 TEST_ASSERT(mbedtls_test_read_mpi(&Q, input_Q) == 0); 98 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 124 mbedtls_mpi_free(&Q); mbedtls_mpi_free(&E); 169 static unsigned char Q[64] = { 211 TEST_ASSERT(mbedtls_mpi_read_binary(&Qmpi, Q, sizeof(Q)) == 0); 278 mbedtls_mpi N, P, Q, E; 287 mbedtls_mpi_init(&Q); mbedtls_mpi_init(&E); 298 TEST_ASSERT(mbedtls_test_read_mpi(&Q, input_Q) == 0); [all …]
|
/mbedtls-3.5.0/programs/pkey/ |
D | mpi_demo.c | 43 mbedtls_mpi E, P, Q, N, H, D, X, Y, Z; in main() local 45 mbedtls_mpi_init(&E); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); mbedtls_mpi_init(&N); in main() 50 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&Q, 10, "3203")); in main() 52 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&N, &P, &Q)); in main() 60 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file(" Q = ", &Q, 10, NULL)); in main() 64 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&Q, &Q, 1)); in main() 65 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&H, &P, &Q)); in main() 86 mbedtls_mpi_free(&E); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); mbedtls_mpi_free(&N); in main()
|
D | key_app.c | 91 mbedtls_mpi N, P, Q, D, E, DP, DQ, QP; in main() local 102 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); in main() 207 if ((ret = mbedtls_rsa_export(rsa, &N, &P, &Q, &D, &E)) != 0 || in main() 217 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("Q: ", &Q, 16, NULL)); in main() 227 &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(X), 16, in main() 230 &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Y), 16, in main() 233 &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Z), 16, in main() 277 &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(X), 16, in main() 280 &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Y), 16, in main() 283 &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Z), 16, in main() [all …]
|
D | dh_genprime.c | 61 mbedtls_mpi G, P, Q; in main() local 70 mbedtls_mpi_init(&G); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); in main() 129 if ((ret = mbedtls_mpi_sub_int(&Q, &P, 1)) != 0) { in main() 134 if ((ret = mbedtls_mpi_div_int(&Q, NULL, &Q, 2)) != 0) { in main() 139 if ((ret = mbedtls_mpi_is_prime_ext(&Q, 50, mbedtls_ctr_drbg_random, &ctr_drbg)) != 0) { in main() 166 mbedtls_mpi_free(&G); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); in main()
|
D | key_app_writer.c | 206 mbedtls_mpi N, P, Q, D, E, DP, DQ, QP; in main() local 219 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); in main() 322 if ((ret = mbedtls_rsa_export(rsa, &N, &P, &Q, &D, &E)) != 0 || in main() 332 mbedtls_mpi_write_file("Q: ", &Q, 16, NULL); in main() 341 mbedtls_mpi_write_file("Q(X): ", &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(X), 16, NULL); in main() 342 mbedtls_mpi_write_file("Q(Y): ", &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Y), 16, NULL); in main() 343 mbedtls_mpi_write_file("Q(Z): ", &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Z), 16, NULL); in main() 387 mbedtls_mpi_write_file("Q(X): ", &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(X), 16, NULL); in main() 388 mbedtls_mpi_write_file("Q(Y): ", &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Y), 16, NULL); in main() 389 mbedtls_mpi_write_file("Q(Z): ", &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Z), 16, NULL); in main() [all …]
|
D | rsa_genkey.c | 59 mbedtls_mpi N, P, Q, D, E, DP, DQ, QP; in main() local 66 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); in main() 93 if ((ret = mbedtls_rsa_export(&rsa, &N, &P, &Q, &D, &E)) != 0 || in main() 122 (ret = mbedtls_mpi_write_file("Q = ", &Q, 16, fpriv)) != 0 || in main() 143 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); in main()
|
D | rsa_sign.c | 53 mbedtls_mpi N, P, Q, D, E, DP, DQ, QP; in main() local 57 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); in main() 84 (ret = mbedtls_mpi_read_file(&Q, 16, f)) != 0 || in main() 94 if ((ret = mbedtls_rsa_import(&rsa, &N, &P, &Q, &D, &E)) != 0) { in main() 159 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); in main()
|
D | rsa_decrypt.c | 56 mbedtls_mpi N, P, Q, D, E, DP, DQ, QP; in main() local 82 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); in main() 108 (ret = mbedtls_mpi_read_file(&Q, 16, f)) != 0 || in main() 119 if ((ret = mbedtls_rsa_import(&rsa, &N, &P, &Q, &D, &E)) != 0) { in main() 178 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); in main()
|
D | gen_key.c | 183 mbedtls_mpi N, P, Q, D, E, DP, DQ, QP; in main() local 195 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); in main() 350 if ((ret = mbedtls_rsa_export(rsa, &N, &P, &Q, &D, &E)) != 0 || in main() 360 mbedtls_mpi_write_file("Q: ", &Q, 16, NULL); in main() 371 mbedtls_mpi_write_file("X_Q: ", &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(X), 16, NULL); in main() 372 mbedtls_mpi_write_file("Y_Q: ", &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Y), 16, NULL); in main() 403 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); in main()
|
D | dh_server.c | 80 mbedtls_mpi N, P, Q, D, E; in main() local 88 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); in main() 123 (ret = mbedtls_mpi_read_file(&Q, 16, f)) != 0) { in main() 131 if ((ret = mbedtls_rsa_import(&rsa, &N, &P, &Q, &D, &E)) != 0) { in main() 290 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); in main()
|
/mbedtls-3.5.0/include/mbedtls/ |
D | ecp.h | 427 mbedtls_ecp_point MBEDTLS_PRIVATE(Q); /*!< our public value */ 676 int mbedtls_ecp_copy(mbedtls_ecp_point *P, const mbedtls_ecp_point *Q); 727 const mbedtls_ecp_point *Q); 1040 const mbedtls_mpi *n, const mbedtls_ecp_point *Q); 1085 const mbedtls_mpi *n, const mbedtls_ecp_point *Q, 1190 mbedtls_mpi *d, mbedtls_ecp_point *Q, 1218 mbedtls_ecp_point *Q, 1321 mbedtls_mpi *d, mbedtls_ecp_point *Q);
|
D | ecdh.h | 101 mbedtls_ecp_point MBEDTLS_PRIVATE(Q); /*!< The public key. */ 121 mbedtls_ecp_point MBEDTLS_PRIVATE(Q); /*!< The public key. */ 190 int mbedtls_ecdh_gen_public(mbedtls_ecp_group *grp, mbedtls_mpi *d, mbedtls_ecp_point *Q, 226 const mbedtls_ecp_point *Q, const mbedtls_mpi *d,
|
D | rsa.h | 103 mbedtls_mpi MBEDTLS_PRIVATE(Q); /*!< The second prime factor. */ 237 const mbedtls_mpi *P, const mbedtls_mpi *Q, 277 unsigned char const *Q, size_t Q_len, 356 mbedtls_mpi *N, mbedtls_mpi *P, mbedtls_mpi *Q, 409 unsigned char *Q, size_t Q_len,
|
/mbedtls-3.5.0/programs/fuzz/ |
D | fuzz_pubkey.c | 18 mbedtls_mpi N, P, Q, D, E, DP, DQ, QP; in LLVMFuzzerTestOneInput() local 21 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); in LLVMFuzzerTestOneInput() 29 if (mbedtls_rsa_export(rsa, &N, &P, &Q, &D, &E) != MBEDTLS_ERR_RSA_BAD_INPUT_DATA) { in LLVMFuzzerTestOneInput() 36 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); in LLVMFuzzerTestOneInput()
|
D | fuzz_privkey.c | 45 mbedtls_mpi N, P, Q, D, E, DP, DQ, QP; in LLVMFuzzerTestOneInput() local 48 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); in LLVMFuzzerTestOneInput() 53 if (mbedtls_rsa_export(rsa, &N, &P, &Q, &D, &E) != 0) { in LLVMFuzzerTestOneInput() 60 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); in LLVMFuzzerTestOneInput()
|
/mbedtls-3.5.0/tests/ |
D | Makefile | 230 if exist *.c del /Q /F *.c 231 if exist *.exe del /Q /F *.exe 232 if exist *.datax del /Q /F *.datax 233 if exist src/*.o del /Q /F src/*.o 234 if exist src/drivers/*.o del /Q /F src/drivers/*.o 235 if exist src/test_helpers/*.o del /Q /F src/test_helpers/*.o 236 if exist src/libmbed* del /Q /F src/libmed* 237 if exist include/test/instrument_record_status.h del /Q /F include/test/instrument_record_status.h 244 for %f in ($(subst /,\,$(GENERATED_FILES))) if exist %f del /Q /F %f
|