Lines Matching refs:MBEDTLS_MPI_CHK
603 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()
1081 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&ctx->E, exponent)); in mbedtls_rsa_gen_key()
1084 MBEDTLS_MPI_CHK(mbedtls_mpi_gen_prime(&ctx->P, nbits >> 1, in mbedtls_rsa_gen_key()
1087 MBEDTLS_MPI_CHK(mbedtls_mpi_gen_prime(&ctx->Q, nbits >> 1, in mbedtls_rsa_gen_key()
1091 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(&H, &ctx->P, &ctx->Q)); in mbedtls_rsa_gen_key()
1102 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&ctx->P, &ctx->P, 1)); in mbedtls_rsa_gen_key()
1103 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&ctx->Q, &ctx->Q, 1)); in mbedtls_rsa_gen_key()
1104 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&H, &ctx->P, &ctx->Q)); in mbedtls_rsa_gen_key()
1107 MBEDTLS_MPI_CHK(mbedtls_mpi_gcd(&G, &ctx->E, &H)); in mbedtls_rsa_gen_key()
1113 MBEDTLS_MPI_CHK(mbedtls_mpi_gcd(&G, &ctx->P, &ctx->Q)); in mbedtls_rsa_gen_key()
1114 MBEDTLS_MPI_CHK(mbedtls_mpi_div_mpi(&L, NULL, &H, &G)); in mbedtls_rsa_gen_key()
1115 MBEDTLS_MPI_CHK(mbedtls_mpi_inv_mod(&ctx->D, &ctx->E, &L)); in mbedtls_rsa_gen_key()
1125 MBEDTLS_MPI_CHK(mbedtls_mpi_add_int(&ctx->P, &ctx->P, 1)); in mbedtls_rsa_gen_key()
1126 MBEDTLS_MPI_CHK(mbedtls_mpi_add_int(&ctx->Q, &ctx->Q, 1)); in mbedtls_rsa_gen_key()
1128 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&ctx->N, &ctx->P, &ctx->Q)); in mbedtls_rsa_gen_key()
1138 MBEDTLS_MPI_CHK(mbedtls_rsa_deduce_crt(&ctx->P, &ctx->Q, &ctx->D, in mbedtls_rsa_gen_key()
1143 MBEDTLS_MPI_CHK(mbedtls_rsa_check_privkey(ctx)); in mbedtls_rsa_gen_key()
1254 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&T, input, ctx->len)); in mbedtls_rsa_public()
1262 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&T, &T, &ctx->E, &ctx->N, &ctx->RN)); in mbedtls_rsa_public()
1263 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&T, output, olen)); in mbedtls_rsa_public()
1297 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&ctx->Vi, &ctx->Vi, &ctx->Vi)); in rsa_prepare_blinding()
1298 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&ctx->Vi, &ctx->Vi, &ctx->N)); in rsa_prepare_blinding()
1299 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&ctx->Vf, &ctx->Vf, &ctx->Vf)); in rsa_prepare_blinding()
1300 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&ctx->Vf, &ctx->Vf, &ctx->N)); in rsa_prepare_blinding()
1312 MBEDTLS_MPI_CHK(mbedtls_mpi_fill_random(&ctx->Vf, ctx->len - 1, f_rng, p_rng)); in rsa_prepare_blinding()
1315 MBEDTLS_MPI_CHK(mbedtls_mpi_fill_random(&R, ctx->len - 1, f_rng, p_rng)); in rsa_prepare_blinding()
1316 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&ctx->Vi, &ctx->Vf, &R)); in rsa_prepare_blinding()
1317 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&ctx->Vi, &ctx->Vi, &ctx->N)); in rsa_prepare_blinding()
1331 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&ctx->Vi, &ctx->Vi, &R)); in rsa_prepare_blinding()
1332 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&ctx->Vi, &ctx->Vi, &ctx->N)); in rsa_prepare_blinding()
1336 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&ctx->Vi, &ctx->Vi, &ctx->E, &ctx->N, &ctx->RN)); in rsa_prepare_blinding()
1360 MBEDTLS_MPI_CHK(mbedtls_mpi_core_get_mont_r2_unsafe(&RR, N)); in rsa_unblind()
1361 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(&M_T, tlimbs)); in rsa_unblind()
1363 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(T, nlimbs)); in rsa_unblind()
1364 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(Vf, nlimbs)); in rsa_unblind()
1478 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&T, input, ctx->len)); in mbedtls_rsa_private()
1488 MBEDTLS_MPI_CHK(rsa_prepare_blinding(ctx, f_rng, p_rng)); in mbedtls_rsa_private()
1489 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&T, &T, &ctx->Vi)); in mbedtls_rsa_private()
1490 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&T, &T, &ctx->N)); in mbedtls_rsa_private()
1492 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&input_blinded, &T)); in mbedtls_rsa_private()
1497 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&P1, &ctx->P, 1)); in mbedtls_rsa_private()
1498 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&Q1, &ctx->Q, 1)); in mbedtls_rsa_private()
1504 MBEDTLS_MPI_CHK(mbedtls_mpi_fill_random(&R, RSA_EXPONENT_BLINDING, in mbedtls_rsa_private()
1506 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&D_blind, &P1, &Q1)); in mbedtls_rsa_private()
1507 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&D_blind, &D_blind, &R)); in mbedtls_rsa_private()
1508 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(&D_blind, &D_blind, &ctx->D)); in mbedtls_rsa_private()
1513 MBEDTLS_MPI_CHK(mbedtls_mpi_fill_random(&R, RSA_EXPONENT_BLINDING, in mbedtls_rsa_private()
1515 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&DP_blind, &P1, &R)); in mbedtls_rsa_private()
1516 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(&DP_blind, &DP_blind, in mbedtls_rsa_private()
1522 MBEDTLS_MPI_CHK(mbedtls_mpi_fill_random(&R, RSA_EXPONENT_BLINDING, in mbedtls_rsa_private()
1524 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&DQ_blind, &Q1, &R)); in mbedtls_rsa_private()
1525 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(&DQ_blind, &DQ_blind, in mbedtls_rsa_private()
1530 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&T, &T, &D_blind, &ctx->N, &ctx->RN)); in mbedtls_rsa_private()
1539 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&TP, &T, &DP_blind, &ctx->P, &ctx->RP)); in mbedtls_rsa_private()
1540 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&TQ, &T, &DQ_blind, &ctx->Q, &ctx->RQ)); in mbedtls_rsa_private()
1545 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(&T, &TP, &TQ)); in mbedtls_rsa_private()
1546 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&TP, &T, &ctx->QP)); in mbedtls_rsa_private()
1547 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&T, &TP, &ctx->P)); in mbedtls_rsa_private()
1552 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&TP, &T, &ctx->Q)); in mbedtls_rsa_private()
1553 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(&T, &TQ, &TP)); in mbedtls_rsa_private()
1557 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&check_result_blinded, &T, &ctx->E, in mbedtls_rsa_private()
1568 MBEDTLS_MPI_CHK(rsa_unblind(&T, &ctx->Vf, &ctx->N)); in mbedtls_rsa_private()
1571 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&T, output, olen)); in mbedtls_rsa_private()
2471 MBEDTLS_MPI_CHK(mbedtls_rsa_private(ctx, f_rng, p_rng, sig, sig_try)); in mbedtls_rsa_rsassa_pkcs1_v15_sign()
2472 MBEDTLS_MPI_CHK(mbedtls_rsa_public(ctx, sig_try, verif)); in mbedtls_rsa_rsassa_pkcs1_v15_sign()
2778 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->N, &src->N)); in mbedtls_rsa_copy()
2779 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->E, &src->E)); in mbedtls_rsa_copy()
2781 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->D, &src->D)); in mbedtls_rsa_copy()
2782 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->P, &src->P)); in mbedtls_rsa_copy()
2783 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->Q, &src->Q)); in mbedtls_rsa_copy()
2786 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->DP, &src->DP)); in mbedtls_rsa_copy()
2787 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->DQ, &src->DQ)); in mbedtls_rsa_copy()
2788 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->QP, &src->QP)); in mbedtls_rsa_copy()
2789 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->RP, &src->RP)); in mbedtls_rsa_copy()
2790 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->RQ, &src->RQ)); in mbedtls_rsa_copy()
2793 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->RN, &src->RN)); in mbedtls_rsa_copy()
2795 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->Vi, &src->Vi)); in mbedtls_rsa_copy()
2796 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&dst->Vf, &src->Vf)); in mbedtls_rsa_copy()
2934 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&K, 16, RSA_N)); in mbedtls_rsa_self_test()
2935 MBEDTLS_MPI_CHK(mbedtls_rsa_import(&rsa, &K, NULL, NULL, NULL, NULL)); in mbedtls_rsa_self_test()
2936 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&K, 16, RSA_P)); in mbedtls_rsa_self_test()
2937 MBEDTLS_MPI_CHK(mbedtls_rsa_import(&rsa, NULL, &K, NULL, NULL, NULL)); in mbedtls_rsa_self_test()
2938 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&K, 16, RSA_Q)); in mbedtls_rsa_self_test()
2939 MBEDTLS_MPI_CHK(mbedtls_rsa_import(&rsa, NULL, NULL, &K, NULL, NULL)); in mbedtls_rsa_self_test()
2940 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&K, 16, RSA_D)); in mbedtls_rsa_self_test()
2941 MBEDTLS_MPI_CHK(mbedtls_rsa_import(&rsa, NULL, NULL, NULL, &K, NULL)); in mbedtls_rsa_self_test()
2942 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&K, 16, RSA_E)); in mbedtls_rsa_self_test()
2943 MBEDTLS_MPI_CHK(mbedtls_rsa_import(&rsa, NULL, NULL, NULL, NULL, &K)); in mbedtls_rsa_self_test()
2945 MBEDTLS_MPI_CHK(mbedtls_rsa_complete(&rsa)); in mbedtls_rsa_self_test()