From 12cf3d6f1a64c2309531e7eb7a6f24a6da363096 Mon Sep 17 00:00:00 2001 From: "Diego F. Aranha" Date: Thu, 15 Aug 2024 00:33:54 +0200 Subject: [PATCH] Speedup. --- src/epx/relic_ep4_mul.c | 3 ++- src/pc/relic_pc_exp.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/epx/relic_ep4_mul.c b/src/epx/relic_ep4_mul.c index 856807537..fa092228a 100644 --- a/src/epx/relic_ep4_mul.c +++ b/src/epx/relic_ep4_mul.c @@ -122,7 +122,8 @@ static void ep4_mul_gls_imp(ep4_t r, const ep4_t p, const bn_t k) { } ep4_tab(t[0], q, RLC_WIDTH); - if (ep_curve_is_pairf() == EP_K16) { + if (ep_curve_is_pairf() == EP_K16 || ep_curve_is_pairf() == EP_N16) { + /* Minimize use of endomorphism when it's expensive. */ for (size_t i = 1; i < 8; i++) { ep4_psi(q, t[i - 1][0]); if (bn_sign(_k[i]) == RLC_NEG) { diff --git a/src/pc/relic_pc_exp.c b/src/pc/relic_pc_exp.c index 154e91f32..03fbe4fbc 100644 --- a/src/pc/relic_pc_exp.c +++ b/src/pc/relic_pc_exp.c @@ -175,7 +175,8 @@ void gt_exp_gls_naf(gt_t c, const gt_t a, const bn_t b, size_t f) { l = RLC_MAX(l, _l[i]); } - if (ep_curve_is_pairf() == EP_K16 || ep_curve_embed() == 18) { + if (ep_curve_is_pairf() == EP_K16 || ep_curve_is_pairf() == EP_N16 || + ep_curve_embed() == 18) { gt_copy(t[0], a); for (size_t i = 1; i < f; i++) { gt_psi(t[i * RLC_GT_TABLE], t[(i - 1) * RLC_GT_TABLE]);