RSA Security 4.3 Home Security System User Manual


 
Chapter 2 Using Intel Hardware With Crypto-C 7
The Session Chooser
The Session Chooser
Any Crypto-C application which uses hardware requires your application to declare
two choosers:
The baseline software chooser, such as the one that is used in any Crypto-C
application. This chooser must be modified to include the generic Crypto-C
hardware methods that support the desired hardware.
The hardware chooser, that lists the manufacturer-specific hardware methods that
can be used. This chooser has no analogue in a software-only application.
Once these choosers have been declared, you can combine them via a call to
B_CreateSessionChooser. This creates the session chooser, which matches the
hardware-compatible AMs in the software chooser with their actual instantiations in
the hardware chooser. Specifically, for each item in the software chooser that
references a hardware method, the hardware method replaces it.
Creating the Session Chooser
The following example shows how a simple session chooser can be created. This
chooser is set up to access Intel’s random number generator, which can then be used
via the Crypto-C AI,
AI_HW_Random.
Creating the Software Chooser
The software chooser is a conventional chooser, containing pointers to Crypto-C
algorithm methods. In this case, since we are going to generate random numbers
using the Intel hardware random number generator, we must include
AM_HW_RANDOM.
This algorithm method instructs Crypto-C to use a hardware method for generating
random data. In an actual application, you would also list all the software methods,
such as methods for encryption and decryption, that are required by your application.
For random number generation, the software chooser can be set up as follows:
B_ALGORITHM_METHOD *SOFTWARE_CHOOSER[] = {
&AM_HW_RANDOM,
(B_ALGORITHM_METHOD *)NULL_PTR
};