From 7b849c119daa33f4a20974a3a6198ed88d88179e Mon Sep 17 00:00:00 2001 From: "Diego F. Aranha" Date: Tue, 23 Apr 2024 19:03:43 +0200 Subject: [PATCH] Support fields where -3 is QNR. --- src/ep/relic_ep_curve.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ep/relic_ep_curve.c b/src/ep/relic_ep_curve.c index 707a7cfdd..420f56f83 100644 --- a/src/ep/relic_ep_curve.c +++ b/src/ep/relic_ep_curve.c @@ -173,7 +173,7 @@ static void ep_curve_set_map(void) { /* If curve is not supersingular, precompute and store sqrt(-3) * neeed for hashing using the SwiftEC algorithm and variants. */ - if (!ep_curve_is_super()) { + if (!ep_curve_is_super() && (ep_curve_opt_a() == RLC_ZERO || ep_curve_opt_b() == RLC_ZERO)) { fp_set_dig(c4, 3); fp_neg(c4, c4); if (!fp_srt(c4, c4)) { @@ -574,4 +574,5 @@ int ep_curve_frdim(void) { return 16; break; } -} \ No newline at end of file + return 0; +}