Skip to content

Commit

Permalink
Fixes to bandling beta in EP.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaranha committed Feb 5, 2024
1 parent d7a31ed commit e80d1e4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/relic_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ typedef struct _ctx_t {
/** Precomputed constants for hashing. */
fp_st ep_map_c[7];
#ifdef EP_ENDOM
fp_st beta;
#if EP_MUL == LWNAF || EP_FIX == COMBS || EP_FIX == LWNAF || EP_SIM == INTER || !defined(STRIP)
/** Parameters required by the GLV method. @{ */
fp_st beta;
bn_st ep_v1[3];
bn_st ep_v2[3];
/** @} */
Expand Down
2 changes: 2 additions & 0 deletions src/ep/relic_ep_curve.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ void ep_curve_set_plain(const fp_t a, const fp_t b, const ep_t g, const bn_t r,
ctx->ep_is_endom = 0;
ctx->ep_is_super = 0;

#ifdef EP_ENDOM
/* We do not use beta due to lack of endomorphisms so compute and cache
* square root of -1 for evaluating the distortion map in pairing-friendly
* curves with embedding degree 1. */
Expand All @@ -467,6 +468,7 @@ void ep_curve_set_plain(const fp_t a, const fp_t b, const ep_t g, const bn_t r,
fp_neg(ctx->beta, ctx->beta);
fp_srt(ctx->beta, ctx->beta);
}
#endif

ep_curve_set(a, b, g, r, h, ctmap);
}
Expand Down
2 changes: 1 addition & 1 deletion test/test_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -1403,8 +1403,8 @@ static int hashing(void) {
TEST_ASSERT(ep_on_curve(a) && ep_is_infty(a) == 1, end);
}
TEST_END;
#endif
}
#endif
}
RLC_CATCH_ANY {
RLC_ERROR(end);
Expand Down

0 comments on commit e80d1e4

Please sign in to comment.