178{
179
180 init_counters();
181
185
188
191 fp_set(seed, in->seed);
194
195 clearpublicprimes(&Points[0], &A24);
196 clearpublicprimes(&Points[1], &A24);
197
198
199 for (int16_t
j =
batch_stop[primes_batches - 1] + 1;
j < primes_num;
j++)
200 {
203 }
204
205
206 int16_t unused[
batch_stop[primes_batches - 1] + 1];
207
208
209 int16_t u = 0;
210 int16_t e = 0;
211 int16_t w = 0;
212 for (e = 0; e <=
batch_stop[primes_batches - 1]; e++)
213 {
214#ifdef ENABLE_CT_TESTING
215 VALGRIND_MAKE_MEM_DEFINED(&u, sizeof(int16_t));
216 VALGRIND_MAKE_MEM_DEFINED(&e, sizeof(int16_t));
217 VALGRIND_MAKE_MEM_DEFINED(&w, sizeof(int16_t));
218#endif
219
220 unused[u] = e;
221
222 int64_t mov = -int64mask_equal((int64_t)e, (int64_t)priv->ells[w]);
223
225 t1[0] = u;
226 t2[0] = u + 1;
228 u = t1[0];
229
230 t1[0] = w;
231 t2[0] = w + 1;
233 w = t1[0];
234 }
235
236
237 int16_t tmp_b = 0;
238 for (u = 0; u <=
batch_stop[primes_batches - 1] - WOMBATKEYS; u++)
239 {
240 int16_t t = unused[u];
242 tmp_b++;
243
246
249 }
250
251
252
253 proj_copy(&Points[2], &Points[0]);
254 proj_copy(&Points[3], &Points[1]);
255
256 int16_t current_key = WOMBATKEYS - 1;
257 for (int16_t current_batch = primes_batches - 1; current_batch >= 0; current_batch--)
258 {
259 uint8_t inner_counter = 0;
260
261
262 proj_copy(&Points[0], &Points[2]);
263 proj_copy(&Points[1], &Points[3]);
264
265
266 tmp_b = 0;
268 {
270 tmp_b++;
271
274
277 }
278
279
281 {
282 uint16_t current_ell_index = priv->ells[current_key];
283 uint64_t current_ell = lookup(current_ell_index,
primes);
284
285 int64_t direction = priv->directions[current_key];
286
289
290
291
292
294 proj_cmov(&K, &Points[0], -int64mask_equal(direction, (int64_t)2));
295 proj_cmov(&K, &Points[1], 1 + int64mask_equal(direction, (int64_t)2));
296
297
299 {
301 }
302
303
306 proj_copy(&Points_[0], &Points[0]);
307 proj_copy(&Points_[1], &Points[1]);
308 proj_copy(&Points_[2], &Points[2]);
309 proj_copy(&Points_[3], &Points[3]);
310 proj_copy(&A_, &A);
311
312 if (current_key == 0)
313 {
314
315 xISOG_matryoshka(&A_, Points_, 0, &K, current_ell, lowerend_ell, upperend_ell);
316 }
318 {
319
320 xISOG_matryoshka(&A_, &Points_[2], 2, &K, current_ell, lowerend_ell, upperend_ell);
321 }
322 else if (current_batch == 0)
323 {
324
325 xISOG_matryoshka(&A_, Points_, 2, &K, current_ell, lowerend_ell, upperend_ell);
326 }
328 {
329
330
331 proj_cswap(&Points_[0], &Points_[1], -int64mask_equal(priv->directions[current_key - 1], (int64_t)2));
332 xISOG_matryoshka(&A_, &Points_[1], 3, &K, current_ell, lowerend_ell, upperend_ell);
333 proj_cswap(&Points_[0], &Points_[1], -int64mask_equal(priv->directions[current_key - 1], (int64_t)2));
334 }
335 else
336 {
337 xISOG_matryoshka(&A_, Points_, 4, &K, current_ell, lowerend_ell, upperend_ell);
338 }
339
340
341 proj_cmov(&A, &A_, -int64mask_nonzero(direction));
342 proj_cmov(&Points[0], &Points_[0], -int64mask_nonzero(direction));
343 proj_cmov(&Points[1], &Points_[1], -int64mask_nonzero(direction));
344 proj_cmov(&Points[2], &Points_[2], -int64mask_nonzero(direction));
345 proj_cmov(&Points[3], &Points_[3], -int64mask_nonzero(direction));
346
348
349
350 long long dac = lookup(current_ell_index,
primes_dac);
352
353
355 {
356
358 {
359 proj_cswap(&Points[0], &Points[1], -int64mask_equal(priv->directions[current_key - 1], (int64_t)2));
361 proj_cswap(&Points[0], &Points[1], -int64mask_equal(priv->directions[current_key - 1], (int64_t)2));
362 }
363 else
364 {
367 }
368 }
369
370 if (current_batch != 0)
371 {
374 }
375
376 inner_counter++;
377 }
378 }
379
381 fp_mul2(&
A.x, (
const fp *)&
A.z);
383}
uint64_t fp[NUMBER_OF_WORDS]
#define batch_keybounds_start
#define batch_keybounds_stop