/mbedtls-3.5.0/library/ |
D | md5.c | 103 #define P(a, b, c, d, k, s, t) \ in mbedtls_internal_md5_process() macro 117 P(local.A, local.B, local.C, local.D, 0, 7, 0xD76AA478); in mbedtls_internal_md5_process() 118 P(local.D, local.A, local.B, local.C, 1, 12, 0xE8C7B756); in mbedtls_internal_md5_process() 119 P(local.C, local.D, local.A, local.B, 2, 17, 0x242070DB); in mbedtls_internal_md5_process() 120 P(local.B, local.C, local.D, local.A, 3, 22, 0xC1BDCEEE); in mbedtls_internal_md5_process() 121 P(local.A, local.B, local.C, local.D, 4, 7, 0xF57C0FAF); in mbedtls_internal_md5_process() 122 P(local.D, local.A, local.B, local.C, 5, 12, 0x4787C62A); in mbedtls_internal_md5_process() 123 P(local.C, local.D, local.A, local.B, 6, 17, 0xA8304613); in mbedtls_internal_md5_process() 124 P(local.B, local.C, local.D, local.A, 7, 22, 0xFD469501); in mbedtls_internal_md5_process() 125 P(local.A, local.B, local.C, local.D, 8, 7, 0x698098D8); in mbedtls_internal_md5_process() [all …]
|
D | sha1.c | 112 #define P(a, b, c, d, e, x) \ in mbedtls_internal_sha1_process() macro 128 P(local.A, local.B, local.C, local.D, local.E, local.W[0]); in mbedtls_internal_sha1_process() 129 P(local.E, local.A, local.B, local.C, local.D, local.W[1]); in mbedtls_internal_sha1_process() 130 P(local.D, local.E, local.A, local.B, local.C, local.W[2]); in mbedtls_internal_sha1_process() 131 P(local.C, local.D, local.E, local.A, local.B, local.W[3]); in mbedtls_internal_sha1_process() 132 P(local.B, local.C, local.D, local.E, local.A, local.W[4]); in mbedtls_internal_sha1_process() 133 P(local.A, local.B, local.C, local.D, local.E, local.W[5]); in mbedtls_internal_sha1_process() 134 P(local.E, local.A, local.B, local.C, local.D, local.W[6]); in mbedtls_internal_sha1_process() 135 P(local.D, local.E, local.A, local.B, local.C, local.W[7]); in mbedtls_internal_sha1_process() 136 P(local.C, local.D, local.E, local.A, local.B, local.W[8]); in mbedtls_internal_sha1_process() [all …]
|
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() 132 MBEDTLS_MPI_CHK(mbedtls_mpi_gcd(P, &K, N)); in mbedtls_rsa_deduce_primes() 133 if (mbedtls_mpi_cmp_int(P, 1) != 0) { in mbedtls_rsa_deduce_primes() 151 MBEDTLS_MPI_CHK(mbedtls_mpi_gcd(P, &K, N)); in mbedtls_rsa_deduce_primes() 153 if (mbedtls_mpi_cmp_int(P, 1) == 1 && in mbedtls_rsa_deduce_primes() 154 mbedtls_mpi_cmp_mpi(P, N) == -1) { in mbedtls_rsa_deduce_primes() 160 MBEDTLS_MPI_CHK(mbedtls_mpi_div_mpi(Q, NULL, N, P)); in mbedtls_rsa_deduce_primes() 194 int mbedtls_rsa_deduce_private_exponent(mbedtls_mpi const *P, in mbedtls_rsa_deduce_private_exponent() argument 206 if (mbedtls_mpi_cmp_int(P, 1) <= 0 || in mbedtls_rsa_deduce_private_exponent() [all …]
|
D | ecp.c | 520 mbedtls_mpi_init(&grp->P); in mbedtls_ecp_group_init() 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() 676 int mbedtls_ecp_point_read_string(mbedtls_ecp_point *P, int radix, in mbedtls_ecp_point_read_string() argument [all …]
|
D | dhm.c | 91 static int dhm_check_range(const mbedtls_mpi *param, const mbedtls_mpi *P) in dhm_check_range() argument 98 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&U, P, 2)); in dhm_check_range() 117 return mbedtls_mpi_bitlen(&ctx->P); in mbedtls_dhm_get_bitlen() 122 return mbedtls_mpi_size(&ctx->P); in mbedtls_dhm_get_len() 132 src = &ctx->P; in mbedtls_dhm_get_value() 164 if ((ret = dhm_read_bignum(&ctx->P, p, end)) != 0 || in mbedtls_dhm_read_params() 170 if ((ret = dhm_check_range(&ctx->GY, &ctx->P)) != 0) { in mbedtls_dhm_read_params() 198 if (mbedtls_mpi_cmp_int(&ctx->P, 0) == 0) { in dhm_make_common() 205 if ((unsigned) x_size < mbedtls_mpi_size(&ctx->P)) { in dhm_make_common() 209 ret = dhm_random_below(&ctx->X, &ctx->P, f_rng, p_rng); in dhm_make_common() [all …]
|
D | rsa.c | 75 const mbedtls_mpi *P, const mbedtls_mpi *Q, in mbedtls_rsa_import() argument 81 (P != NULL && (ret = mbedtls_mpi_copy(&ctx->P, P)) != 0) || in mbedtls_rsa_import() 97 unsigned char const *P, size_t P_len, in mbedtls_rsa_import_raw() argument 109 if (P != NULL) { in mbedtls_rsa_import_raw() 110 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->P, P, P_len)); in mbedtls_rsa_import_raw() 169 (mbedtls_mpi_cmp_int(&ctx->P, 0) <= 0 || in rsa_check_context() 170 mbedtls_mpi_get_bit(&ctx->P, 0) == 0 || in rsa_check_context() 205 (mbedtls_mpi_cmp_int(&ctx->P, 0) <= 0 || in rsa_check_context() 233 have_P = (mbedtls_mpi_cmp_int(&ctx->P, 0) != 0); in mbedtls_rsa_complete() 271 if ((ret = mbedtls_mpi_mul_mpi(&ctx->N, &ctx->P, in mbedtls_rsa_complete() [all …]
|
D | rsa_alt_helpers.h | 93 mbedtls_mpi *P, mbedtls_mpi *Q); 116 int mbedtls_rsa_deduce_private_exponent(mbedtls_mpi const *P, 142 int mbedtls_rsa_deduce_crt(const mbedtls_mpi *P, const mbedtls_mpi *Q, 177 int mbedtls_rsa_validate_params(const mbedtls_mpi *N, const mbedtls_mpi *P, 212 int mbedtls_rsa_validate_crt(const mbedtls_mpi *P, const mbedtls_mpi *Q,
|
D | ecp_internal_alt.h | 168 mbedtls_ecp_point *R, const mbedtls_ecp_point *P, 193 mbedtls_ecp_point *R, const mbedtls_ecp_point *P); 252 const mbedtls_ecp_point *P, 274 mbedtls_ecp_point *P, int (*f_rng)(void *, 292 mbedtls_ecp_point *P);
|
D | sha256.c | 440 #define P(a, b, c, d, e, f, g, h, x, K) \ macro 477 P(local.A[0], local.A[1], local.A[2], local.A[3], local.A[4], in mbedtls_internal_sha256_process_c() 492 P(local.A[0], local.A[1], local.A[2], local.A[3], local.A[4], in mbedtls_internal_sha256_process_c() 494 P(local.A[7], local.A[0], local.A[1], local.A[2], local.A[3], in mbedtls_internal_sha256_process_c() 496 P(local.A[6], local.A[7], local.A[0], local.A[1], local.A[2], in mbedtls_internal_sha256_process_c() 498 P(local.A[5], local.A[6], local.A[7], local.A[0], local.A[1], in mbedtls_internal_sha256_process_c() 500 P(local.A[4], local.A[5], local.A[6], local.A[7], local.A[0], in mbedtls_internal_sha256_process_c() 502 P(local.A[3], local.A[4], local.A[5], local.A[6], local.A[7], in mbedtls_internal_sha256_process_c() 504 P(local.A[2], local.A[3], local.A[4], local.A[5], local.A[6], in mbedtls_internal_sha256_process_c() 506 P(local.A[1], local.A[2], local.A[3], local.A[4], local.A[5], in mbedtls_internal_sha256_process_c() [all …]
|
/mbedtls-3.5.0/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 | 169 mbedtls_mpi N, P, Q, E; 172 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); 181 TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0); 186 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 202 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); 247 mbedtls_mpi N, P, Q, E; 251 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); 260 TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0); 265 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 281 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); [all …]
|
D | test_suite_ecp.function | 26 if (mbedtls_mpi_cmp_mpi(&grp1->P, &grp2->P) != 0) { 86 mbedtls_ecp_point P; 92 mbedtls_ecp_point_init(&P); 95 mbedtls_ecp_point_write_binary(&grp, &P, 100 mbedtls_ecp_tls_write_point(&grp, &P, 137 mbedtls_ecp_point P; 140 mbedtls_ecp_point_init(&P); 144 TEST_ASSERT(mbedtls_test_read_mpi(&P.X, x_hex) == 0); 145 TEST_ASSERT(mbedtls_test_read_mpi(&P.Y, y_hex) == 0); 146 TEST_ASSERT(mbedtls_test_read_mpi(&P.Z, z_hex) == 0); [all …]
|
D | test_suite_rsa.data | 285 RSA Check Private key #2 (No P) 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; 72 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); 85 TEST_ASSERT(mbedtls_mpi_read_binary(&P, input_P->x, input_P->len) == 0); 90 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 114 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); 130 mbedtls_mpi N, P, Q, E; 137 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); 148 TEST_ASSERT(mbedtls_mpi_read_binary(&P, input_P->x, input_P->len) == 0); 153 TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0); 179 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P);
|
/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() 49 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&P, 10, "2789")); in main() 52 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&N, &P, &Q)); in main() 59 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file(" P = ", &P, 10, NULL)); in main() 63 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&P, &P, 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 | 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() 120 if ((ret = mbedtls_mpi_gen_prime(&P, nbits, 1, in main() 129 if ((ret = mbedtls_mpi_sub_int(&Q, &P, 1)) != 0) { in main() 152 if (((ret = mbedtls_mpi_write_file("P = ", &P, 16, fout)) != 0) || in main() 166 mbedtls_mpi_free(&G); 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() 122 (ret = mbedtls_mpi_read_file(&P, 16, f)) != 0 || in main() 131 if ((ret = mbedtls_rsa_import(&rsa, &N, &P, &Q, &D, &E)) != 0) { in main() 155 if (mbedtls_mpi_read_file(&dhm.MBEDTLS_PRIVATE(P), 16, f) != 0 || in main() 190 mbedtls_dhm_make_params(&dhm, (int) mbedtls_mpi_size(&dhm.MBEDTLS_PRIVATE(P)), buf, &n, in main() 290 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q); in main()
|
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() 121 (ret = mbedtls_mpi_write_file("P = ", &P, 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() 83 (ret = mbedtls_mpi_read_file(&P, 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() 107 (ret = mbedtls_mpi_read_file(&P, 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()
|
/mbedtls-3.5.0/include/mbedtls/ |
D | ecp.h | 234 mbedtls_mpi P; /*!< The prime modulus of the base field. */ member 676 int mbedtls_ecp_copy(mbedtls_ecp_point *P, const mbedtls_ecp_point *Q); 726 int mbedtls_ecp_point_cmp(const mbedtls_ecp_point *P, 741 int mbedtls_ecp_point_read_string(mbedtls_ecp_point *P, int radix, 770 const mbedtls_ecp_point *P, 800 mbedtls_ecp_point *P, 964 const mbedtls_mpi *m, const mbedtls_ecp_point *P, 998 const mbedtls_mpi *m, const mbedtls_ecp_point *P, 1039 const mbedtls_mpi *m, const mbedtls_ecp_point *P, 1084 const mbedtls_mpi *m, const mbedtls_ecp_point *P,
|
/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()
|