1296465Sdelphij/*
2296465Sdelphij * This header declares the necessary definitions for using the
3296465Sdelphij * exponentiation acceleration capabilities of Atalla cards. The only
4296465Sdelphij * cryptographic operation is performed by "ASI_RSAPrivateKeyOpFn" and this
5296465Sdelphij * takes a structure that defines an "RSA private key". However, it is really
6296465Sdelphij * only performing a regular mod_exp using the supplied modulus and exponent
7296465Sdelphij * - no CRT form is being used. Hence, it is a generic mod_exp function in
8296465Sdelphij * disguise, and we use it as such. Thanks to the people at Atalla for
9296465Sdelphij * letting me know these definitions are fine and that they can be reproduced
10296465Sdelphij * here. Geoff.
11160814Ssimon */
12160814Ssimon
13296465Sdelphijtypedef struct ItemStr {
14296465Sdelphij    unsigned char *data;
15296465Sdelphij    int len;
16296465Sdelphij} Item;
17160814Ssimon
18296465Sdelphijtypedef struct RSAPrivateKeyStr {
19296465Sdelphij    void *reserved;
20296465Sdelphij    Item version;
21296465Sdelphij    Item modulus;
22296465Sdelphij    Item publicExponent;
23296465Sdelphij    Item privateExponent;
24296465Sdelphij    Item prime[2];
25296465Sdelphij    Item exponent[2];
26296465Sdelphij    Item coefficient;
27296465Sdelphij} RSAPrivateKey;
28160814Ssimon
29296465Sdelphij/*
30296465Sdelphij * Predeclare the function pointer types that we dynamically load from the
31296465Sdelphij * DSO. These use the same names and form that Ben's original support code
32296465Sdelphij * had (in crypto/bn/bn_exp.c) unless of course I've inadvertently changed
33296465Sdelphij * the style somewhere along the way!
34160814Ssimon */
35160814Ssimon
36160814Ssimontypedef int tfnASI_GetPerformanceStatistics(int reset_flag,
37296465Sdelphij                                            unsigned int *ret_buf);
38160814Ssimon
39160814Ssimontypedef int tfnASI_GetHardwareConfig(long card_num, unsigned int *ret_buf);
40160814Ssimon
41160814Ssimontypedef int tfnASI_RSAPrivateKeyOpFn(RSAPrivateKey * rsaKey,
42296465Sdelphij                                     unsigned char *output,
43296465Sdelphij                                     unsigned char *input,
44296465Sdelphij                                     unsigned int modulus_len);
45