/mbedtls-latest/library/ |
D | md5.c | 91 #define P(a, b, c, d, k, s, t) \ in mbedtls_internal_md5_process() macro 105 P(local.A, local.B, local.C, local.D, 0, 7, 0xD76AA478); in mbedtls_internal_md5_process() 106 P(local.D, local.A, local.B, local.C, 1, 12, 0xE8C7B756); in mbedtls_internal_md5_process() 107 P(local.C, local.D, local.A, local.B, 2, 17, 0x242070DB); in mbedtls_internal_md5_process() 108 P(local.B, local.C, local.D, local.A, 3, 22, 0xC1BDCEEE); in mbedtls_internal_md5_process() 109 P(local.A, local.B, local.C, local.D, 4, 7, 0xF57C0FAF); in mbedtls_internal_md5_process() 110 P(local.D, local.A, local.B, local.C, 5, 12, 0x4787C62A); in mbedtls_internal_md5_process() 111 P(local.C, local.D, local.A, local.B, 6, 17, 0xA8304613); in mbedtls_internal_md5_process() 112 P(local.B, local.C, local.D, local.A, 7, 22, 0xFD469501); in mbedtls_internal_md5_process() 113 P(local.A, local.B, local.C, local.D, 8, 7, 0x698098D8); in mbedtls_internal_md5_process() [all …]
|
D | sha1.c | 100 #define P(a, b, c, d, e, x) \ in mbedtls_internal_sha1_process() macro 116 P(local.A, local.B, local.C, local.D, local.E, local.W[0]); in mbedtls_internal_sha1_process() 117 P(local.E, local.A, local.B, local.C, local.D, local.W[1]); in mbedtls_internal_sha1_process() 118 P(local.D, local.E, local.A, local.B, local.C, local.W[2]); in mbedtls_internal_sha1_process() 119 P(local.C, local.D, local.E, local.A, local.B, local.W[3]); in mbedtls_internal_sha1_process() 120 P(local.B, local.C, local.D, local.E, local.A, local.W[4]); in mbedtls_internal_sha1_process() 121 P(local.A, local.B, local.C, local.D, local.E, local.W[5]); in mbedtls_internal_sha1_process() 122 P(local.E, local.A, local.B, local.C, local.D, local.W[6]); in mbedtls_internal_sha1_process() 123 P(local.D, local.E, local.A, local.B, local.C, local.W[7]); in mbedtls_internal_sha1_process() 124 P(local.C, local.D, local.E, local.A, local.B, local.W[8]); in mbedtls_internal_sha1_process() [all …]
|
D | ecp.c | 515 mbedtls_mpi_init(&grp->P); in mbedtls_ecp_group_init() 586 mbedtls_mpi_free(&grp->P); in mbedtls_ecp_group_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() 661 int mbedtls_ecp_point_cmp(const mbedtls_ecp_point *P, 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 …]
|
D | rsa_alt_helpers.c | 52 mbedtls_mpi *P, mbedtls_mpi *Q) in mbedtls_rsa_deduce_primes() argument 75 if (P == NULL || Q == NULL || P->p != NULL || Q->p != NULL) { in mbedtls_rsa_deduce_primes() 120 MBEDTLS_MPI_CHK(mbedtls_mpi_gcd(P, &K, N)); in mbedtls_rsa_deduce_primes() 121 if (mbedtls_mpi_cmp_int(P, 1) != 0) { in mbedtls_rsa_deduce_primes() 139 MBEDTLS_MPI_CHK(mbedtls_mpi_gcd(P, &K, N)); in mbedtls_rsa_deduce_primes() 141 if (mbedtls_mpi_cmp_int(P, 1) == 1 && 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() 182 int mbedtls_rsa_deduce_private_exponent(mbedtls_mpi const *P, in mbedtls_rsa_deduce_private_exponent() argument 194 if (mbedtls_mpi_cmp_int(P, 1) <= 0 || in mbedtls_rsa_deduce_private_exponent() [all …]
|
D | dhm.c | 79 static int dhm_check_range(const mbedtls_mpi *param, const mbedtls_mpi *P) in dhm_check_range() argument 86 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&U, P, 2)); in dhm_check_range() 105 return mbedtls_mpi_bitlen(&ctx->P); in mbedtls_dhm_get_bitlen() 110 return mbedtls_mpi_size(&ctx->P); in mbedtls_dhm_get_len() 120 src = &ctx->P; in mbedtls_dhm_get_value() 152 if ((ret = dhm_read_bignum(&ctx->P, p, end)) != 0 || in mbedtls_dhm_read_params() 158 if ((ret = dhm_check_range(&ctx->GY, &ctx->P)) != 0) { in mbedtls_dhm_read_params() 186 if (mbedtls_mpi_cmp_int(&ctx->P, 0) == 0) { in dhm_make_common() 193 if ((unsigned) x_size < mbedtls_mpi_size(&ctx->P)) { in dhm_make_common() 197 ret = dhm_random_below(&ctx->X, &ctx->P, f_rng, p_rng); in dhm_make_common() [all …]
|
D | psa_crypto_ffdh.c | 31 mbedtls_mpi *P, in mbedtls_psa_ffdh_set_prime_generator() argument 40 if (P == NULL && G == NULL) { in mbedtls_psa_ffdh_set_prime_generator() 120 if (P != NULL) { in mbedtls_psa_ffdh_set_prime_generator() 121 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(P, dhm_P, in mbedtls_psa_ffdh_set_prime_generator() 153 mbedtls_mpi GX, G, X, P; in mbedtls_psa_ffdh_export_public_key() local 168 mbedtls_mpi_init(&X); mbedtls_mpi_init(&P); in mbedtls_psa_ffdh_export_public_key() 172 status = mbedtls_psa_ffdh_set_prime_generator(key_len, &P, &G); in mbedtls_psa_ffdh_export_public_key() 181 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&GX, &G, &X, &P, NULL)); in mbedtls_psa_ffdh_export_public_key() 188 mbedtls_mpi_free(&P); mbedtls_mpi_free(&G); in mbedtls_psa_ffdh_export_public_key() 205 mbedtls_mpi X, P; in mbedtls_psa_ffdh_generate_key() local [all …]
|
D | rsa.c | 574 const mbedtls_mpi *P, const mbedtls_mpi *Q, in mbedtls_rsa_import() argument 580 (P != NULL && (ret = mbedtls_mpi_copy(&ctx->P, P)) != 0) || in mbedtls_rsa_import() 596 unsigned char const *P, size_t P_len, in mbedtls_rsa_import_raw() argument 608 if (P != NULL) { in mbedtls_rsa_import_raw() 609 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->P, P, P_len)); in mbedtls_rsa_import_raw() 668 (mbedtls_mpi_cmp_int(&ctx->P, 0) <= 0 || in rsa_check_context() 669 mbedtls_mpi_get_bit(&ctx->P, 0) == 0 || in rsa_check_context() 704 (mbedtls_mpi_cmp_int(&ctx->P, 0) <= 0 || in rsa_check_context() 732 have_P = (mbedtls_mpi_cmp_int(&ctx->P, 0) != 0); in mbedtls_rsa_complete() 770 if ((ret = mbedtls_mpi_mul_mpi(&ctx->N, &ctx->P, in mbedtls_rsa_complete() [all …]
|
D | sha256.c | 477 #define P(a, b, c, d, e, f, g, h, x, K) \ macro 514 P(local.A[0], local.A[1], local.A[2], local.A[3], local.A[4], in mbedtls_internal_sha256_process_c() 529 P(local.A[0], local.A[1], local.A[2], local.A[3], local.A[4], in mbedtls_internal_sha256_process_c() 531 P(local.A[7], local.A[0], local.A[1], local.A[2], local.A[3], in mbedtls_internal_sha256_process_c() 533 P(local.A[6], local.A[7], local.A[0], local.A[1], local.A[2], in mbedtls_internal_sha256_process_c() 535 P(local.A[5], local.A[6], local.A[7], local.A[0], local.A[1], in mbedtls_internal_sha256_process_c() 537 P(local.A[4], local.A[5], local.A[6], local.A[7], local.A[0], in mbedtls_internal_sha256_process_c() 539 P(local.A[3], local.A[4], local.A[5], local.A[6], local.A[7], in mbedtls_internal_sha256_process_c() 541 P(local.A[2], local.A[3], local.A[4], local.A[5], local.A[6], in mbedtls_internal_sha256_process_c() 543 P(local.A[1], local.A[2], local.A[3], local.A[4], local.A[5], in mbedtls_internal_sha256_process_c() [all …]
|
D | rsa_alt_helpers.h | 79 mbedtls_mpi *P, mbedtls_mpi *Q); 102 int mbedtls_rsa_deduce_private_exponent(mbedtls_mpi const *P, 128 int mbedtls_rsa_deduce_crt(const mbedtls_mpi *P, const mbedtls_mpi *Q, 163 int mbedtls_rsa_validate_params(const mbedtls_mpi *N, const mbedtls_mpi *P, 198 int mbedtls_rsa_validate_crt(const mbedtls_mpi *P, const mbedtls_mpi *Q,
|
D | ecp_internal_alt.h | 156 mbedtls_ecp_point *R, const mbedtls_ecp_point *P, 181 mbedtls_ecp_point *R, const mbedtls_ecp_point *P); 240 const mbedtls_ecp_point *P, 262 mbedtls_ecp_point *P, int (*f_rng)(void *, 280 mbedtls_ecp_point *P);
|
/mbedtls-latest/tests/suites/ |
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_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_dhm.function | 63 TEST_ASSERT(mbedtls_mpi_cmp_mpi(&ctx->X, &ctx->P) < 0); 66 TEST_ASSERT(mbedtls_mpi_cmp_mpi(&ctx->GX, &ctx->P) < 0); 68 /* Check ske: it must contain P, G and G^X, each prefixed with a 70 if (!check_dhm_param_output(&ctx->P, ske, ske_len, &offset)) { 122 TEST_ASSERT(mbedtls_test_read_mpi(&ctx_srv.P, input_P) == 0); 124 pub_cli_len = mbedtls_mpi_size(&ctx_srv.P); 125 TEST_ASSERT(check_get_value(&ctx_srv, MBEDTLS_DHM_PARAM_P, &ctx_srv.P)); 146 TEST_ASSERT(check_get_value(&ctx_cli, MBEDTLS_DHM_PARAM_P, &ctx_srv.P)); 235 mbedtls_mpi P, G; 239 mbedtls_mpi_init(&P); [all …]
|
D | test_suite_rsa.function | 168 mbedtls_mpi N, P, Q, E; 171 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); 180 TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0); 185 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 202 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); 248 mbedtls_mpi N, P, Q, E; 252 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); 261 TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0); 266 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 283 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); [all …]
|
D | test_suite_rsa.data | 285 RSA Check Private key #2 (No P) 470 RSA Import (N,P,Q,D,E) 473 RSA Import (N,P,Q,D,E), inconsistent 476 RSA Import (N,P,Q,D,E), successive 479 RSA Import (N,P,Q,D,E), successive, inconsistent 482 RSA Import (-,P,Q,D,E) 485 RSA Import (-,P,Q,D,E), successive 494 RSA Import (N,P,Q,-,E) 497 RSA Import (N,P,Q,-,E), successive 500 RSA Import (-,P,Q,-,E) [all …]
|
D | test_suite_ecp.function | 22 if (mbedtls_mpi_cmp_mpi(&grp1->P, &grp2->P) != 0) { 82 mbedtls_ecp_point P; 88 mbedtls_ecp_point_init(&P); 91 mbedtls_ecp_point_write_binary(&grp, &P, 96 mbedtls_ecp_tls_write_point(&grp, &P, 133 mbedtls_ecp_point P; 136 mbedtls_ecp_point_init(&P); 140 TEST_ASSERT(mbedtls_test_read_mpi(&P.X, x_hex) == 0); 141 TEST_ASSERT(mbedtls_test_read_mpi(&P.Y, y_hex) == 0); 142 TEST_ASSERT(mbedtls_test_read_mpi(&P.Z, z_hex) == 0); [all …]
|
D | test_suite_pkcs1_v21.function | 71 mbedtls_mpi N, P, Q, E; 76 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); 89 TEST_ASSERT(mbedtls_mpi_read_binary(&P, input_P->x, input_P->len) == 0); 94 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 118 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); 135 mbedtls_mpi N, P, Q, E; 144 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); 155 TEST_ASSERT(mbedtls_mpi_read_binary(&P, input_P->x, input_P->len) == 0); 160 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 186 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P);
|
D | test_suite_pkcs1_v15.function | 76 mbedtls_mpi N, P, Q, E; 79 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); 91 TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0); 96 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 121 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); 157 static unsigned char P[64] = { 208 TEST_ASSERT(mbedtls_mpi_read_binary(&Pmpi, P, sizeof(P)) == 0); 276 mbedtls_mpi N, P, Q, E; 284 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); 295 TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0); [all …]
|
/mbedtls-latest/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() 37 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&P, 10, "2789")); in main() 40 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&N, &P, &Q)); in main() 47 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file(" P = ", &P, 10, NULL)); in main() 51 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&P, &P, 1)); in main() 53 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&H, &P, &Q)); in main() 74 mbedtls_mpi_free(&E); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); mbedtls_mpi_free(&N); in main()
|
D | dh_genprime.c | 49 mbedtls_mpi G, P, Q; in main() local 58 mbedtls_mpi_init(&G); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); in main() 108 if ((ret = mbedtls_mpi_gen_prime(&P, nbits, 1, in main() 117 if ((ret = mbedtls_mpi_sub_int(&Q, &P, 1)) != 0) { in main() 140 if (((ret = mbedtls_mpi_write_file("P = ", &P, 16, fout)) != 0) || in main() 154 mbedtls_mpi_free(&G); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); in main()
|
D | rsa_sign.c | 42 mbedtls_mpi N, P, Q, D, E, DP, DQ, QP; in main() local 46 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); in main() 72 (ret = mbedtls_mpi_read_file(&P, 16, f)) != 0 || in main() 83 if ((ret = mbedtls_rsa_import(&rsa, &N, &P, &Q, &D, &E)) != 0) { in main() 148 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); 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() 109 (ret = mbedtls_mpi_write_file("P = ", &P, 16, fpriv)) != 0 || in main() 131 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); in main()
|
D | rsa_decrypt.c | 44 mbedtls_mpi N, P, Q, D, E, DP, DQ, QP; in main() local 70 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); in main() 95 (ret = mbedtls_mpi_read_file(&P, 16, f)) != 0 || in main() 107 if ((ret = mbedtls_rsa_import(&rsa, &N, &P, &Q, &D, &E)) != 0) { in main() 166 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); in main()
|
/mbedtls-latest/include/mbedtls/ |
D | ecp.h | 235 mbedtls_mpi P; /*!< The prime modulus of the base field. */ member 680 int mbedtls_ecp_copy(mbedtls_ecp_point *P, const mbedtls_ecp_point *Q); 730 int mbedtls_ecp_point_cmp(const mbedtls_ecp_point *P, 745 int mbedtls_ecp_point_read_string(mbedtls_ecp_point *P, int radix, 774 const mbedtls_ecp_point *P, 804 mbedtls_ecp_point *P, 968 const mbedtls_mpi *m, const mbedtls_ecp_point *P, 1002 const mbedtls_mpi *m, const mbedtls_ecp_point *P, 1063 const mbedtls_mpi *m, const mbedtls_ecp_point *P, 1108 const mbedtls_mpi *m, const mbedtls_ecp_point *P,
|
/mbedtls-latest/programs/fuzz/ |
D | fuzz_pubkey.c | 23 mbedtls_mpi N, P, Q, D, E, DP, DQ, QP; in LLVMFuzzerTestOneInput() local 26 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q); in LLVMFuzzerTestOneInput() 34 if (mbedtls_rsa_export(rsa, &N, &P, &Q, &D, &E) != MBEDTLS_ERR_RSA_BAD_INPUT_DATA) { in LLVMFuzzerTestOneInput() 41 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); in LLVMFuzzerTestOneInput()
|