Lines Matching refs:MBEDTLS_MPI_CHK
624 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&P->X, &Q->X)); in mbedtls_ecp_copy()
625 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&P->Y, &Q->Y)); in mbedtls_ecp_copy()
626 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&P->Z, &Q->Z)); in mbedtls_ecp_copy()
646 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&pt->X, 1)); in mbedtls_ecp_set_zero()
647 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&pt->Y, 1)); in mbedtls_ecp_set_zero()
648 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&pt->Z, 0)); in mbedtls_ecp_set_zero()
684 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&P->X, radix, x)); in mbedtls_ecp_point_read_string()
685 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&P->Y, radix, y)); in mbedtls_ecp_point_read_string()
686 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&P->Z, 1)); in mbedtls_ecp_point_read_string()
717 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary_le(&P->X, buf, plen)); in mbedtls_ecp_point_write_binary()
744 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&P->X, buf + 1, plen)); in mbedtls_ecp_point_write_binary()
745 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&P->Y, buf + 1 + plen, plen)); in mbedtls_ecp_point_write_binary()
754 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&P->X, buf + 1, plen)); in mbedtls_ecp_point_write_binary()
791 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary_le(&pt->X, buf, plen)); in mbedtls_ecp_point_read_binary()
796 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(&pt->X, plen * 8 - 1, 0)); in mbedtls_ecp_point_read_binary()
799 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&pt->Z, 1)); in mbedtls_ecp_point_read_binary()
816 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&pt->X, buf + 1, plen)); in mbedtls_ecp_point_read_binary()
817 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&pt->Z, 1)); in mbedtls_ecp_point_read_binary()
1017 MBEDTLS_MPI_CHK(grp->modp(N)); in ecp_modp()
1021 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(N, N, &grp->P)); in ecp_modp()
1026 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_abs(N, N, &grp->P)); in ecp_modp()
1055 MBEDTLS_MPI_CHK(ecp_modp(&(N), grp)); \
1065 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(X, A, B)); in mbedtls_mpi_mul_mod()
1078 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi((N), (N), &grp->P)); \
1088 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(X, A, B)); in mbedtls_mpi_sub_mod()
1101 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_abs((N), (N), &grp->P))
1109 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(X, A, B)); in mbedtls_mpi_add_mod()
1123 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_int(X, A, c)); in mbedtls_mpi_mul_int_mod()
1137 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(X, A, c)); in mbedtls_mpi_sub_int_mod()
1144 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int_mod(grp, X, A, c))
1152 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_l(X, count)); in mbedtls_mpi_shift_l_mod()
1165 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mod(grp, X, A, B))
1168 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mod(grp, X, A, B))
1171 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mod(grp, X, A, B))
1174 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mod(grp, X, A, A))
1177 MBEDTLS_MPI_CHK(mbedtls_mpi_mul_int_mod(grp, X, A, c))
1180 MBEDTLS_MPI_CHK(mbedtls_mpi_inv_mod((dst), (src), &grp->P))
1183 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(X, A))
1186 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_l_mod(grp, X, count))
1189 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(X, c))
1199 MBEDTLS_MPI_CHK(mbedtls_mpi_random((X), 2, &grp->P, f_rng, p_rng))
1207 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(&tmp, &grp->P, (X))); \
1208 MBEDTLS_MPI_CHK(mbedtls_mpi_safe_cond_assign((X), &tmp, \
1218 MBEDTLS_MPI_CHK(mbedtls_mpi_safe_cond_assign((X), (Y), (cond)))
1221 MBEDTLS_MPI_CHK(mbedtls_mpi_safe_cond_swap((X), (Y), (cond)))
1279 MBEDTLS_MPI_CHK(ecp_sw_rhs(grp, Y, X)); in mbedtls_ecp_sw_derive_y()
1283 MBEDTLS_MPI_CHK(mbedtls_mpi_add_int(&exp, &grp->P, 1)); in mbedtls_ecp_sw_derive_y()
1284 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(&exp, 2)); in mbedtls_ecp_sw_derive_y()
1286 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(Y, Y /*y^2*/, &exp, &grp->P, NULL)); in mbedtls_ecp_sw_derive_y()
1294 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(Y, &grp->P, Y)); in mbedtls_ecp_sw_derive_y()
1437 MBEDTLS_MPI_CHK(mbedtls_mpi_shrink(&T[i]->X, grp->P.n)); in ecp_normalize_jac_many()
1438 MBEDTLS_MPI_CHK(mbedtls_mpi_shrink(&T[i]->Y, grp->P.n)); in ecp_normalize_jac_many()
1901 MBEDTLS_MPI_CHK(mbedtls_ecp_copy(&T[0], P)); in ecp_precompute_comb()
1917 MBEDTLS_MPI_CHK(mbedtls_ecp_copy(cur, T + (i >> 1))); in ecp_precompute_comb()
1920 MBEDTLS_MPI_CHK(ecp_double_jac(grp, cur, cur, tmp)); in ecp_precompute_comb()
1944 MBEDTLS_MPI_CHK(ecp_normalize_jac_many(grp, TT, j)); in ecp_precompute_comb()
1962 MBEDTLS_MPI_CHK(ecp_add_mixed(grp, &T[i + j], &T[j], &T[i], tmp)); in ecp_precompute_comb()
1984 MBEDTLS_MPI_CHK(ecp_normalize_jac_many(grp, TT, j)); in ecp_precompute_comb()
2033 MBEDTLS_MPI_CHK(ecp_safe_invert_jac(grp, R, i >> 7)); in ecp_select_comb()
2082 MBEDTLS_MPI_CHK(ecp_select_comb(grp, R, T, T_size, x[i])); in ecp_mul_comb_core()
2084 MBEDTLS_MPI_CHK(ecp_randomize_jac(grp, R, f_rng, p_rng)); in ecp_mul_comb_core()
2092 MBEDTLS_MPI_CHK(ecp_double_jac(grp, R, R, tmp)); in ecp_mul_comb_core()
2093 MBEDTLS_MPI_CHK(ecp_select_comb(grp, &Txi, T, T_size, x[i])); in ecp_mul_comb_core()
2094 MBEDTLS_MPI_CHK(ecp_add_mixed(grp, R, R, &Txi, tmp)); in ecp_mul_comb_core()
2147 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&M, m)); in ecp_comb_recode_scalar()
2148 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(&mm, &grp->N, m)); in ecp_comb_recode_scalar()
2149 MBEDTLS_MPI_CHK(mbedtls_mpi_safe_cond_assign(&M, &mm, *parity_trick)); in ecp_comb_recode_scalar()
2194 MBEDTLS_MPI_CHK(ecp_comb_recode_scalar(grp, m, k, d, w, in ecp_mul_comb_after_precomp()
2196 MBEDTLS_MPI_CHK(ecp_mul_comb_core(grp, RR, T, T_size, k, d, in ecp_mul_comb_after_precomp()
2198 MBEDTLS_MPI_CHK(ecp_safe_invert_jac(grp, RR, parity_trick)); in ecp_mul_comb_after_precomp()
2220 MBEDTLS_MPI_CHK(ecp_randomize_jac(grp, RR, f_rng, p_rng)); in ecp_mul_comb_after_precomp()
2223 MBEDTLS_MPI_CHK(ecp_normalize_jac(grp, RR)); in ecp_mul_comb_after_precomp()
2227 MBEDTLS_MPI_CHK(mbedtls_ecp_copy(R, RR)); in ecp_mul_comb_after_precomp()
2355 MBEDTLS_MPI_CHK(ecp_precompute_comb(grp, T, P, w, d, rs_ctx)); in ecp_mul_comb()
2366 MBEDTLS_MPI_CHK(ecp_mul_comb_after_precomp(grp, R, m, in ecp_mul_comb()
2570 MBEDTLS_MPI_CHK(mbedtls_ecp_copy(&RP, P)); in ecp_mul_mxz()
2581 MBEDTLS_MPI_CHK(ecp_randomize_mxz(grp, &RP, f_rng, p_rng)); in ecp_mul_mxz()
2596 MBEDTLS_MPI_CHK(ecp_double_add_mxz(grp, R, &RP, R, &RP, &PX, tmp)); in ecp_mul_mxz()
2612 MBEDTLS_MPI_CHK(ecp_randomize_mxz(grp, R, f_rng, p_rng)); in ecp_mul_mxz()
2613 MBEDTLS_MPI_CHK(ecp_normalize_mxz(grp, R)); in ecp_mul_mxz()
2651 MBEDTLS_MPI_CHK(mbedtls_internal_ecp_init(grp)); in ecp_mul_restartable_internal()
2665 MBEDTLS_MPI_CHK(mbedtls_ecp_check_privkey(grp, m)); in ecp_mul_restartable_internal()
2666 MBEDTLS_MPI_CHK(mbedtls_ecp_check_pubkey(grp, P)); in ecp_mul_restartable_internal()
2672 MBEDTLS_MPI_CHK(ecp_mul_mxz(grp, R, m, P, f_rng, p_rng)); in ecp_mul_restartable_internal()
2677 MBEDTLS_MPI_CHK(ecp_mul_comb(grp, R, m, P, f_rng, p_rng, rs_ctx)); in ecp_mul_restartable_internal()
2749 MBEDTLS_MPI_CHK(ecp_sw_rhs(grp, &RHS, &pt->X)); in ecp_check_pubkey_sw()
2780 MBEDTLS_MPI_CHK(mbedtls_ecp_check_pubkey(grp, P)); in mbedtls_ecp_mul_shortcuts()
2781 MBEDTLS_MPI_CHK(mbedtls_ecp_set_zero(R)); in mbedtls_ecp_mul_shortcuts()
2783 MBEDTLS_MPI_CHK(mbedtls_ecp_check_pubkey(grp, P)); in mbedtls_ecp_mul_shortcuts()
2784 MBEDTLS_MPI_CHK(mbedtls_ecp_copy(R, P)); in mbedtls_ecp_mul_shortcuts()
2786 MBEDTLS_MPI_CHK(mbedtls_ecp_check_pubkey(grp, P)); in mbedtls_ecp_mul_shortcuts()
2787 MBEDTLS_MPI_CHK(mbedtls_ecp_copy(R, P)); in mbedtls_ecp_mul_shortcuts()
2790 MBEDTLS_MPI_CHK(ecp_mul_restartable_internal(grp, R, m, P, in mbedtls_ecp_mul_shortcuts()
2846 MBEDTLS_MPI_CHK(mbedtls_ecp_mul_shortcuts(grp, pmP, m, P, rs_ctx)); in mbedtls_ecp_muladd_restartable()
2854 MBEDTLS_MPI_CHK(mbedtls_ecp_mul_shortcuts(grp, pR, n, Q, rs_ctx)); in mbedtls_ecp_muladd_restartable()
2858 MBEDTLS_MPI_CHK(mbedtls_internal_ecp_init(grp)); in mbedtls_ecp_muladd_restartable()
2870 MBEDTLS_MPI_CHK(ecp_add_mixed(grp, pR, pmP, pR, tmp)); in mbedtls_ecp_muladd_restartable()
2879 MBEDTLS_MPI_CHK(ecp_normalize_jac(grp, pR)); in mbedtls_ecp_muladd_restartable()
2883 MBEDTLS_MPI_CHK(mbedtls_ecp_copy(R, pR)); in mbedtls_ecp_muladd_restartable()
2961 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&XmP, X)); in ecp_check_bad_points_mx()
2963 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(&XmP, &XmP, P)); in ecp_check_bad_points_mx()
2991 MBEDTLS_MPI_CHK(mbedtls_mpi_add_int(&XmP, &XmP, 1)); in ecp_check_bad_points_mx()
3104 MBEDTLS_MPI_CHK(mbedtls_mpi_fill_random(d, n_random_bytes, in mbedtls_ecp_gen_privkey_mx()
3106 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(d, 8 * n_random_bytes - high_bit - 1)); in mbedtls_ecp_gen_privkey_mx()
3108 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(d, high_bit, 1)); in mbedtls_ecp_gen_privkey_mx()
3112 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(d, 0, 0)); in mbedtls_ecp_gen_privkey_mx()
3113 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(d, 1, 0)); in mbedtls_ecp_gen_privkey_mx()
3115 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(d, 2, 0)); in mbedtls_ecp_gen_privkey_mx()
3172 MBEDTLS_MPI_CHK(mbedtls_ecp_gen_privkey(grp, d, f_rng, p_rng)); in mbedtls_ecp_gen_keypair_base()
3173 MBEDTLS_MPI_CHK(mbedtls_ecp_mul(grp, Q, d, G, f_rng, p_rng)); in mbedtls_ecp_gen_keypair_base()
3250 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary_le(&key->d, buf, buflen)); in mbedtls_ecp_read_key()
3253 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(&key->d, 0, 0)); in mbedtls_ecp_read_key()
3254 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(&key->d, 1, 0)); in mbedtls_ecp_read_key()
3255 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(&key->d, 2, 0)); in mbedtls_ecp_read_key()
3258 MBEDTLS_MPI_CHK( in mbedtls_ecp_read_key()
3264 MBEDTLS_MPI_CHK( in mbedtls_ecp_read_key()
3273 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary_le(&key->d, buf, buflen)); in mbedtls_ecp_read_key()
3276 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(&key->d, 0, 0)); in mbedtls_ecp_read_key()
3277 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(&key->d, 1, 0)); in mbedtls_ecp_read_key()
3280 MBEDTLS_MPI_CHK( in mbedtls_ecp_read_key()
3289 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&key->d, buf, buflen)); in mbedtls_ecp_read_key()
3294 MBEDTLS_MPI_CHK(mbedtls_ecp_check_privkey(&key->grp, &key->d)); in mbedtls_ecp_read_key()
3327 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary_le(&key->d, buf, buflen)); in mbedtls_ecp_write_key()
3332 MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&key->d, buf, buflen)); in mbedtls_ecp_write_key()
3412 MBEDTLS_MPI_CHK(mbedtls_ecp_mul(&grp, &Q, &prv->d, &prv->grp.G, f_rng, p_rng)); in mbedtls_ecp_check_pub_priv()
3505 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(m, 254, 0)); in self_test_adjust_exponent()
3506 MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(m, grp->nbits, 1)); in self_test_adjust_exponent()
3509 MBEDTLS_MPI_CHK( in self_test_adjust_exponent()
3542 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(m, 16, exponents[0])); in self_test_point()
3543 MBEDTLS_MPI_CHK(self_test_adjust_exponent(grp, m)); in self_test_point()
3544 MBEDTLS_MPI_CHK(mbedtls_ecp_mul(grp, R, m, P, self_test_rng, NULL)); in self_test_point()
3554 MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(m, 16, exponents[i])); in self_test_point()
3555 MBEDTLS_MPI_CHK(self_test_adjust_exponent(grp, m)); in self_test_point()
3556 MBEDTLS_MPI_CHK(mbedtls_ecp_mul(grp, R, m, P, self_test_rng, NULL)); in self_test_point()
3626 MBEDTLS_MPI_CHK(mbedtls_ecp_group_load(&grp, MBEDTLS_ECP_DP_SECP192R1)); in mbedtls_ecp_self_test()
3628 MBEDTLS_MPI_CHK(mbedtls_ecp_group_load(&grp, mbedtls_ecp_curve_list()->grp_id)); in mbedtls_ecp_self_test()
3635 MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&m, 2)); in mbedtls_ecp_self_test()
3636 MBEDTLS_MPI_CHK(mbedtls_ecp_mul(&grp, &P, &m, &grp.G, self_test_rng, NULL)); in mbedtls_ecp_self_test()
3666 MBEDTLS_MPI_CHK(mbedtls_ecp_group_load(&grp, MBEDTLS_ECP_DP_CURVE25519)); in mbedtls_ecp_self_test()
3668 MBEDTLS_MPI_CHK(mbedtls_ecp_group_load(&grp, MBEDTLS_ECP_DP_CURVE448)); in mbedtls_ecp_self_test()