RSA Security 4.3 Create an Algorithm Object, Set the Algorithm Object, Generating Random Numbers

Models: 4.3

1 38
Download 38 pages 55.71 Kb
Page 24
Image 24
if ((status = B_SetAlgorithmInfo

Generating Random Numbers

software. After the seed has been passed to the software algorithm info type, this is similar to any Crypto-C PRNG implementation. The only difference is the fast, truly random, seed operation. For this example, you will use Crypto-C’s SHA1 PRNG to generate random numbers.

Note: This example will work whether the seed was gathered from the Intel RNG or via another, backup method.

The example in this section is almost identical to the example in the Crypto-C User’s Manual, “Generating Random Numbers.” Steps 1, 2, 3, and 6 are identical; the only difference is in the seeding of the PRNG in Step 4 and the random number generation in Step 5.

Note: For this software call, you do not need to create a special session chooser. A standard Crypto-C software chooser is sufficient.

Step 1: Create an Algorithm Object

As before, you need to start by creating an algorithm object. This is identical to the software implementation

if ((status = B_CreateAlgorithmObject (&randomAlgorithm)) != 0) break;

Step 2: Set the Algorithm Object

To set the random algorithm object to use Crypto-C’s SHA1 random number generator, you need to supply the appropriate algorithm info type. For SHA1, this is AI_X962Random_V0. Again, this is identical to a software implementation.

Note: This algorithm info type is named after the standard where the pseudo- random number generator is defined. Because SHA1 is considered one of the most secure implementations for creating pseudo-random numbers, there are a number of SHA1 random number generators in the literature. All of them use SHA1, but may differ in certain implementation details. Therefore, the AI is named after the standard for clarity and precision.

if ((status = B_SetAlgorithmInfo

(randomAlgorithm, AI_X962Random_V0, NULL_PTR)) != 0) break;

2 0

R S A B S A F E C r y p t o - C I n t e l H a r d w a r e U s e r ’s G u i d e

Page 24
Image 24
RSA Security 4.3 manual Create an Algorithm Object, Set the Algorithm Object, Generating Random Numbers