Generates key components for the desired RSA cryptographic system.
IppStatus ippsRSAGenerate(IppsBigNumState* pE, int nBitsN, int nBitsP, int nTrials, IppsRSAState* pCtx, IppBitSupplier rndFunc, void* pRndParam);
pE |
Pointer to the IppsBigNumState context of the newly generated RSA public exponent key. |
nBitsN |
Length of the RSA system in bits (that is, the length of the composite RSA modulus n in bits). |
nBitsP |
Length in bits of one of the two prime factors of the RSA modulus. |
nTrials |
Security parameter specified for the Miller-Rabin probable primality. |
pCtx |
Pointer to the IppsRSAState context. |
rndFunc |
Pseudorandom number generator. |
pRndParam |
Pointer to the context of the pseudorandom number generator. |
The function is declared in the ippcp.h file. This function generates the desired RSA cryptographic system based on the following data:
This function sequentially performs the following computations:
Generates random probable prime numbers p and q using the specified pseudorandom number generator rndFunc.
Computes all other CRT-related RSA components.
To generate RSA keys using the RSAGenerate function, call it in the following sequence of steps:
Establish the pseudorandom number generator.
Define the size of the RSA cryptosystem, that is, lengths nBitsN and nBitsP of n and p (in bits), respectively.
Define the RSA cryptosystem using the IppRSAprivate flag. To do this, use the following function calls:
ippsRSAGetSize(nBitsN, nBitsP, IppRSAprivate, &rsaCtxSize);
ippsRSAInit(nBitsN, nBitsP, IppRSAprivate, pCtx);
where pCtx is the memory allocated for the RSA context.
Define the initial value of the public key E and make the call
ippsRSAGenerate(pE, nBitsN, nBitsP, nTrials, pCtx, rndFunc, pRndParam);
If ippsRSAGenerate returns IppNoErr, keys are generated.
If ippsRSAGenerate returns ippStsInsufficientEntropy, repeat this step from the beginning.
ippsRSAGenerate may change the initial value of the public key E.
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. |
ippStsNotSupportedModeErr |
Indicates an error condition if RSA context was initialized with the IppRSApublic flag. |
ippStsBadArgErr |
Indicates an error condition in cases not explicitly mentioned above. |
ippStsInsufficientEntropy |
Indicates a warning condition if prime generation fails due to poor choice of entropy. |
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.