From 05cac080da989a59ef260bef478202056e0abb51 Mon Sep 17 00:00:00 2001 From: mdw Date: Sat, 17 Jun 2000 10:45:48 +0000 Subject: [PATCH] Minor changes for key fetching. Typesetting fixes. --- bbs.h | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/bbs.h b/bbs.h index 6e23d02..2098745 100644 --- a/bbs.h +++ b/bbs.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: bbs.h,v 1.3 2000/02/12 18:21:02 mdw Exp $ + * $Id: bbs.h,v 1.4 2000/06/17 10:45:48 mdw Exp $ * * The Blum-Blum-Shub random bit generator * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: bbs.h,v $ + * Revision 1.4 2000/06/17 10:45:48 mdw + * Minor changes for key fetching. Typesetting fixes. + * * Revision 1.3 2000/02/12 18:21:02 mdw * Overhaul of key management (again). * @@ -47,14 +50,14 @@ * sequence %$x_i = x_{i - 1}^2 \bmod n$%, where %$n = pq$% is the product of * two primes %$p$% and %$q$%, each of which are congruent to %$3 \bmod 4$%. * For maximum period of the generator, %$(p - 1)/2$% and %$(q - 1)/1$% - * should be coprime. It is safe to use the least significant %$\log \log - * n$% bits of each step in the sequence -- an adversary must factor the - * modulus before being able to work forwards or backwards. The output of - * the generator cannot be distinguished from a (uniform, independent) random - * sequence of bits using any polynomial-time test. This is by far the - * strongest pseudorandom number generator provided in Catacomb, and by far - * the slowest too. For normal use, the standard Catacomb @rand@ generator - * should be more than adequate. + * should be coprime. It is safe to use the least significant + * %$\log \log n$% bits of each step in the sequence -- an adversary must + * factor the modulus before being able to work forwards or backwards. The + * output of the generator cannot be distinguished from a (uniform, + * independent) random sequence of bits using any polynomial-time test. This + * is by far the strongest pseudorandom number generator provided in + * Catacomb, and by far the slowest too. For normal use, the standard + * Catacomb @rand@ generator should be more than adequate. */ #ifndef CATACOMB_BBS_H @@ -72,6 +75,10 @@ # include "grand.h" #endif +#ifndef CATACOMB_KEY_H +# include "key.h" +#endif + #ifndef CATACOMB_MP_H # include "mp.h" #endif @@ -98,10 +105,22 @@ typedef struct bbs { /* --- Parameters --- */ +typedef struct bbs_pub { + mp *n; +} bbs_pub; + typedef struct bbs_param { mp *p, *q; /* Prime factors (3 mod 4) */ mp *n; /* Product @pq@ -- a Blum integer */ -} bbs_param; +} bbs_param, bbs_priv; + +/*----- Key fetching ------------------------------------------------------*/ + +extern const key_fetchdef bbs_pubfetch[]; +#define BBS_PUBFETCHSZ 3 + +extern const key_fetchdef bbs_privfetch[]; +#define BBS_PRIVFETCHSZ 7 /*----- The basic generator -----------------------------------------------*/ @@ -192,7 +211,7 @@ extern uint32 bbs_bits(bbs */*b*/, unsigned /*bits*/); * * If a generator is seeded, %$b$% bits are extracted, and then * @bbs_wrap@ is called, the generator will have been stepped - * %$\lceil b/k \rceil% times. + * %$\lceil b/k \rceil$% times. */ extern void bbs_wrap(bbs */*b*/); -- 2.11.0