Cryptography Reference
In-Depth Information
Determination of a pseudorandom prime number
p_l
of type CLINT with
2
l
−
1
Function:
≤
p_l
<
2
l
and
gcd(
p_l
−
1
,
f_l
)=1
using the FLINT/C pseudorandom
number generators; required is previous initialization
viaacalltothefunction
InitRand_l
with suitable parameters
int
FindPrime_l (CLINT p_l, STATEPRNG *xrstate,
USHORT l, CLINT f_l);
Syntax:
Input:
xrstate
(initialized internal state of a pseudorandom
number generator)
l
(number of binary digits of
p_l
)
f_l
(number that should be relatively prime to
p_l
−
1
Output:
p_l
(probabilistically determined prime number)
xrstate
(new internal state of pseudorandom number generator)
E_CLINT_OK
if all OK
E_CLINT_RNG
if error in specifying the generator in
xrstate
E_CLINT_RGE
if
l
=0
or
f_l
odd
E_CLINT_RIN
if random number generator is uninitialized
Return:
int
FindPrimeGcd_l (CLINT p_l, STATEPRNG *xrstate, USHORT l, CLINT f_l)
{
CLINT pmin_l;
clint pmax_l[CLINTMAXSHORT + 1];
int error;
if (0 == l)
{
return E_CLINT_RGE;
}
SETZERO_L (pmin_l);
SETZERO_L (pmax_l);
setbit_l (pmin_l,l-1);
setbit_l (pmax_l, l);
dec_l (pmax_l);
error = FindPrimeMinMaxGcd_l (p_l, xrstate, pmin_l, pmax_l, f_l);
return error;
}
In the last step we wish to avoid the condition of relative primality by passing
one as a parameter in the call
FindPrimeGcd_l (p_l, xrstate, l, one_l)
: