Home
last modified time | relevance | path

Searched refs:MBEDTLS_MPI_CHK (Results 1 – 25 of 26) sorted by relevance

12

/mbedtls-3.7.0/library/
Drsa_alt_helpers.c95 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&T, D, E)); in mbedtls_rsa_deduce_primes()
96 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&T, &T, 1)); in mbedtls_rsa_deduce_primes()
104 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(&T, order)); in mbedtls_rsa_deduce_primes()
117 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&K, primes[attempt])); 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()
138 MBEDTLS_MPI_CHK(mbedtls_mpi_add_int(&K, &K, 1)); in mbedtls_rsa_deduce_primes()
139 MBEDTLS_MPI_CHK(mbedtls_mpi_gcd(P, &K, N)); in mbedtls_rsa_deduce_primes()
148 MBEDTLS_MPI_CHK(mbedtls_mpi_div_mpi(Q, NULL, N, P)); in mbedtls_rsa_deduce_primes()
152 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&K, &K, 1)); in mbedtls_rsa_deduce_primes()
[all …]
Dbignum.c123 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(X, Y->n)); in mbedtls_mpi_safe_cond_assign()
161 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(X, Y->n)); in mbedtls_mpi_safe_cond_swap()
162 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(Y, X->n)); in mbedtls_mpi_safe_cond_swap()
333 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(X, i)); in mbedtls_mpi_copy()
380 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(X, 1)); in mbedtls_mpi_lset()
421 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(X, off + 1)); in mbedtls_mpi_set_bit()
545 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(X, n)); in mbedtls_mpi_read_string()
546 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(X, 0)); in mbedtls_mpi_read_string()
549 MBEDTLS_MPI_CHK(mpi_get_digit(&d, radix, s[i - 1])); in mbedtls_mpi_read_string()
553 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(X, 0)); in mbedtls_mpi_read_string()
[all …]
Decp.c620 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()
642 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&pt->X, 1)); in mbedtls_ecp_set_zero()
643 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&pt->Y, 1)); in mbedtls_ecp_set_zero()
644 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&pt->Z, 0)); in mbedtls_ecp_set_zero()
680 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&P->X, radix, x)); in mbedtls_ecp_point_read_string()
681 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&P->Y, radix, y)); in mbedtls_ecp_point_read_string()
682 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&P->Z, 1)); in mbedtls_ecp_point_read_string()
713 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary_le(&P->X, buf, plen)); in mbedtls_ecp_point_write_binary()
[all …]
Decjpake.c114 MBEDTLS_MPI_CHK(mbedtls_ecp_group_load(&ctx->grp, curve)); in mbedtls_ecjpake_setup()
116 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->s, secret, len)); in mbedtls_ecjpake_setup()
209 MBEDTLS_MPI_CHK(ecjpake_write_len_point(&p, end, grp, pf, G)); in ecjpake_hash()
210 MBEDTLS_MPI_CHK(ecjpake_write_len_point(&p, end, grp, pf, V)); in ecjpake_hash()
211 MBEDTLS_MPI_CHK(ecjpake_write_len_point(&p, end, grp, pf, X)); in ecjpake_hash()
228 MBEDTLS_MPI_CHK(mbedtls_ecjpake_compute_hash(md_type, in ecjpake_hash()
232 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(h, hash, in ecjpake_hash()
234 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(h, h, &grp->N)); in ecjpake_hash()
272 MBEDTLS_MPI_CHK(mbedtls_ecp_tls_read_point(grp, &V, p, (size_t) (end - *p))); in ecjpake_zkp_read()
286 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&r, *p, r_len)); in ecjpake_zkp_read()
[all …]
Drsa.c603 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->N, N, N_len)); in mbedtls_rsa_import_raw()
608 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->P, P, P_len)); in mbedtls_rsa_import_raw()
612 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->Q, Q, Q_len)); in mbedtls_rsa_import_raw()
616 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->D, D, D_len)); in mbedtls_rsa_import_raw()
620 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->E, E, E_len)); in mbedtls_rsa_import_raw()
847 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&ctx->N, N, N_len)); in mbedtls_rsa_export_raw()
851 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&ctx->P, P, P_len)); in mbedtls_rsa_export_raw()
855 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&ctx->Q, Q, Q_len)); in mbedtls_rsa_export_raw()
859 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&ctx->D, D, D_len)); in mbedtls_rsa_export_raw()
863 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&ctx->E, E, E_len)); in mbedtls_rsa_export_raw()
[all …]
Ddhm.c86 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&U, P, 2)); in dhm_check_range()
173 MBEDTLS_MPI_CHK(mbedtls_mpi_random(R, 3, M, f_rng, p_rng)); in dhm_random_below()
174 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(R, R, 1)); in dhm_random_below()
194 MBEDTLS_MPI_CHK(mbedtls_mpi_fill_random(&ctx->X, x_size, f_rng, p_rng)); in dhm_make_common()
209 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&ctx->GX, &ctx->G, &ctx->X, in dhm_make_common()
243 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary((X), \ in mbedtls_dhm_make_params()
327 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&ctx->GX, output, olen)); in mbedtls_dhm_make_public()
356 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&ctx->pX, &ctx->X)); in dhm_update_blinding()
357 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&ctx->Vi, 1)); in dhm_update_blinding()
358 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&ctx->Vf, 1)); in dhm_update_blinding()
[all …]
Decdsa.c150 MBEDTLS_MPI_CHK(mbedtls_ecp_check_budget(grp, ECDSA_RS_ECP, ops));
210 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(x, buf, use_size)); in derive_mpi()
212 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(x, use_size * 8 - grp->nbits)); in derive_mpi()
217 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(x, x, &grp->N)); in derive_mpi()
308 MBEDTLS_MPI_CHK(mbedtls_ecp_gen_privkey(grp, pk, f_rng, p_rng)); in mbedtls_ecdsa_sign_restartable()
317 MBEDTLS_MPI_CHK(mbedtls_ecp_mul_restartable(grp, &R, pk, &grp->G, in mbedtls_ecdsa_sign_restartable()
321 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(pr, &R.X, &grp->N)); in mbedtls_ecdsa_sign_restartable()
340 MBEDTLS_MPI_CHK(derive_mpi(grp, &e, buf, blen)); in mbedtls_ecdsa_sign_restartable()
346 MBEDTLS_MPI_CHK(mbedtls_ecp_gen_privkey(grp, &t, f_rng_blind, in mbedtls_ecdsa_sign_restartable()
352 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(s, pr, d)); in mbedtls_ecdsa_sign_restartable()
[all …]
Dpsa_crypto_ffdh.c121 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(P, dhm_P, in mbedtls_psa_ffdh_set_prime_generator()
125 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(G, dhm_G, in mbedtls_psa_ffdh_set_prime_generator()
178 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&X, key_buffer, 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()
182 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&GX, data, key_len)); in mbedtls_psa_ffdh_export_public_key()
220 MBEDTLS_MPI_CHK(mbedtls_mpi_random(&X, 3, &P, mbedtls_psa_get_random, in mbedtls_psa_ffdh_generate_key()
222 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&X, &X, 1)); in mbedtls_psa_ffdh_generate_key()
223 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&X, key_buffer, key_buffer_size)); in mbedtls_psa_ffdh_generate_key()
292 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&X, key_buffer, in mbedtls_psa_ffdh_key_agreement()
295 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&GY, peer_key, in mbedtls_psa_ffdh_key_agreement()
[all …]
Decp_curves.c4627 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&grp->A, curve25519_a24)); in ecp_use_curve25519()
4630 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&grp->P, 1)); in ecp_use_curve25519()
4631 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_l(&grp->P, 255)); in ecp_use_curve25519()
4632 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&grp->P, &grp->P, 19)); in ecp_use_curve25519()
4636 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&grp->N, in ecp_use_curve25519()
4638 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(&grp->N, 252, 1)); in ecp_use_curve25519()
4642 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&grp->G.X, 9)); in ecp_use_curve25519()
4643 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&grp->G.Z, 1)); in ecp_use_curve25519()
4679 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&grp->A, curve448_a24)); in ecp_use_curve448()
4682 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&grp->P, 1)); in ecp_use_curve448()
[all …]
Dbignum_core.c587 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(X, 1)); in mbedtls_mpi_core_get_mont_r2_unsafe()
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()
590 MBEDTLS_MPI_CHK(mbedtls_mpi_shrink(X, N->n)); in mbedtls_mpi_core_get_mont_r2_unsafe()
630 MBEDTLS_MPI_CHK(f_rng(p_rng, (unsigned char *) X + overhead, n_bytes)); in mbedtls_mpi_core_fill_random()
677 MBEDTLS_MPI_CHK(mbedtls_mpi_core_fill_random(X, limbs, in mbedtls_mpi_core_random()
Dpsa_crypto_ecp.c399 MBEDTLS_MPI_CHK(mbedtls_ecdsa_sign_det_ext( in mbedtls_psa_ecdsa_sign_hash()
411 MBEDTLS_MPI_CHK(mbedtls_ecdsa_sign(&ecp->grp, &r, &s, &ecp->d, in mbedtls_psa_ecdsa_sign_hash()
417 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&r, in mbedtls_psa_ecdsa_sign_hash()
420 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&s, in mbedtls_psa_ecdsa_sign_hash()
Decdh.c68 MBEDTLS_MPI_CHK(mbedtls_ecp_gen_privkey(grp, d, f_rng, p_rng)); in ecdh_gen_public_restartable()
71 MBEDTLS_MPI_CHK(mbedtls_ecp_mul_restartable(grp, Q, d, &grp->G, in ecdh_gen_public_restartable()
105 MBEDTLS_MPI_CHK(mbedtls_ecp_mul_restartable(grp, &P, d, Q, in ecdh_compute_shared_restartable()
113 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(z, &P.X)); in ecdh_compute_shared_restartable()
Decp_curves_new.c4669 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&grp->A, curve25519_a24)); in ecp_use_curve25519()
4679 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&grp->G.X, 9)); in ecp_use_curve25519()
4680 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&grp->G.Z, 1)); in ecp_use_curve25519()
4731 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&grp->A, curve448_a24)); in ecp_use_curve448()
4738 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&grp->G.X, 5)); in ecp_use_curve448()
4739 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&grp->G.Z, 1)); in ecp_use_curve448()
4910 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(N, expected_width)); in ecp_mod_p192()
5070 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(N, expected_width)); in ecp_mod_p224()
5123 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(N, expected_width)); in ecp_mod_p256()
5203 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(N, expected_width)); in ecp_mod_p384()
[all …]
Dpk_wrap.c891 MBEDTLS_MPI_CHK(mbedtls_ecdsa_from_keypair(&rs->ecdsa_ctx, pk->pk_ctx)); in eckey_verify_rs_wrap()
894 MBEDTLS_MPI_CHK(ecdsa_verify_rs_wrap(pk, in eckey_verify_rs_wrap()
918 MBEDTLS_MPI_CHK(mbedtls_ecdsa_from_keypair(&rs->ecdsa_ctx, pk->pk_ctx)); in eckey_sign_rs_wrap()
921 MBEDTLS_MPI_CHK(ecdsa_sign_rs_wrap(pk, md_alg, in eckey_sign_rs_wrap()
Dasn1write.c119 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(X, *p, len)); in mbedtls_asn1_write_mpi()
Dbignum_mod.c227 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_modulus_setup(&Nmont, N->p, N->limbs)); in mbedtls_mpi_mod_inv_non_mont()
Dpsa_crypto.c6189 MBEDTLS_MPI_CHK(mbedtls_ecp_group_load(&ecp_group, grp_id));
6198 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&diff_N_2, &ecp_group.N, 2));
6227 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&k, *data, m_bytes));
6233 MBEDTLS_MPI_CHK(mbedtls_mpi_lt_mpi_ct(&diff_N_2, &k, &key_out_of_range));
6237 MBEDTLS_MPI_CHK(mbedtls_mpi_add_int(&k, &k, 1));
6238 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&k, *data, m_bytes));
Dpkparse.c271 MBEDTLS_MPI_CHK(mbedtls_ecp_group_load(&ref, *id)); in pk_group_id_from_group()
/mbedtls-3.7.0/programs/pkey/
Dmpi_demo.c37 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&P, 10, "2789")); in main()
38 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&Q, 10, "3203")); in main()
39 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&E, 10, "257")); 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()
44 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file(" E = ", &E, 10, NULL)); in main()
47 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file(" P = ", &P, 10, NULL)); in main()
48 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file(" Q = ", &Q, 10, NULL)); in main()
51 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&P, &P, 1)); in main()
52 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&Q, &Q, 1)); in main()
[all …]
Dkey_app.c75 MBEDTLS_MPI_CHK(mbedtls_ecp_export(ecp, &grp, in show_ecp_key()
81 MBEDTLS_MPI_CHK(mbedtls_ecp_point_write_binary( in show_ecp_key()
91 MBEDTLS_MPI_CHK( in show_ecp_key()
93 MBEDTLS_MPI_CHK( in show_ecp_key()
99 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&X, point_bin, len)); in show_ecp_key()
275 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("N: ", &N, 16, NULL)); in main()
276 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("E: ", &E, 16, NULL)); in main()
277 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("D: ", &D, 16, NULL)); in main()
278 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("P: ", &P, 16, NULL)); in main()
279 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("Q: ", &Q, 16, NULL)); in main()
[all …]
Dkey_app_writer.c195 MBEDTLS_MPI_CHK(mbedtls_ecp_export(ecp, &grp, in show_ecp_key()
201 MBEDTLS_MPI_CHK(mbedtls_ecp_point_write_binary( in show_ecp_key()
211 MBEDTLS_MPI_CHK( in show_ecp_key()
213 MBEDTLS_MPI_CHK( in show_ecp_key()
219 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&X, point_bin, len)); in show_ecp_key()
Dgen_key.c179 MBEDTLS_MPI_CHK(mbedtls_ecp_export(ecp, &grp, in show_ecp_key()
185 MBEDTLS_MPI_CHK(mbedtls_ecp_point_write_binary( in show_ecp_key()
195 MBEDTLS_MPI_CHK( in show_ecp_key()
197 MBEDTLS_MPI_CHK( in show_ecp_key()
203 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&X, point_bin, len)); in show_ecp_key()
/mbedtls-3.7.0/tests/suites/
Dtest_suite_ecjpake.function76 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->xm1, xm1, len_xm1));
77 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->xm2, xm2, len_xm2));
79 MBEDTLS_MPI_CHK(mbedtls_ecp_point_read_binary(&ctx->grp,
81 MBEDTLS_MPI_CHK(mbedtls_ecp_point_read_binary(&ctx->grp,
83 MBEDTLS_MPI_CHK(mbedtls_ecp_point_read_binary(&ctx->grp,
85 MBEDTLS_MPI_CHK(mbedtls_ecp_point_read_binary(&ctx->grp,
/mbedtls-3.7.0/include/mbedtls/
Dbignum.h40 #define MBEDTLS_MPI_CHK(f) \ macro
Decp.h408 MBEDTLS_MPI_CHK(mbedtls_ecp_check_budget(grp, rs_ctx, \

12