116 uint8_t boolp = 0, boolm = 0;
121#ifdef ENABLE_CT_TESTING
122 VALGRIND_MAKE_MEM_DEFINED(&A,
sizeof(
proj));
123 VALGRIND_MAKE_MEM_DEFINED(&boolp,
sizeof(uint8_t));
124 VALGRIND_MAKE_MEM_DEFINED(&boolm,
sizeof(uint8_t));
125 VALGRIND_MAKE_MEM_DEFINED(&Tp,
sizeof(
proj));
133 clearpublicprimes(&Tp, &A);
134 clearpublicprimes(&Tm, &A);
142 for (
j =
batch_stop[primes_batches - 1] + 1;
j < primes_num;
j++)
149 proj_copy(&Pp[0], &Tp);
153 boolp &= (1 - fp_iszero(Pp[
j].z));
160 proj_copy(&Pm[0], &Tm);
165 boolm &= (1 - fp_iszero(Pm[
j].z));
170 }
while ((1 - boolp) | (1 - boolm));
172 fp_dec(u, (uint64_t *
const)u);
195 fp_set(seed, in->
seed);
199 clearpublicprimes(&Points[0], &A24);
200 clearpublicprimes(&Points[1], &A24);
209 for (int16_t
j =
batch_stop[primes_batches - 1] + 1;
j < primes_num;
j++)
216 int16_t unused[
batch_stop[primes_batches - 1] + 1];
221 for (e = 0; e <=
batch_stop[primes_batches - 1]; e++)
223#ifdef ENABLE_CT_TESTING
224 VALGRIND_MAKE_MEM_DEFINED(&u,
sizeof(int16_t));
225 VALGRIND_MAKE_MEM_DEFINED(&e,
sizeof(int16_t));
226 VALGRIND_MAKE_MEM_DEFINED(&w,
sizeof(int16_t));
231 int64_t mov = -int64mask_equal((int64_t)e, (int64_t)priv->
ells[w]);
247 for (u = 0; u <=
batch_stop[primes_batches - 1] - WOMBATKEYS; u++)
249 int16_t t = unused[u];
261 proj ramifications[2 * WOMBATKEYS] = {0};
268 xmul_counter[WOMBATKEYS] = {0},
274 proj_copy(&ramifications[0], (
const proj *)&Points[0]);
275 proj_copy(&ramifications[1], (
const proj *)&Points[1]);
277 int16_t current_batch = 0;
280 proj Points_[2 * WOMBATKEYS] = {0};
284 for (
int i = WOMBATKEYS - 1;
i >= 0;
i--)
293 uint16_t flip_index = WOMBATKEYS -
i -1;
294 uint16_t current_ell_index = priv->
ells[flip_index];
295 uint64_t current_ell = lookup(current_ell_index,
primes);
297 int64_t direction = priv->
directions[flip_index];
300 uint64_t upperend_ell =
primes[
batch_stop[current_batch] - current_batch_inner + 1];
304 swap = -int64mask_equal(direction, (int64_t)2);
305 proj_cswap(&ramifications[0+ 2 * block], &ramifications[1+ 2 * block],
swap);
307 tmp_b = primes_batches-1;
312 proj_copy(&ramifications[0 + 2 * block], (
const proj *)&ramifications[0 + 2 * (block - 1)]);
313 proj_copy(&ramifications[1 + 2 * block], (
const proj *)&ramifications[1 + 2 * (block - 1)]);
316 for (inner = moves; inner < (moves +
strategy[k]); inner++)
318 pos = WOMBATKEYS - inner -1;
327 xMUL_dac(&ramifications[0 + 2 * block], &A24, 0, &ramifications[0 + 2 * block], dac, daclen,
batch_maxdac[tmp_b]);
328 xMUL_dac(&ramifications[1 + 2 * block], &A24, 0, &ramifications[1 + 2 * block], dac, daclen,
batch_maxdac[tmp_b]);
331 xMUL_dac(&ramifications[0 + 2 * block], &A24, 0, &ramifications[0 + 2 * block], dac, daclen,
batch_maxdac[tmp_b]);
345 proj_copy(&Anew, &A);
346 for (
int j = 0;
j < Plen;
j++)
349 proj_copy(&Points_[
j], &ramifications[
j]);
352 xISOG_matryoshka(&Anew, Points_, Plen, &ramifications[0 + 2 * block], current_ell, lowerend_ell, upperend_ell);
356 proj_cmov(&A, &Anew, -int64mask_nonzero(direction));
360 for (
int j = 0;
j < Plen;
j++)
362 proj_cmov(&ramifications[
j], &Points_[
j], -int64mask_nonzero(direction));
366 int64_t dac = lookup(current_ell_index,
primes_dac);
374 moves -= xmul_counter[block];
375 xmul_counter[block] = 0;
378 proj_cswap(&ramifications[0+ 2 * block], &ramifications[1+ 2 * block],
swap);
380 current_batch_inner--;
385 fp_mul2(&A.x, (
const fp *)&A.z);
void swap(ticks *a, ticks *b)