Developer Reference

Contents

RSA_GenerateKeys

Generates key components for the desired RSA cryptographic system.

Syntax

IppStatus ippsRSA_GenerateKeys(const IppsBigNumState*
pSrcPublicExp
, IppsBigNumState*
pModulus
, IppsBigNumState*
pPublicExp
, IppsBigNumState*
pPrivateExp
, IppsRSAPrivateKeyState*
pPrivateKeyType2
, Ipp8u*
pScratchBuffer
, int
nTrials
, IppsPrimeState*
pPrimeGen
, IppBitSupplier
rndFunc
, void*
pRndParam
);
Include Files
ippcp.h
Parameters
pSrcPublicExp
Pointer to the
IppsBigNumState
context of the initial value for searching an RSA public exponent.
pModulus
Pointer to the generated RSA modulus.
pPublicExp
Pointer to the generated RSA public exponent.
pPrivateExp
Pointer to the generated RSA private exponent.
pPrivateKeyType2
Pointer to the generated RSA private key type 2.
pScratchBuffer
Pointer to the temporary buffer of size not less than returned by the
RSA_GetBufferSizePrivateKey
function.
nTrials
Security parameter specified for the Miller-Rabin test for probable primality.
pPrimeGen
Pointer to the prime number generator.
rndFunc
Pseudorandom number generator.
pRndParam
Pointer to the context of the pseudorandom number generator.
Description
This function generates public and private keys of the desired RSA cryptographic system.
This function sequentially performs the following computations:
  1. Generates random probable prime numbers
    p
    and
    q
    using the specified pseudorandom number generator
    rndFunc
    .
  2. Computes the RSA composite modulus
    n = (p*q)
    .
  3. Based on the generated
    p
    and
    q
    factors, computes all the other CRT-related RSA components:
    dP
    =
    d
    mod (
    p
    -1),
    dQ
    =
    p
    mod (
    q
    -1) and
    qInv
    = 1/
    q
    mod
    p
    .
To generate RSA keys using the
RSA_GenerateKeys
function, call it in the following sequence of steps:
  1. Establish the pseudorandom number generator and prime number generator.
  2. Define the RSA private key type 2 in successive calls to the
    RSA_GetSizePrivateKeyType2
    and
    RSA_InitPrivateKeyType2
    functions with desired values of
    factorPBitSize
    and
    factorQBitSize
    parameters.
  3. Allocate a temporary buffer of a suitable size.
  4. Set up the initial value of the public exponent
    pSrcPublicExp
    .
  5. Call
    RSA_GenerateKeys
    .
    If
    RSA_GenerateKeys
    returns
    IppNoErr
    , the key pair is generated.
    If
    RSA_GenerateKeys
    returns
    ippStsInsufficientEntropy
    , repeat step 5.
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.
ippStsSizeErr
Indicates an error condition if the bit length of any key component specified by
pModulus
,
pPublicExp
or
pPrivateExp
is not sufficient to hold the value or the prime number generator, specified by
pPrimeGen
, is not sufficient to generate suitable values.
ippStsOutOfRangeErr
Indicates an error condition if the initial value for searching the public exponent, specified by
pSrcPublicExp
, is not positive.
ippStsBadArgErr
Indicates an error condition in cases not explicitly mentioned above.
ippStsInsufficientEntropy
Indicates a warning condition if the prime number generation fails due to a poor choice of entropy.

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804