dont do indirection in for batch stuff

This commit is contained in:
cathugger
2020-11-22 10:21:06 +00:00
parent 5b5f414b79
commit 51d87c3857
19 changed files with 86 additions and 71 deletions

View File

@@ -14,7 +14,7 @@ ge25519_p1p1_to_partial(ge25519 *r, const ge25519_p1p1 *p) {
curve25519_untangle64(r->x, r->z, xzout);
}
static void
static void
ge25519_p1p1_to_full(ge25519 *r, const ge25519_p1p1 *p) {
packed64bignum25519 ALIGN(16) zy, xt, xx, zz, ty;
curve25519_tangle64(ty, p->t, p->y);
@@ -222,10 +222,10 @@ ge25519_pack(unsigned char r[32], const ge25519 *p) {
// assumes inz[] points to things in in[]
// NOTE: leaves in unfinished state
static void
ge25519_batchpack_destructive_1(bytes32 out[], ge25519 in[], bignum25519 *inz[], bignum25519 tmp[], size_t num) {
ge25519_batchpack_destructive_1(bytes32 *out, ge25519 *in, bignum25519 *tmp, size_t num) {
bignum25519 ALIGN(16) ty;
curve25519_batchrecip(inz, tmp, inz, num);
curve25519_batchrecip(&in->z, &in->z, tmp, num, sizeof(ge25519));
for (size_t i = 0; i < num; ++i) {
curve25519_mul(ty, in[i].y, in[i].z);
@@ -395,7 +395,7 @@ ge25519_scalarmult_base_niels(ge25519 *r, const uint8_t table[256][96], const bi
ge25519_scalarmult_base_choose_niels(&t, table, 0, b[1]);
curve25519_sub_reduce(r->x, t.xaddy, t.ysubx);
curve25519_add_reduce(r->y, t.xaddy, t.ysubx);
memset(r->z, 0, sizeof(bignum25519));
memset(r->z, 0, sizeof(bignum25519));
r->z[0] = 2;
curve25519_copy(r->t, t.t2d);
for (i = 3; i < 64; i += 2) {