PrimeTest_BN

Tests the given big number for being a probable prime.

Syntax

IppStatus ippsPrimeTest_BN(const IppsBigNumState* pPrime, int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam);

Include Files

ippcp.h

Parameters

pPrime

The big number to test.

nTrials

Security parameter specified for the Miller-Rabin probable primality.

pResult

Pointer to the result of the primality test.

pCtx

Pointer to the IppsPrimeState context.

rndFunc

Specified Random Generator.

pRndParam

Pointer to the Random Generator context.

Description

The function uses the Miller-Rabin probabilistic primality test scheme with the given security parameter to test whether the given big number is a probable prime. The pseudorandom number used in the Miller-Rabin test is generated by the specified rndFunc Random Generator. The function sets up the *pResult as IS_PRIME or IS_COMPOSITE to show whether the input probable prime passes the Miller-Rabin test.

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 is NULL.

ippStsContextMatchErr

Indicates an error condition if the context parameter does not match the operation.

ippStsBadArgErr

Indicates an error condition if nTrials is less than 1.