Skip to content

Commit

Permalink
Rename function to match new pattern.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaranha committed Mar 30, 2024
1 parent 7e86e21 commit 427deda
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion include/relic_pc.h
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,15 @@ typedef RLC_CAT(RLC_GT_LOWER, t) gt_t;
*/
#define g1_mul_sec(R, P, K) RLC_CAT(RLC_G1_LOWER, mul_lwreg)(R, P, K)

/**
* Multiplies an element from G_2 by a secret scalar. Computes R = [k]P.
*
* @param[out] R - the result.
* @param[in] P - the element to multiply.
* @param[in] K - the secret scalar.
*/
#define g2_mul_sec(R, P, K) RLC_CAT(RLC_G1_LOWER, mul_lwreg)(R, P, K)

/**
* Multiplies an element from a larger group containing G_1 by a scalar.
* Computes R = [k]P.
Expand Down Expand Up @@ -1046,7 +1055,7 @@ void gt_exp(gt_t c, const gt_t a, const bn_t b);
* @param[in] a - the element to exponentiate.
* @param[in] b - the integer exponent.
*/
void gt_exp_key(gt_t c, const gt_t a, const bn_t b);
void gt_exp_sec(gt_t c, const gt_t a, const bn_t b);

/**
* Exponentiates an element from G_T by a small integer. Computes c = a^b.
Expand Down
2 changes: 1 addition & 1 deletion src/pc/relic_pc_exp.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void gt_exp(gt_t c, const gt_t a, const bn_t b) {
#endif
}

void gt_exp_key(gt_t c, const gt_t a, const bn_t b) {
void gt_exp_sec(gt_t c, const gt_t a, const bn_t b) {
size_t f = 0;

if (bn_bits(b) <= RLC_DIG) {
Expand Down
2 changes: 1 addition & 1 deletion test/test_pc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,7 @@ int exponentiation(void) {
TEST_ASSERT(gt_cmp(a, b) == RLC_EQ, end);
bn_rand_mod(d, n);
gt_exp(b, a, d);
gt_exp_key(c, a, d);
gt_exp_sec(c, a, d);
TEST_ASSERT(gt_cmp(b, c) == RLC_EQ, end);
gt_rand(b);
bn_rand_mod(e, n);
Expand Down

0 comments on commit 427deda

Please sign in to comment.