Skip to content

Commit

Permalink
Convert a bit more.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaranha committed Dec 29, 2024
1 parent abb65a0 commit 0d1ec62
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/bn/relic_bn_rec.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,6 @@ void bn_rec_glv(bn_t k0, bn_t k1, const bn_t k, const bn_t n, const bn_st *v1,
bn_new(u);

bn_abs(t, k);
bits = bn_bits(n);

/* b1 = (k * v10) >> (bits + 1). */
dv_copy(_k, k->dp, k->used);
Expand Down Expand Up @@ -872,8 +871,20 @@ void bn_rec_glv(bn_t k0, bn_t k1, const bn_t k, const bn_t n, const bn_st *v1,
k1->sign = v2[0].sign ^ v2[1].sign;
bn_trim(k1);

bn_sub(k0, t, k0);
bn_sub(k0, k0, k1);
k0->sign ^= 1;
bn_negs_low(k0->dp, k0->dp, k0->sign, 2 * RLC_FP_DIGS);
bn_addn_low(k0->dp, k0->dp, _k, 2 * RLC_FP_DIGS);
k0->sign = k0->dp[2 * RLC_FP_DIGS - 1] & 1;
k0->used = 2 * RLC_FP_DIGS;
bn_trim(k0);
k1->sign ^= 1;
k1->used = 2 * RLC_FP_DIGS;
bn_negs_low(k1->dp, k1->dp, k1->sign, 2 * RLC_FP_DIGS);
bn_addn_low(k0->dp, k0->dp, k1->dp, 2 * RLC_FP_DIGS);
k0->sign = k0->dp[2 * RLC_FP_DIGS - 1] & 1;
bn_negs_low(k0->dp, k0->dp, k0->sign, 2 * RLC_FP_DIGS);
k0->used = 2 * RLC_FP_DIGS;
bn_trim(k0);

dv_zero(_v, 2 * RLC_FP_DIGS);
dv_copy(_v, v1[2].dp, v1[2].used);
Expand Down

0 comments on commit 0d1ec62

Please sign in to comment.