Generating Random Numbers
if ((status = B_RandomInit
(randomAlgorithm, CHOOSER, (A_SURRENDER_CTX *)NULL_PTR)) != 0) break;
Step 4: Update the Random Object
Step 4 is not needed for random number seeding in hardware.
Step 5: Generate Random Bytes
Generate the random bytes for the seed. In this example, you will have the
int seedBytes = 128;
if ((status = B_GenerateRandomBytes (randomAlgorithm, seedBytes, seedMaxLength, (A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;
Note: If the Intel RNG is not present, or it returns an error, B_GenerateRandomBytes will return a
Step 6: Destroy All Objects
Step 6a:Destroy the Algorithm Object
Destroy the algorithm object. This step will free any allocated memory used by randomAlgorithm. The memory is overwritten with zeros before it is deallocated, so that any potentially sensitive information is not left in memory.
B_DestroyAlgorithmObject (&randomAlgorithm);
1 8 | 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 |