Lines Matching refs:MBEDTLS_MPI_CHK

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()
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()
740 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&P->X, buf + 1, plen)); in mbedtls_ecp_point_write_binary()
741 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&P->Y, buf + 1 + plen, plen)); in mbedtls_ecp_point_write_binary()
750 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&P->X, buf + 1, plen)); in mbedtls_ecp_point_write_binary()
787 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary_le(&pt->X, buf, plen)); in mbedtls_ecp_point_read_binary()
792 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(&pt->X, plen * 8 - 1, 0)); in mbedtls_ecp_point_read_binary()
795 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&pt->Z, 1)); in mbedtls_ecp_point_read_binary()
812 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&pt->X, buf + 1, plen)); in mbedtls_ecp_point_read_binary()
813 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&pt->Z, 1)); in mbedtls_ecp_point_read_binary()
1013 MBEDTLS_MPI_CHK(grp->modp(N)); in ecp_modp()
1017 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(N, N, &grp->P)); in ecp_modp()
1022 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_abs(N, N, &grp->P)); in ecp_modp()
1051 MBEDTLS_MPI_CHK(ecp_modp(&(N), grp)); \
1061 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(X, A, B)); in mbedtls_mpi_mul_mod()
1074 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi((N), (N), &grp->P)); \
1084 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(X, A, B)); in mbedtls_mpi_sub_mod()
1097 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_abs((N), (N), &grp->P))
1105 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(X, A, B)); in mbedtls_mpi_add_mod()
1119 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_int(X, A, c)); in mbedtls_mpi_mul_int_mod()
1133 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(X, A, c)); in mbedtls_mpi_sub_int_mod()
1140 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int_mod(grp, X, A, c))
1148 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_l(X, count)); in mbedtls_mpi_shift_l_mod()
1161 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mod(grp, X, A, B))
1164 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mod(grp, X, A, B))
1167 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mod(grp, X, A, B))
1170 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mod(grp, X, A, A))
1173 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_int_mod(grp, X, A, c))
1176 MBEDTLS_MPI_CHK(mbedtls_mpi_inv_mod((dst), (src), &grp->P))
1179 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(X, A))
1182 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_l_mod(grp, X, count))
1185 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(X, c))
1195 MBEDTLS_MPI_CHK(mbedtls_mpi_random((X), 2, &grp->P, f_rng, p_rng))
1203 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(&tmp, &grp->P, (X))); \
1204 MBEDTLS_MPI_CHK(mbedtls_mpi_safe_cond_assign((X), &tmp, \
1214 MBEDTLS_MPI_CHK(mbedtls_mpi_safe_cond_assign((X), (Y), (cond)))
1217 MBEDTLS_MPI_CHK(mbedtls_mpi_safe_cond_swap((X), (Y), (cond)))
1275 MBEDTLS_MPI_CHK(ecp_sw_rhs(grp, Y, X)); in mbedtls_ecp_sw_derive_y()
1279 MBEDTLS_MPI_CHK(mbedtls_mpi_add_int(&exp, &grp->P, 1)); in mbedtls_ecp_sw_derive_y()
1280 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(&exp, 2)); in mbedtls_ecp_sw_derive_y()
1282 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(Y, Y /*y^2*/, &exp, &grp->P, NULL)); in mbedtls_ecp_sw_derive_y()
1290 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(Y, &grp->P, Y)); in mbedtls_ecp_sw_derive_y()
1433 MBEDTLS_MPI_CHK(mbedtls_mpi_shrink(&T[i]->X, grp->P.n)); in ecp_normalize_jac_many()
1434 MBEDTLS_MPI_CHK(mbedtls_mpi_shrink(&T[i]->Y, grp->P.n)); in ecp_normalize_jac_many()
1897 MBEDTLS_MPI_CHK(mbedtls_ecp_copy(&T[0], P)); in ecp_precompute_comb()
1913 MBEDTLS_MPI_CHK(mbedtls_ecp_copy(cur, T + (i >> 1))); in ecp_precompute_comb()
1916 MBEDTLS_MPI_CHK(ecp_double_jac(grp, cur, cur, tmp)); in ecp_precompute_comb()
1940 MBEDTLS_MPI_CHK(ecp_normalize_jac_many(grp, TT, j)); in ecp_precompute_comb()
1958 MBEDTLS_MPI_CHK(ecp_add_mixed(grp, &T[i + j], &T[j], &T[i], tmp)); in ecp_precompute_comb()
1980 MBEDTLS_MPI_CHK(ecp_normalize_jac_many(grp, TT, j)); in ecp_precompute_comb()
2029 MBEDTLS_MPI_CHK(ecp_safe_invert_jac(grp, R, i >> 7)); in ecp_select_comb()
2078 MBEDTLS_MPI_CHK(ecp_select_comb(grp, R, T, T_size, x[i])); in ecp_mul_comb_core()
2080 MBEDTLS_MPI_CHK(ecp_randomize_jac(grp, R, f_rng, p_rng)); in ecp_mul_comb_core()
2088 MBEDTLS_MPI_CHK(ecp_double_jac(grp, R, R, tmp)); in ecp_mul_comb_core()
2089 MBEDTLS_MPI_CHK(ecp_select_comb(grp, &Txi, T, T_size, x[i])); in ecp_mul_comb_core()
2090 MBEDTLS_MPI_CHK(ecp_add_mixed(grp, R, R, &Txi, tmp)); in ecp_mul_comb_core()
2143 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&M, m)); in ecp_comb_recode_scalar()
2144 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(&mm, &grp->N, m)); in ecp_comb_recode_scalar()
2145 MBEDTLS_MPI_CHK(mbedtls_mpi_safe_cond_assign(&M, &mm, *parity_trick)); in ecp_comb_recode_scalar()
2190 MBEDTLS_MPI_CHK(ecp_comb_recode_scalar(grp, m, k, d, w, in ecp_mul_comb_after_precomp()
2192 MBEDTLS_MPI_CHK(ecp_mul_comb_core(grp, RR, T, T_size, k, d, in ecp_mul_comb_after_precomp()
2194 MBEDTLS_MPI_CHK(ecp_safe_invert_jac(grp, RR, parity_trick)); in ecp_mul_comb_after_precomp()
2216 MBEDTLS_MPI_CHK(ecp_randomize_jac(grp, RR, f_rng, p_rng)); in ecp_mul_comb_after_precomp()
2219 MBEDTLS_MPI_CHK(ecp_normalize_jac(grp, RR)); in ecp_mul_comb_after_precomp()
2223 MBEDTLS_MPI_CHK(mbedtls_ecp_copy(R, RR)); in ecp_mul_comb_after_precomp()
2351 MBEDTLS_MPI_CHK(ecp_precompute_comb(grp, T, P, w, d, rs_ctx)); in ecp_mul_comb()
2362 MBEDTLS_MPI_CHK(ecp_mul_comb_after_precomp(grp, R, m, in ecp_mul_comb()
2566 MBEDTLS_MPI_CHK(mbedtls_ecp_copy(&RP, P)); in ecp_mul_mxz()
2577 MBEDTLS_MPI_CHK(ecp_randomize_mxz(grp, &RP, f_rng, p_rng)); in ecp_mul_mxz()
2592 MBEDTLS_MPI_CHK(ecp_double_add_mxz(grp, R, &RP, R, &RP, &PX, tmp)); in ecp_mul_mxz()
2608 MBEDTLS_MPI_CHK(ecp_randomize_mxz(grp, R, f_rng, p_rng)); in ecp_mul_mxz()
2609 MBEDTLS_MPI_CHK(ecp_normalize_mxz(grp, R)); in ecp_mul_mxz()
2647 MBEDTLS_MPI_CHK(mbedtls_internal_ecp_init(grp)); in ecp_mul_restartable_internal()
2661 MBEDTLS_MPI_CHK(mbedtls_ecp_check_privkey(grp, m)); in ecp_mul_restartable_internal()
2662 MBEDTLS_MPI_CHK(mbedtls_ecp_check_pubkey(grp, P)); in ecp_mul_restartable_internal()
2668 MBEDTLS_MPI_CHK(ecp_mul_mxz(grp, R, m, P, f_rng, p_rng)); in ecp_mul_restartable_internal()
2673 MBEDTLS_MPI_CHK(ecp_mul_comb(grp, R, m, P, f_rng, p_rng, rs_ctx)); in ecp_mul_restartable_internal()
2745 MBEDTLS_MPI_CHK(ecp_sw_rhs(grp, &RHS, &pt->X)); in ecp_check_pubkey_sw()
2776 MBEDTLS_MPI_CHK(mbedtls_ecp_check_pubkey(grp, P)); in mbedtls_ecp_mul_shortcuts()
2777 MBEDTLS_MPI_CHK(mbedtls_ecp_set_zero(R)); in mbedtls_ecp_mul_shortcuts()
2779 MBEDTLS_MPI_CHK(mbedtls_ecp_check_pubkey(grp, P)); in mbedtls_ecp_mul_shortcuts()
2780 MBEDTLS_MPI_CHK(mbedtls_ecp_copy(R, P)); in mbedtls_ecp_mul_shortcuts()
2782 MBEDTLS_MPI_CHK(mbedtls_ecp_check_pubkey(grp, P)); in mbedtls_ecp_mul_shortcuts()
2783 MBEDTLS_MPI_CHK(mbedtls_ecp_copy(R, P)); in mbedtls_ecp_mul_shortcuts()
2786 MBEDTLS_MPI_CHK(ecp_mul_restartable_internal(grp, R, m, P, in mbedtls_ecp_mul_shortcuts()
2842 MBEDTLS_MPI_CHK(mbedtls_ecp_mul_shortcuts(grp, pmP, m, P, rs_ctx)); in mbedtls_ecp_muladd_restartable()
2850 MBEDTLS_MPI_CHK(mbedtls_ecp_mul_shortcuts(grp, pR, n, Q, rs_ctx)); in mbedtls_ecp_muladd_restartable()
2854 MBEDTLS_MPI_CHK(mbedtls_internal_ecp_init(grp)); in mbedtls_ecp_muladd_restartable()
2866 MBEDTLS_MPI_CHK(ecp_add_mixed(grp, pR, pmP, pR, tmp)); in mbedtls_ecp_muladd_restartable()
2875 MBEDTLS_MPI_CHK(ecp_normalize_jac(grp, pR)); in mbedtls_ecp_muladd_restartable()
2879 MBEDTLS_MPI_CHK(mbedtls_ecp_copy(R, pR)); in mbedtls_ecp_muladd_restartable()
2957 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&XmP, X)); in ecp_check_bad_points_mx()
2959 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(&XmP, &XmP, P)); in ecp_check_bad_points_mx()
2987 MBEDTLS_MPI_CHK(mbedtls_mpi_add_int(&XmP, &XmP, 1)); in ecp_check_bad_points_mx()
3100 MBEDTLS_MPI_CHK(mbedtls_mpi_fill_random(d, n_random_bytes, in mbedtls_ecp_gen_privkey_mx()
3102 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(d, 8 * n_random_bytes - high_bit - 1)); in mbedtls_ecp_gen_privkey_mx()
3104 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(d, high_bit, 1)); in mbedtls_ecp_gen_privkey_mx()
3108 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(d, 0, 0)); in mbedtls_ecp_gen_privkey_mx()
3109 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(d, 1, 0)); in mbedtls_ecp_gen_privkey_mx()
3111 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(d, 2, 0)); in mbedtls_ecp_gen_privkey_mx()
3168 MBEDTLS_MPI_CHK(mbedtls_ecp_gen_privkey(grp, d, f_rng, p_rng)); in mbedtls_ecp_gen_keypair_base()
3169 MBEDTLS_MPI_CHK(mbedtls_ecp_mul(grp, Q, d, G, f_rng, p_rng)); in mbedtls_ecp_gen_keypair_base()
3246 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary_le(&key->d, buf, buflen)); in mbedtls_ecp_read_key()
3249 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(&key->d, 0, 0)); in mbedtls_ecp_read_key()
3250 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(&key->d, 1, 0)); in mbedtls_ecp_read_key()
3251 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(&key->d, 2, 0)); in mbedtls_ecp_read_key()
3254 MBEDTLS_MPI_CHK( in mbedtls_ecp_read_key()
3260 MBEDTLS_MPI_CHK( in mbedtls_ecp_read_key()
3269 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary_le(&key->d, buf, buflen)); in mbedtls_ecp_read_key()
3272 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(&key->d, 0, 0)); in mbedtls_ecp_read_key()
3273 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(&key->d, 1, 0)); in mbedtls_ecp_read_key()
3276 MBEDTLS_MPI_CHK( in mbedtls_ecp_read_key()
3285 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&key->d, buf, buflen)); in mbedtls_ecp_read_key()
3290 MBEDTLS_MPI_CHK(mbedtls_ecp_check_privkey(&key->grp, &key->d)); in mbedtls_ecp_read_key()
3323 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary_le(&key->d, buf, buflen)); in mbedtls_ecp_write_key()
3328 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&key->d, buf, buflen)); in mbedtls_ecp_write_key()
3408 MBEDTLS_MPI_CHK(mbedtls_ecp_mul(&grp, &Q, &prv->d, &prv->grp.G, f_rng, p_rng)); in mbedtls_ecp_check_pub_priv()
3501 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(m, 254, 0)); in self_test_adjust_exponent()
3502 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(m, grp->nbits, 1)); in self_test_adjust_exponent()
3505 MBEDTLS_MPI_CHK( in self_test_adjust_exponent()
3538 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(m, 16, exponents[0])); in self_test_point()
3539 MBEDTLS_MPI_CHK(self_test_adjust_exponent(grp, m)); in self_test_point()
3540 MBEDTLS_MPI_CHK(mbedtls_ecp_mul(grp, R, m, P, self_test_rng, NULL)); in self_test_point()
3550 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(m, 16, exponents[i])); in self_test_point()
3551 MBEDTLS_MPI_CHK(self_test_adjust_exponent(grp, m)); in self_test_point()
3552 MBEDTLS_MPI_CHK(mbedtls_ecp_mul(grp, R, m, P, self_test_rng, NULL)); in self_test_point()
3622 MBEDTLS_MPI_CHK(mbedtls_ecp_group_load(&grp, MBEDTLS_ECP_DP_SECP192R1)); in mbedtls_ecp_self_test()
3624 MBEDTLS_MPI_CHK(mbedtls_ecp_group_load(&grp, mbedtls_ecp_curve_list()->grp_id)); in mbedtls_ecp_self_test()
3631 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&m, 2)); in mbedtls_ecp_self_test()
3632 MBEDTLS_MPI_CHK(mbedtls_ecp_mul(&grp, &P, &m, &grp.G, self_test_rng, NULL)); in mbedtls_ecp_self_test()
3662 MBEDTLS_MPI_CHK(mbedtls_ecp_group_load(&grp, MBEDTLS_ECP_DP_CURVE25519)); in mbedtls_ecp_self_test()
3664 MBEDTLS_MPI_CHK(mbedtls_ecp_group_load(&grp, MBEDTLS_ECP_DP_CURVE448)); in mbedtls_ecp_self_test()