18 printf(
"=== RUN %s\n", __func__);
24 _1 = { 1, 0, 0, 0, 0, 0 },
25 _2 = { 2, 0, 0, 0, 0, 0 },
26 _4 = { 4, 0, 0, 0, 0, 0 },
27 _6 = { 6, 0, 0, 0, 0, 0 },
28 _16 = { 16, 0, 0, 0, 0, 0 },
29 _36 = { 36, 0, 0, 0, 0, 0 };
31 fp_t x, xsqr, x2, x4, x8, x12, l, r;
35 for (
int i=0; pass && i<
TESTVALS; i++) {
56 printf(
"%d: FAILED\n", i);
75 printf(
"%d: FAILED\n", i);
94 printf(
"%d: FAILED\n", i);
113 printf(
"%d: FAILED\n", i);
122 printf(
"%ld tests\n", count);
137 printf(
"=== RUN %s\n", __func__);
142 fp_t x, xsqr, x2, y, l, r;
146 for (
int i=0; pass && i<
TESTVALS; i++) {
151 for (
int j=i; pass && j<
TESTVALS; j++) {
165 printf(
"%d: FAILED\n", i);
176 printf(
"%ld tests\n", count);
__device__ void fp_print(const char *s, const fp_t &x)
Prints the canonical representation of x to STDOUT.
__device__ bool fp_neq(const fp_t &x, const fp_t &y)
Compares two fp_t residues.
__device__ void fp_add(fp_t &z, const fp_t &x, const fp_t &y)
Computes the sum of two residues x and y modulo p and stores it in z. Device only function.
__device__ void fp_x8(fp_t &z, const fp_t &x)
Multiplies x by 8 and stores the result into z.
__device__ void fp_x2(fp_t &z, const fp_t &x)
Multiplies x by 2 and stores the result into z.
__device__ void fp_x12(fp_t &z, const fp_t &x)
Multiplies the residue mod p x by 12 and stores the result into z.
__device__ void fp_x4(fp_t &z, const fp_t &x)
Multiplies x by 4 and stores the result into z.
__device__ void fp_sqr(fp_t &z, const fp_t &x)
Computes the square of the residue x modulo p and stores it in z.
uint64_t fp_t[6]
Residue modulo p. Any 384-bit representative of each residue is allowed, and stored as a 6-element li...
__device__ void fp_mul(fp_t &z, const fp_t &x, const fp_t &y)
Multiplies two Fp residues x and y, stores in z.
__device__ __host__ void fp_cpy(fp_t &z, const fp_t &x)
Copy from x into z.
__managed__ testval_t testval[TESTVALS]
__global__ void FpTestSqr2(testval_t *testval)
Test for squaring on Fp. Checks for self consistency:
__global__ void FpTestSqr(testval_t *testval)
Test for squaring on Fp. Checks for self consistency: