mirror of
https://github.com/cathugger/mkp224o.git
synced 2026-01-26 19:22:09 -06:00
2 stage batching
This commit is contained in:
@@ -1,17 +1,23 @@
|
||||
#include "ge.h"
|
||||
|
||||
// inz is ge_p3.Z pointer array. contents to .Zs will be overwritten
|
||||
void ge_p3_batchtobytes_destructive(bytes32 out[],const ge_p3 in[],fe *inz[],fe tmp[],size_t num)
|
||||
// NOTE: leaves in unfinished state
|
||||
void ge_p3_batchtobytes_destructive_1(bytes32 out[],ge_p3 in[],fe *inz[],fe tmp[],size_t num)
|
||||
{
|
||||
fe x;
|
||||
fe y;
|
||||
|
||||
fe_batchinvert(inz,tmp,inz,num);
|
||||
|
||||
for (size_t i = 0;i < num;++i) {
|
||||
fe_mul(x,in[i].X,*inz[i]);
|
||||
fe_mul(y,in[i].Y,*inz[i]);
|
||||
fe_mul(y,in[i].Y,in[i].Z);
|
||||
fe_tobytes(out[i],y);
|
||||
out[i][31] ^= fe_isnegative(x) << 7;
|
||||
}
|
||||
}
|
||||
|
||||
void ge_p3_batchtobytes_destructive_finish(bytes32 out,ge_p3 *unf)
|
||||
{
|
||||
fe x;
|
||||
// z of unfinished is inverted
|
||||
fe_mul(x,unf->X,unf->Z);
|
||||
out[31] ^= fe_isnegative(x) << 7;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user