1280304Sjkim/*
2280304Sjkim * This header declares the necessary definitions for using the
3280304Sjkim * exponentiation acceleration capabilities of Atalla cards. The only
4280304Sjkim * cryptographic operation is performed by "ASI_RSAPrivateKeyOpFn" and this
5280304Sjkim * takes a structure that defines an "RSA private key". However, it is really
6280304Sjkim * only performing a regular mod_exp using the supplied modulus and exponent
7280304Sjkim * - no CRT form is being used. Hence, it is a generic mod_exp function in
8280304Sjkim * disguise, and we use it as such. Thanks to the people at Atalla for
9280304Sjkim * letting me know these definitions are fine and that they can be reproduced
10280304Sjkim * here. Geoff.
11160814Ssimon */
12160814Ssimon
13280304Sjkimtypedef struct ItemStr {
14280304Sjkim    unsigned char *data;
15280304Sjkim    int len;
16280304Sjkim} Item;
17160814Ssimon
18280304Sjkimtypedef struct RSAPrivateKeyStr {
19280304Sjkim    void *reserved;
20280304Sjkim    Item version;
21280304Sjkim    Item modulus;
22280304Sjkim    Item publicExponent;
23280304Sjkim    Item privateExponent;
24280304Sjkim    Item prime[2];
25280304Sjkim    Item exponent[2];
26280304Sjkim    Item coefficient;
27280304Sjkim} RSAPrivateKey;
28160814Ssimon
29280304Sjkim/*
30280304Sjkim * Predeclare the function pointer types that we dynamically load from the
31280304Sjkim * DSO. These use the same names and form that Ben's original support code
32280304Sjkim * had (in crypto/bn/bn_exp.c) unless of course I've inadvertently changed
33280304Sjkim * the style somewhere along the way!
34160814Ssimon */
35160814Ssimon
36160814Ssimontypedef int tfnASI_GetPerformanceStatistics(int reset_flag,
37280304Sjkim                                            unsigned int *ret_buf);
38160814Ssimon
39160814Ssimontypedef int tfnASI_GetHardwareConfig(long card_num, unsigned int *ret_buf);
40160814Ssimon
41160814Ssimontypedef int tfnASI_RSAPrivateKeyOpFn(RSAPrivateKey * rsaKey,
42280304Sjkim                                     unsigned char *output,
43280304Sjkim                                     unsigned char *input,
44280304Sjkim                                     unsigned int modulus_len);
45