Lines Matching refs:MBEDTLS_MPI_CHK
606 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->N, N, N_len)); in mbedtls_rsa_import_raw()
611 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->P, P, P_len)); in mbedtls_rsa_import_raw()
615 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->Q, Q, Q_len)); in mbedtls_rsa_import_raw()
619 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->D, D, D_len)); in mbedtls_rsa_import_raw()
623 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->E, E, E_len)); in mbedtls_rsa_import_raw()
850 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&ctx->N, N, N_len)); in mbedtls_rsa_export_raw()
854 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&ctx->P, P, P_len)); in mbedtls_rsa_export_raw()
858 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&ctx->Q, Q, Q_len)); in mbedtls_rsa_export_raw()
862 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&ctx->D, D, D_len)); in mbedtls_rsa_export_raw()
866 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&ctx->E, E, E_len)); in mbedtls_rsa_export_raw()
1084 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&ctx->E, exponent)); in mbedtls_rsa_gen_key()
1087 MBEDTLS_MPI_CHK(mbedtls_mpi_gen_prime(&ctx->P, nbits >> 1, in mbedtls_rsa_gen_key()
1090 MBEDTLS_MPI_CHK(mbedtls_mpi_gen_prime(&ctx->Q, nbits >> 1, in mbedtls_rsa_gen_key()
1094 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(&H, &ctx->P, &ctx->Q)); in mbedtls_rsa_gen_key()
1105 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&ctx->P, &ctx->P, 1)); in mbedtls_rsa_gen_key()
1106 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&ctx->Q, &ctx->Q, 1)); in mbedtls_rsa_gen_key()
1107 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&H, &ctx->P, &ctx->Q)); in mbedtls_rsa_gen_key()
1110 MBEDTLS_MPI_CHK(mbedtls_mpi_gcd(&G, &ctx->E, &H)); in mbedtls_rsa_gen_key()
1116 MBEDTLS_MPI_CHK(mbedtls_mpi_gcd(&G, &ctx->P, &ctx->Q)); in mbedtls_rsa_gen_key()
1117 MBEDTLS_MPI_CHK(mbedtls_mpi_div_mpi(&L, NULL, &H, &G)); in mbedtls_rsa_gen_key()
1118 MBEDTLS_MPI_CHK(mbedtls_mpi_inv_mod(&ctx->D, &ctx->E, &L)); in mbedtls_rsa_gen_key()
1128 MBEDTLS_MPI_CHK(mbedtls_mpi_add_int(&ctx->P, &ctx->P, 1)); in mbedtls_rsa_gen_key()
1129 MBEDTLS_MPI_CHK(mbedtls_mpi_add_int(&ctx->Q, &ctx->Q, 1)); in mbedtls_rsa_gen_key()
1131 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&ctx->N, &ctx->P, &ctx->Q)); in mbedtls_rsa_gen_key()
1141 MBEDTLS_MPI_CHK(mbedtls_rsa_deduce_crt(&ctx->P, &ctx->Q, &ctx->D, in mbedtls_rsa_gen_key()
1146 MBEDTLS_MPI_CHK(mbedtls_rsa_check_privkey(ctx)); in mbedtls_rsa_gen_key()
1257 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&T, input, ctx->len)); in mbedtls_rsa_public()
1265 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod_unsafe(&T, &T, &ctx->E, &ctx->N, &ctx->RN)); in mbedtls_rsa_public()
1266 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&T, output, olen)); in mbedtls_rsa_public()
1300 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&ctx->Vi, &ctx->Vi, &ctx->Vi)); in rsa_prepare_blinding()
1301 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&ctx->Vi, &ctx->Vi, &ctx->N)); in rsa_prepare_blinding()
1302 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&ctx->Vf, &ctx->Vf, &ctx->Vf)); in rsa_prepare_blinding()
1303 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&ctx->Vf, &ctx->Vf, &ctx->N)); in rsa_prepare_blinding()
1315 MBEDTLS_MPI_CHK(mbedtls_mpi_fill_random(&ctx->Vf, ctx->len - 1, f_rng, p_rng)); in rsa_prepare_blinding()
1318 MBEDTLS_MPI_CHK(mbedtls_mpi_fill_random(&R, ctx->len - 1, f_rng, p_rng)); in rsa_prepare_blinding()
1319 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&ctx->Vi, &ctx->Vf, &R)); in rsa_prepare_blinding()
1320 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&ctx->Vi, &ctx->Vi, &ctx->N)); in rsa_prepare_blinding()
1334 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&ctx->Vi, &ctx->Vi, &R)); in rsa_prepare_blinding()
1335 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&ctx->Vi, &ctx->Vi, &ctx->N)); in rsa_prepare_blinding()
1339 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&ctx->Vi, &ctx->Vi, &ctx->E, &ctx->N, &ctx->RN)); in rsa_prepare_blinding()
1363 MBEDTLS_MPI_CHK(mbedtls_mpi_core_get_mont_r2_unsafe(&RR, N)); in rsa_unblind()
1364 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(&M_T, tlimbs)); in rsa_unblind()
1366 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(T, nlimbs)); in rsa_unblind()
1367 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(Vf, nlimbs)); in rsa_unblind()
1481 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&T, input, ctx->len)); in mbedtls_rsa_private()
1491 MBEDTLS_MPI_CHK(rsa_prepare_blinding(ctx, f_rng, p_rng)); in mbedtls_rsa_private()
1492 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&T, &T, &ctx->Vi)); in mbedtls_rsa_private()
1493 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&T, &T, &ctx->N)); in mbedtls_rsa_private()
1495 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&input_blinded, &T)); in mbedtls_rsa_private()
1500 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&P1, &ctx->P, 1)); in mbedtls_rsa_private()
1501 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&Q1, &ctx->Q, 1)); in mbedtls_rsa_private()
1507 MBEDTLS_MPI_CHK(mbedtls_mpi_fill_random(&R, RSA_EXPONENT_BLINDING, in mbedtls_rsa_private()
1509 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&D_blind, &P1, &Q1)); in mbedtls_rsa_private()
1510 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&D_blind, &D_blind, &R)); in mbedtls_rsa_private()
1511 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(&D_blind, &D_blind, &ctx->D)); in mbedtls_rsa_private()
1516 MBEDTLS_MPI_CHK(mbedtls_mpi_fill_random(&R, RSA_EXPONENT_BLINDING, in mbedtls_rsa_private()
1518 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&DP_blind, &P1, &R)); in mbedtls_rsa_private()
1519 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(&DP_blind, &DP_blind, in mbedtls_rsa_private()
1525 MBEDTLS_MPI_CHK(mbedtls_mpi_fill_random(&R, RSA_EXPONENT_BLINDING, in mbedtls_rsa_private()
1527 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&DQ_blind, &Q1, &R)); in mbedtls_rsa_private()
1528 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(&DQ_blind, &DQ_blind, in mbedtls_rsa_private()
1533 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&T, &T, &D_blind, &ctx->N, &ctx->RN)); in mbedtls_rsa_private()
1542 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&TP, &T, &DP_blind, &ctx->P, &ctx->RP)); in mbedtls_rsa_private()
1543 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&TQ, &T, &DQ_blind, &ctx->Q, &ctx->RQ)); in mbedtls_rsa_private()
1548 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(&T, &TP, &TQ)); in mbedtls_rsa_private()
1549 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&TP, &T, &ctx->QP)); in mbedtls_rsa_private()
1550 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&T, &TP, &ctx->P)); in mbedtls_rsa_private()
1555 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&TP, &T, &ctx->Q)); in mbedtls_rsa_private()
1556 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(&T, &TQ, &TP)); in mbedtls_rsa_private()
1560 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&check_result_blinded, &T, &ctx->E, in mbedtls_rsa_private()
1571 MBEDTLS_MPI_CHK(rsa_unblind(&T, &ctx->Vf, &ctx->N)); in mbedtls_rsa_private()
1574 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&T, output, olen)); in mbedtls_rsa_private()
2480 MBEDTLS_MPI_CHK(mbedtls_rsa_private(ctx, f_rng, p_rng, sig, sig_try)); in mbedtls_rsa_rsassa_pkcs1_v15_sign()
2481 MBEDTLS_MPI_CHK(mbedtls_rsa_public(ctx, sig_try, verif)); in mbedtls_rsa_rsassa_pkcs1_v15_sign()
2787 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->N, &src->N)); in mbedtls_rsa_copy()
2788 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->E, &src->E)); in mbedtls_rsa_copy()
2790 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->D, &src->D)); in mbedtls_rsa_copy()
2791 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->P, &src->P)); in mbedtls_rsa_copy()
2792 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->Q, &src->Q)); in mbedtls_rsa_copy()
2795 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->DP, &src->DP)); in mbedtls_rsa_copy()
2796 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->DQ, &src->DQ)); in mbedtls_rsa_copy()
2797 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->QP, &src->QP)); in mbedtls_rsa_copy()
2798 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->RP, &src->RP)); in mbedtls_rsa_copy()
2799 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->RQ, &src->RQ)); in mbedtls_rsa_copy()
2802 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->RN, &src->RN)); in mbedtls_rsa_copy()
2804 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->Vi, &src->Vi)); in mbedtls_rsa_copy()
2805 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->Vf, &src->Vf)); in mbedtls_rsa_copy()
2943 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&K, 16, RSA_N)); in mbedtls_rsa_self_test()
2944 MBEDTLS_MPI_CHK(mbedtls_rsa_import(&rsa, &K, NULL, NULL, NULL, NULL)); in mbedtls_rsa_self_test()
2945 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&K, 16, RSA_P)); in mbedtls_rsa_self_test()
2946 MBEDTLS_MPI_CHK(mbedtls_rsa_import(&rsa, NULL, &K, NULL, NULL, NULL)); in mbedtls_rsa_self_test()
2947 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&K, 16, RSA_Q)); in mbedtls_rsa_self_test()
2948 MBEDTLS_MPI_CHK(mbedtls_rsa_import(&rsa, NULL, NULL, &K, NULL, NULL)); in mbedtls_rsa_self_test()
2949 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&K, 16, RSA_D)); in mbedtls_rsa_self_test()
2950 MBEDTLS_MPI_CHK(mbedtls_rsa_import(&rsa, NULL, NULL, NULL, &K, NULL)); in mbedtls_rsa_self_test()
2951 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&K, 16, RSA_E)); in mbedtls_rsa_self_test()
2952 MBEDTLS_MPI_CHK(mbedtls_rsa_import(&rsa, NULL, NULL, NULL, NULL, &K)); in mbedtls_rsa_self_test()
2954 MBEDTLS_MPI_CHK(mbedtls_rsa_complete(&rsa)); in mbedtls_rsa_self_test()