ref10: tweak things

This commit is contained in:
cathugger 2019-01-19 14:39:33 +00:00
parent 9139d302fb
commit ffb8498905
No known key found for this signature in database
GPG key ID: 9BADDA2DAF6F01A8
4 changed files with 8 additions and 6 deletions

View file

@ -53,7 +53,7 @@ extern void fe_sq(fe,const fe);
extern void fe_sq2(fe,const fe);
extern void fe_mul121666(fe,const fe);
extern void fe_invert(fe,const fe);
extern void fe_batchinvert(fe out[],fe tmp[],const fe in[], size_t num);
extern void fe_batchinvert(fe *out[],fe tmp[],const fe *in[], size_t num);
extern void fe_pow22523(fe,const fe);
#endif

View file

@ -2,7 +2,7 @@
// tmp MUST != out
// in MAY == out
void fe_batchinvert(fe out[],fe tmp[],const fe in[], size_t num)
void fe_batchinvert(fe *out[],fe tmp[],const fe *in[], size_t num)
{
fe acc;
fe tmpacc;
@ -12,15 +12,15 @@ void fe_batchinvert(fe out[],fe tmp[],const fe in[], size_t num)
for (i = 0;i < num;++i) {
fe_copy(tmp[i],acc);
fe_mul(acc,acc,in[i]);
fe_mul(acc,acc,*in[i]);
}
fe_invert(acc,acc);
i = num;
while (i--) {
fe_mul(tmpacc,acc,in[i]);
fe_mul(out[i],acc,tmp[i]);
fe_mul(tmpacc,acc,*in[i]);
fe_mul(*out[i],acc,tmp[i]);
fe_copy(acc,tmpacc);
}
}

View file

@ -50,6 +50,8 @@ typedef struct {
fe T2d;
} ge_cached;
typedef unsigned char bytes32[32];
#define ge_frombytes_negate_vartime crypto_sign_ed25519_ref10_ge_frombytes_negate_vartime
#define ge_tobytes crypto_sign_ed25519_ref10_ge_tobytes
#define ge_p3_tobytes crypto_sign_ed25519_ref10_ge_p3_tobytes

View file

@ -1,6 +1,6 @@
#include "ge.h"
void ge_p3_tobytes(unsigned char *s,const ge_p3 *h)
void ge_p3_tobytes(bytes32 s,const ge_p3 *h)
{
fe recip;
fe x;