PrimeGen
PrimeGen
Generates a random probable prime number of the specified bitlength.
Syntax
IppStatus ippsPrimeGen(int
nBits
, int
nTrials
, IppsPrimeState*
pCtx
, IppBitSupplier rndFunc, void*
pRndParam
);
Include Files
ippcp.h
Parameters
- nBits
- Target bitlength for the desired probable prime number.
- nTrials
- Security parameter specified for the Miller-Rabin probable primality.
- pCtx
- Pointer to theIppsPrimeStatecontext.
- rndFunc
- Specified Random Generator.
- pRndParam
- Pointer to the Random Generator context.
Description
The function employs the
rndFuncRandom
Generator specified by the user to generate a random probable prime number of the specified nBits
length. The generated probable prime number is further validated by the Miller-Rabin primality test scheme with the specified security parameter nTrials
.Return Values
- ippStsNoErr
- Indicates no error. Any other value indicates an error or warning.
- ippStsNullPtrErr
- Indicates an error condition if any of the specified pointers isNULL.
- ippStsLengthErr
- Indicates an error condition ifnBitsis less than 1.
- ippStsContextMatchErr
- Indicates an error condition if the context parameter does not match the operation.
- ippStsBadArgErr
- Indicates an error condition ifnTrialsis less than 1.
- ippStsOutOfRangeErr
- ippStsInsufficientEntropy
- Indicates a warning condition if prime generation fails due to poor choice of entropy.