1 /* This header declares the necessary definitions for using the exponentiation
2 * acceleration capabilities, and rnd number generation of the AEP card.
12 /*Successful return value*/
13 #define AEP_R_OK 0x00000000
15 /*Miscelleanous unsuccessful return value*/
16 #define AEP_R_GENERAL_ERROR 0x10000001
18 /*Insufficient host memory*/
19 #define AEP_R_HOST_MEMORY 0x10000002
21 #define AEP_R_FUNCTION_FAILED 0x10000006
23 /*Invalid arguments in function call*/
24 #define AEP_R_ARGUMENTS_BAD 0x10020000
26 #define AEP_R_NO_TARGET_RESOURCES 0x10030000
28 /*Error occuring on socket operation*/
29 #define AEP_R_SOCKERROR 0x10000010
31 /*Socket has been closed from the other end*/
32 #define AEP_R_SOCKEOF 0x10000011
35 #define AEP_R_CONNECTION_HANDLE_INVALID 0x100000B3
37 #define AEP_R_TRANSACTION_HANDLE_INVALID 0x10040000
39 /*Transaction has not yet returned from accelerator*/
40 #define AEP_R_TRANSACTION_NOT_READY 0x00010000
42 /*There is already a thread waiting on this transaction*/
43 #define AEP_R_TRANSACTION_CLAIMED 0x10050000
45 /*The transaction timed out*/
46 #define AEP_R_TIMED_OUT 0x10060000
48 #define AEP_R_FXN_NOT_IMPLEMENTED 0x10070000
50 #define AEP_R_TARGET_ERROR 0x10080000
52 /*Error in the AEP daemon process*/
53 #define AEP_R_DAEMON_ERROR 0x10090000
56 #define AEP_R_INVALID_CTX_ID 0x10009000
58 #define AEP_R_NO_KEY_MANAGER 0x1000a000
60 /*Error obtaining a mutex*/
61 #define AEP_R_MUTEX_BAD 0x000001A0
63 /*Fxn call before AEP_Initialise ot after AEP_Finialise*/
64 #define AEP_R_AEPAPI_NOT_INITIALIZED 0x10000190
66 /*AEP_Initialise has already been called*/
67 #define AEP_R_AEPAPI_ALREADY_INITIALIZED 0x10000191
69 /*Maximum number of connections to daemon reached*/
70 #define AEP_R_NO_MORE_CONNECTION_HNDLS 0x10000200
74 * Some AEP Type definitions
78 /* an unsigned 8-bit value */
79 typedef unsigned char AEP_U8
;
81 /* an unsigned 8-bit character */
82 typedef char AEP_CHAR
;
84 /* a BYTE-sized Boolean flag */
85 typedef AEP_U8 AEP_BBOOL
;
87 /*Unsigned value, at least 16 bits long*/
88 typedef unsigned short AEP_U16
;
90 /* an unsigned value, at least 32 bits long */
91 #ifdef SIXTY_FOUR_BIT_LONG
92 typedef unsigned int AEP_U32
;
94 typedef unsigned long AEP_U32
;
97 #ifdef SIXTY_FOUR_BIT_LONG
98 typedef unsigned long AEP_U64
;
100 typedef struct { unsigned long l1
, l2
; } AEP_U64
;
103 /* at least 32 bits; each bit is a Boolean flag */
104 typedef AEP_U32 AEP_FLAGS
;
106 typedef AEP_U8
*AEP_U8_PTR
;
107 typedef AEP_CHAR
*AEP_CHAR_PTR
;
108 typedef AEP_U32
*AEP_U32_PTR
;
109 typedef AEP_U64
*AEP_U64_PTR
;
110 typedef void *AEP_VOID_PTR
;
112 /* Pointer to a AEP_VOID_PTR-- i.e., pointer to pointer to void */
113 typedef AEP_VOID_PTR
*AEP_VOID_PTR_PTR
;
115 /*Used to identify an AEP connection handle*/
116 typedef AEP_U32 AEP_CONNECTION_HNDL
;
118 /*Pointer to an AEP connection handle*/
119 typedef AEP_CONNECTION_HNDL
*AEP_CONNECTION_HNDL_PTR
;
121 /*Used by an application (in conjunction with the apps process id) to
122 identify an individual transaction*/
123 typedef AEP_U32 AEP_TRANSACTION_ID
;
125 /*Pointer to an applications transaction identifier*/
126 typedef AEP_TRANSACTION_ID
*AEP_TRANSACTION_ID_PTR
;
128 /*Return value type*/
129 typedef AEP_U32 AEP_RV
;
131 #define MAX_PROCESS_CONNECTIONS 256
133 #define RAND_BLK_SIZE 1024
139 } AEP_CONNECTION_STATE
;
142 typedef struct AEP_CONNECTION_ENTRY
{
143 AEP_CONNECTION_STATE conn_state
;
144 AEP_CONNECTION_HNDL conn_hndl
;
145 } AEP_CONNECTION_ENTRY
;
148 typedef AEP_RV
t_AEP_OpenConnection(AEP_CONNECTION_HNDL_PTR phConnection
);
149 typedef AEP_RV
t_AEP_CloseConnection(AEP_CONNECTION_HNDL hConnection
);
151 typedef AEP_RV
t_AEP_ModExp(AEP_CONNECTION_HNDL hConnection
,
152 AEP_VOID_PTR pA
, AEP_VOID_PTR pP
,
154 AEP_VOID_PTR pResult
,
155 AEP_TRANSACTION_ID
* pidTransID
);
157 typedef AEP_RV
t_AEP_ModExpCrt(AEP_CONNECTION_HNDL hConnection
,
158 AEP_VOID_PTR pA
, AEP_VOID_PTR pP
,
160 AEP_VOID_PTR pDmp1
, AEP_VOID_PTR pDmq1
,
162 AEP_VOID_PTR pResult
,
163 AEP_TRANSACTION_ID
* pidTransID
);
166 typedef AEP_RV
t_AEP_GenRandom(AEP_CONNECTION_HNDL hConnection
,
169 AEP_VOID_PTR pResult
,
170 AEP_TRANSACTION_ID
* pidTransID
);
173 typedef AEP_RV
t_AEP_Initialize(AEP_VOID_PTR pInitArgs
);
174 typedef AEP_RV
t_AEP_Finalize(void);
175 typedef AEP_RV
t_AEP_SetBNCallBacks(AEP_RV (*GetBigNumSizeFunc
)(AEP_VOID_PTR ArbBigNum
, AEP_U32
* BigNumSize
),
176 AEP_RV (*MakeAEPBigNumFunc
)(AEP_VOID_PTR ArbBigNum
, AEP_U32 BigNumSize
, unsigned char* AEP_BigNum
),
177 AEP_RV (*ConverAEPBigNumFunc
)(void* ArbBigNum
, AEP_U32 BigNumSize
, unsigned char* AEP_BigNum
));