82 printf(
"#x%016lx%016lx%016lx%016lx%016lx%016lx ", p.
x[5], p.
x[4], p.
x[3], p.
x[2], p.
x[1], p.
x[0]);
83 printf(
"#x%016lx%016lx%016lx%016lx%016lx%016lx ", p.
y[5], p.
y[4], p.
y[3], p.
y[2], p.
y[1], p.
y[0]);
84 printf(
"#x%016lx%016lx%016lx%016lx%016lx%016lx\n", p.
z[5], p.
z[4], p.
z[3], p.
z[2], p.
z[1], p.
z[0]);
94 for (
int i=0; i<6; i++)
95 p.
x[i] = p.
y[i] = p.
z[i] = 0;
107 p.
x[5] = 0x17F1D3A73197D794;
108 p.
x[4] = 0x2695638C4FA9AC0F;
109 p.
x[3] = 0xC3688C4F9774B905;
110 p.
x[2] = 0xA14E3A3F171BAC58;
111 p.
x[1] = 0x6C55E83FF97A1AEF;
112 p.
x[0] = 0xFB3AF00ADB22C6BB;
114 p.
y[5] = 0x08B3F481E3AAA0F1;
115 p.
y[4] = 0xA09E30ED741D8AE4;
116 p.
y[3] = 0xFCF5E095D5D00AF6;
117 p.
y[2] = 0x00DB18CB2C04B3ED;
118 p.
y[1] = 0xD03CC744A2888AE4;
119 p.
y[0] = 0x0CAA232946C5E7E1;
142 unsigned tid = 0; tid += blockIdx.z;
143 tid *= gridDim.y; tid += blockIdx.y;
144 tid *= gridDim.x; tid += blockIdx.x;
145 tid *= blockDim.z; tid += threadIdx.z;
146 tid *= blockDim.y; tid += threadIdx.y;
147 tid *= blockDim.x; tid += threadIdx.x;
151 unsigned step = gridDim.z * gridDim.y * gridDim.x
152 * blockDim.z * blockDim.y * blockDim.x;
154 for (
unsigned i=tid; i<count; i+=step)
155 eq[i] =
g1p_eq(p[i], q[i]) ? 1 : 0;
168 unsigned tid = 0; tid += blockIdx.z;
169 tid *= gridDim.y; tid += blockIdx.y;
170 tid *= gridDim.x; tid += blockIdx.x;
171 tid *= blockDim.z; tid += threadIdx.z;
172 tid *= blockDim.y; tid += threadIdx.y;
173 tid *= blockDim.x; tid += threadIdx.x;
175 unsigned step = gridDim.z * gridDim.y * gridDim.x
176 * blockDim.z * blockDim.y * blockDim.x;
178 for (
unsigned i=tid; i<count; i+=step)
__device__ void fp_toUint64(uint64_t *z, const fp_t &x)
Converts from residue modulo p (fp_t) to uint64_t[6]. The converted value is in canonical form.
__device__ __host__ void fp_one(fp_t &z)
Sets z to one.
__device__ __host__ void fp_fromUint64(fp_t &z, const uint64_t *x)
Converts uint64_t[6] to fp_t. After this operation, z represents x mod p.
__device__ bool fp_iszero(const fp_t &x)
Checks if the residue x modulo p is congruent to zero.
__device__ __host__ void fp_cpy(fp_t &z, const fp_t &x)
Copy from x into z.
__device__ bool g1p_eq(const g1p_t &p, const g1p_t &q)
Compares two projective points returns true when equal. This function compares if both parameters rep...
__device__ void g1a_fromG1p(g1a_t &a, const g1p_t &p)
Converts a point in projective coordinates into affine coordinates.
__device__ void g1p_fromG1a(g1p_t &p, const g1a_t &a)
Convert a point in affine coordinates to projective coordinates.
__device__ __host__ void g1p_inf(g1p_t &p)
Set p to the point-at-infinity (0,1,0)
__device__ void g1p_toUint64(const g1p_t &p, uint64_t *x, uint64_t *y, uint64_t *z)
Converts G1 point into arrays of uint64_t. Each array must be uint64_t[6] This function does not vali...
__device__ __host__ void g1p_fromUint64(g1p_t &p, uint64_t *x, uint64_t *y, uint64_t *z)
Converts arrays of uint64_t into a G1 point. Each array must be uint64_t[6] This function does not va...
__global__ void g1p_eq_wrapper(uint8_t *eq, size_t count, const g1p_t *p, const g1p_t *q)
Kernel wrapper, host-callable comparison of arrays of g1p_t.
__global__ void g1a_fromG1p_wrapper(g1a_t *a, size_t count, const g1p_t *p)
Kernel wrappers, host-callable conversion of points in projective coordinates into affine coordinates...
__device__ __host__ void g1p_gen(g1p_t &p)
Sets p to the generator point G1 of bls12_381.
__device__ __host__ void g1p_cpy(g1p_t &p, const g1p_t &q)
Copy from q into p.
__device__ __host__ void g1p_print(const char *s, const g1p_t &p)
Print a standard representation of p, preceded by the user-set string s.
G1 point in affine coordinates.
G1 point in projective coordinates.