Generating Random Numbers
Step 6b: Free the Session Chooser
Free the session chooser. It is important to free the session chooser, so that any handles to hardware and allocated memory are released.
if ((status = B_FreeSessionChooser (&CHOOSER, &oemTagList)) != 0) break;
Retrieving Hardware Error Codes
If the hardware fails or cannot return a seed,
BE_HARDWARE or BE_NOT_SUPPORTED. BE_HARDWARE indicates that the Intel Random Number Generator has returned an error. This error can be retrieved using B_GetExtendedErrorInfo, as shown below:
ITEM errorData;
POINTER am;
/* Call B_GetExtendedErrorInfo to retrieve the error information. The data returned in the data field of errorData is a structure of A_RSA_EXTENDED_ERROR type. The third parameter
will return a pointer to the algorithm method that was in use when the error was encountered. */
B_GetExtendedErrorInfo(randomAlgorithm, &errorData, &am);
/* Print out the error information. */ if (am == &HW_INTEL_RANDOM) {
printf ("[Seed] Code: %d\n",
((A_RSA_EXTENDED_ERROR
((A_RSA_EXTENDED_ERROR
}
For information about the Intel error codes returned by B_GetExtendedErrorInfo, consult Appendix B. An error of BE_NOT_SUPPORTED may mean that there is a problem accessing the BHAPI driver. See Appendix A for more information.
Generating Random Numbers in Software
Once you have a random seed, you can generate
C h a p t e r 3 U s i n g t h e I n t e l R a n d o m N u m b e r G e n e r a t o r | 1 9 |