Beispiel #1
0
void ep_mul_sim_gen(ep_t r, const bn_t k, const ep_t q, const bn_t m) {
	ep_t g;

	ep_null(g);

	if (bn_is_zero(k)) {
		ep_mul(r, q, m);
		return;
	}
	if (bn_is_zero(m) || ep_is_infty(q)) {
		ep_mul_gen(r, k);
		return;
	}

	TRY {
		ep_new(g);

		ep_curve_get_gen(g);

#if defined(EP_ENDOM)
#if EP_SIM == INTER && EP_FIX == LWNAF && defined(EP_PRECO)
		if (ep_curve_is_endom()) {
			ep_mul_sim_endom(r, g, k, q, m, ep_curve_get_tab());
		}
#else
		if (ep_curve_is_endom()) {
			ep_mul_sim(r, g, k, q, m);
		}
#endif
#endif

#if defined(EP_PLAIN) || defined(EP_SUPER)
#if EP_SIM == INTER && EP_FIX == LWNAF && defined(EP_PRECO)
		if (!ep_curve_is_endom()) {
			ep_mul_sim_plain(r, g, k, q, m, ep_curve_get_tab());
		}
#else
		if (!ep_curve_is_endom()) {
			ep_mul_sim(r, g, k, q, m);
		}
#endif
#endif
	}
	CATCH_ANY {
		THROW(ERR_CAUGHT);
	}
	FINALLY {
		ep_free(g);
	}
}
void ep_mul_sim_inter(ep_t r, const ep_t p, const bn_t k, const ep_t q,
		const bn_t m) {
#if defined(EP_ENDOM)
	if (ep_curve_is_endom()) {
		ep_mul_sim_endom(r, p, k, q, m, NULL);
		return;
	}
#endif

#if defined(EP_PLAIN) || defined(EP_SUPER)
	ep_mul_sim_plain(r, p, k, q, m, NULL);
#endif
}
Beispiel #3
0
void ep_mul_sim_inter(ep_t r, const ep_t p, const bn_t k, const ep_t q,
		const bn_t m) {

	if (bn_is_zero(k) || ep_is_infty(p)) {
		ep_mul(r, q, m);
		return;
	}
	if (bn_is_zero(m) || ep_is_infty(q)) {
		ep_mul(r, p, k);
		return;
	}

#if defined(EP_ENDOM)
	if (ep_curve_is_endom()) {
		ep_mul_sim_endom(r, p, k, q, m, NULL);
		return;
	}
#endif

#if defined(EP_PLAIN) || defined(EP_SUPER)
	ep_mul_sim_plain(r, p, k, q, m, NULL);
#endif
}