Lines Matching defs:secpar
34 #define ISVALID_SECPAR(secpar) (((secpar) % 16 == 0) && ((secpar) >= 16) && ((secpar) <= 16384))
35 #define VALIDATE_SECPAR(secpar) assert(ISVALID_SECPAR(secpar));
144 static gcry_mpi_t gensquare(const gcry_mpi_t n, const void *seed, size_t seedlen, uint32_t idx, unsigned secpar) {
145 size_t buflen = secpar / 8;
240 static void store_secpar(void *buf, uint16_t secpar) {
241 secpar = secpar / 16 - 1;
242 ((uint8_t*) buf)[0] = (secpar >> 8) & 0xff;
243 ((uint8_t*) buf)[1] = (secpar >> 0) & 0xff;
247 uint16_t secpar;
248 secpar =
251 return 16 * (secpar + 1);
257 uint16_t secpar;
260 secpar = _secpar;
270 p = genprime3mod4(secpar / 2, seed, seedlen, RND_GEN_P);
271 q = genprime3mod4(secpar / 2, seed, seedlen, RND_GEN_Q);
274 store_secpar(msk + 0, secpar);
275 mpi_export(msk + 2 + 0 * (secpar / 2) / 8, (secpar / 2) / 8, p);
276 mpi_export(msk + 2 + 1 * (secpar / 2) / 8, (secpar / 2) / 8, q);
282 assert(gcry_mpi_get_nbits(n) == secpar);
284 store_secpar(mpk + 0, secpar);
285 mpi_export(mpk + 2, secpar / 8, n);
296 uint16_t secpar;
300 secpar = read_secpar(mpk + 0);
301 n = mpi_import(mpk + 2, secpar / 8);
302 x = gensquare(n, seed, seedlen, RND_GEN_X, secpar);
304 memcpy(state, mpk, 2 + secpar / 8);
305 mpi_export(state + 2 + 1 * secpar / 8, secpar / 8, x);
306 memzero(state + 2 + 2 * secpar / 8, 8);
314 uint16_t secpar;
319 secpar = read_secpar(state + 0);
320 n = mpi_import(state + 2 + 0 * secpar / 8, secpar / 8);
321 x = mpi_import(state + 2 + 1 * secpar / 8, secpar / 8);
322 epoch = uint64_import(state + 2 + 2 * secpar / 8, 8);
327 mpi_export(state + 2 + 1 * secpar / 8, secpar / 8, x);
328 uint64_export(state + 2 + 2 * secpar / 8, 8, epoch);
335 uint16_t secpar;
336 secpar = read_secpar(state + 0);
337 return uint64_import(state + 2 + 2 * secpar / 8, 8);
342 uint16_t secpar;
346 secpar = read_secpar(msk + 0);
347 p = mpi_import(msk + 2 + 0 * (secpar / 2) / 8, (secpar / 2) / 8);
348 q = mpi_import(msk + 2 + 1 * (secpar / 2) / 8, (secpar / 2) / 8);
353 x = gensquare(n, seed, seedlen, RND_GEN_X, secpar);
364 store_secpar(state + 0, secpar);
365 mpi_export(state + 2 + 0 * secpar / 8, secpar / 8, n);
366 mpi_export(state + 2 + 1 * secpar / 8, secpar / 8, xm);
367 uint64_export(state + 2 + 2 * secpar / 8, 8, epoch);
381 uint16_t secpar;
385 secpar = read_secpar(state + 0);
386 det_randomize(key, keylen, state + 2, 2 * secpar / 8 + 8, idx);