Cryptography Reference
In-Depth Information
set initial values for
randbit_l()
and
randBBS_l()
Function:
int seedBBS_l (STATEBBS *rstate, CLINT seed_l);
Syntax:
rstate
(pointer to state memory)
seed_l
(initial value)
Input:
rstate
(pointer to initialized state memory)
Output:
E_CLINT_OK
if all O.K.
E_CLINT_RCP
: start value and modulus not relatively prime
Return:
int
seedBBS_l (STATEBBS *rstate CLINT seed_l)
{
CLINT g_l;
str2clint_l (rstate->MODBBS, (char *)MODBBSSTR, 16);
gcd_l (rstate->MODBBS, seed_l, g_l);
if (!EQONE_L (g_l))
{
return E_CLINT_RCP;
}
msqr_l (seed_l, rstate->XBBS, rstate->MODBBS);
Set the flag: PRNG is initialized.
rstate->RadBBSInit = 1;
return E_CLINT_OK;
}
Random numbers of type
UCHAR
are generated by the function
bRandBBS_l()
,
the analogue of the function
ucrand64_l()
:
generation of a random number of type
UCHAR
Function:
UCHAR bRandBBS_l (STATEBBS *rstate);
Syntax:
rstate
(pointer to initialized state memory)
Input:
Ouput:
rstate
(pointer to updated state memory)
random number of type
UCHAR
Return: