Skip to content

Commit

Permalink
Fix comment and test.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaranha committed Feb 7, 2021
1 parent c24ac17 commit f3be2ba
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ep/relic_ep_cmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int ep_cmp(const ep_t p, const ep_t q) {
}

switch (p->coord) {
/* Now to the same for the other point. */
/* Now do the same for the other point. */
case PROJC:
fp_mul(s->x, q->x, p->z);
fp_mul(s->y, q->y, p->z);
Expand Down
1 change: 0 additions & 1 deletion src/low/gmp_sec/relic_fp_rdc_low.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ void fp_rdcs_low(dig_t *c, const dig_t *a, const dig_t *m) {
first = (d0) + (b0 == 0 ? 0 : 1);

/* q = floor(a/b^k) */
dv_zero(q, 2 * RLC_FP_DIGS);
dv_rshd(q, a, 2 * RLC_FP_DIGS, d0);
if (b0 > 0) {
bn_rshb_low(q, q, 2 * RLC_FP_DIGS, b0);
Expand Down
16 changes: 16 additions & 0 deletions src/pc/relic_pc_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ int g1_is_valid(g1_t a) {
g1_t u;
int r;

if (g1_is_infty(a)) {
return 0;
}

bn_null(n);
g1_null(u);

Expand All @@ -106,6 +110,7 @@ int g1_is_valid(g1_t a) {
g1_add(u, u, a);
}
}
g1_neg(u, u);
r = (g1_cmp(u, a) == RLC_EQ);
}
} RLC_CATCH_ANY {
Expand All @@ -124,6 +129,11 @@ int g2_is_valid(g2_t a) {
return g1_is_valid(a);
}
#else

if (g2_is_infty(a)) {
return 0;
}

bn_t p, n;
g2_t u, v;
int r;
Expand Down Expand Up @@ -168,6 +178,7 @@ int g2_is_valid(g2_t a) {
g2_add(u, u, a);
}
}
g2_neg(u, u);
r = (g2_cmp(u, a) == RLC_EQ);
}
} RLC_CATCH_ANY {
Expand All @@ -188,6 +199,10 @@ int gt_is_valid(gt_t a) {
gt_t u, v;
int r;

if (gt_is_unity(a)) {
return 0;
}

bn_null(n);
bn_null(p);
gt_null(u);
Expand Down Expand Up @@ -226,6 +241,7 @@ int gt_is_valid(gt_t a) {
gt_mul(u, u, a);
}
}
gt_inv(u, u);
r = (gt_cmp(u, a) == RLC_EQ);
}
} RLC_CATCH_ANY {
Expand Down

0 comments on commit f3be2ba

Please sign in to comment.