1296341Sdelphij/*
2296341Sdelphij * This header declares the necessary definitions for using the
3296341Sdelphij * exponentiation acceleration capabilities of Atalla cards. The only
4296341Sdelphij * cryptographic operation is performed by "ASI_RSAPrivateKeyOpFn" and this
5296341Sdelphij * takes a structure that defines an "RSA private key". However, it is really
6296341Sdelphij * only performing a regular mod_exp using the supplied modulus and exponent
7296341Sdelphij * - no CRT form is being used. Hence, it is a generic mod_exp function in
8296341Sdelphij * disguise, and we use it as such. Thanks to the people at Atalla for
9296341Sdelphij * letting me know these definitions are fine and that they can be reproduced
10296341Sdelphij * here. Geoff.
11160814Ssimon */
12160814Ssimon
13296341Sdelphijtypedef struct ItemStr {
14296341Sdelphij    unsigned char *data;
15296341Sdelphij    int len;
16296341Sdelphij} Item;
17160814Ssimon
18296341Sdelphijtypedef struct RSAPrivateKeyStr {
19296341Sdelphij    void *reserved;
20296341Sdelphij    Item version;
21296341Sdelphij    Item modulus;
22296341Sdelphij    Item publicExponent;
23296341Sdelphij    Item privateExponent;
24296341Sdelphij    Item prime[2];
25296341Sdelphij    Item exponent[2];
26296341Sdelphij    Item coefficient;
27296341Sdelphij} RSAPrivateKey;
28160814Ssimon
29296341Sdelphij/*
30296341Sdelphij * Predeclare the function pointer types that we dynamically load from the
31296341Sdelphij * DSO. These use the same names and form that Ben's original support code
32296341Sdelphij * had (in crypto/bn/bn_exp.c) unless of course I've inadvertently changed
33296341Sdelphij * the style somewhere along the way!
34160814Ssimon */
35160814Ssimon
36160814Ssimontypedef int tfnASI_GetPerformanceStatistics(int reset_flag,
37296341Sdelphij                                            unsigned int *ret_buf);
38160814Ssimon
39160814Ssimontypedef int tfnASI_GetHardwareConfig(long card_num, unsigned int *ret_buf);
40160814Ssimon
41160814Ssimontypedef int tfnASI_RSAPrivateKeyOpFn(RSAPrivateKey * rsaKey,
42296341Sdelphij                                     unsigned char *output,
43296341Sdelphij                                     unsigned char *input,
44296341Sdelphij                                     unsigned int modulus_len);
45