]>
Commit | Line | Data |
---|---|---|
0f113f3e MC |
1 | /* |
2 | * This header declares the necessary definitions for using the | |
3 | * exponentiation acceleration capabilities, and rnd number generation of the | |
4 | * AEP card. | |
2eaabb71 RL |
5 | */ |
6 | ||
7 | /* | |
8 | * | |
9 | * Some AEP defines | |
10 | * | |
11 | */ | |
12 | ||
0f113f3e MC |
13 | /* |
14 | * Successful return value | |
15 | */ | |
2eaabb71 RL |
16 | #define AEP_R_OK 0x00000000 |
17 | ||
0f113f3e MC |
18 | /* |
19 | * Miscelleanous unsuccessful return value | |
20 | */ | |
2eaabb71 RL |
21 | #define AEP_R_GENERAL_ERROR 0x10000001 |
22 | ||
0f113f3e MC |
23 | /* |
24 | * Insufficient host memory | |
25 | */ | |
2eaabb71 RL |
26 | #define AEP_R_HOST_MEMORY 0x10000002 |
27 | ||
28 | #define AEP_R_FUNCTION_FAILED 0x10000006 | |
29 | ||
0f113f3e MC |
30 | /* |
31 | * Invalid arguments in function call | |
32 | */ | |
2eaabb71 RL |
33 | #define AEP_R_ARGUMENTS_BAD 0x10020000 |
34 | ||
0f113f3e | 35 | #define AEP_R_NO_TARGET_RESOURCES 0x10030000 |
2eaabb71 | 36 | |
0f113f3e MC |
37 | /* |
38 | * Error occuring on socket operation | |
39 | */ | |
40 | #define AEP_R_SOCKERROR 0x10000010 | |
2eaabb71 | 41 | |
0f113f3e MC |
42 | /* |
43 | * Socket has been closed from the other end | |
44 | */ | |
45 | #define AEP_R_SOCKEOF 0x10000011 | |
2eaabb71 | 46 | |
0f113f3e MC |
47 | /* |
48 | * Invalid handles | |
49 | */ | |
2eaabb71 RL |
50 | #define AEP_R_CONNECTION_HANDLE_INVALID 0x100000B3 |
51 | ||
0f113f3e | 52 | #define AEP_R_TRANSACTION_HANDLE_INVALID 0x10040000 |
2eaabb71 | 53 | |
0f113f3e MC |
54 | /* |
55 | * Transaction has not yet returned from accelerator | |
56 | */ | |
57 | #define AEP_R_TRANSACTION_NOT_READY 0x00010000 | |
2eaabb71 | 58 | |
0f113f3e MC |
59 | /* |
60 | * There is already a thread waiting on this transaction | |
61 | */ | |
62 | #define AEP_R_TRANSACTION_CLAIMED 0x10050000 | |
2eaabb71 | 63 | |
0f113f3e MC |
64 | /* |
65 | * The transaction timed out | |
66 | */ | |
67 | #define AEP_R_TIMED_OUT 0x10060000 | |
2eaabb71 | 68 | |
0f113f3e | 69 | #define AEP_R_FXN_NOT_IMPLEMENTED 0x10070000 |
2eaabb71 | 70 | |
0f113f3e | 71 | #define AEP_R_TARGET_ERROR 0x10080000 |
2eaabb71 | 72 | |
0f113f3e MC |
73 | /* |
74 | * Error in the AEP daemon process | |
75 | */ | |
76 | #define AEP_R_DAEMON_ERROR 0x10090000 | |
2eaabb71 | 77 | |
0f113f3e MC |
78 | /* |
79 | * Invalid ctx id | |
80 | */ | |
81 | #define AEP_R_INVALID_CTX_ID 0x10009000 | |
2eaabb71 | 82 | |
0f113f3e | 83 | #define AEP_R_NO_KEY_MANAGER 0x1000a000 |
2eaabb71 | 84 | |
0f113f3e MC |
85 | /* |
86 | * Error obtaining a mutex | |
87 | */ | |
2eaabb71 RL |
88 | #define AEP_R_MUTEX_BAD 0x000001A0 |
89 | ||
0f113f3e MC |
90 | /* |
91 | * Fxn call before AEP_Initialise ot after AEP_Finialise | |
92 | */ | |
93 | #define AEP_R_AEPAPI_NOT_INITIALIZED 0x10000190 | |
2eaabb71 | 94 | |
0f113f3e MC |
95 | /* |
96 | * AEP_Initialise has already been called | |
97 | */ | |
98 | #define AEP_R_AEPAPI_ALREADY_INITIALIZED 0x10000191 | |
2eaabb71 | 99 | |
0f113f3e MC |
100 | /* |
101 | * Maximum number of connections to daemon reached | |
102 | */ | |
103 | #define AEP_R_NO_MORE_CONNECTION_HNDLS 0x10000200 | |
2eaabb71 RL |
104 | |
105 | /* | |
106 | * | |
107 | * Some AEP Type definitions | |
108 | * | |
109 | */ | |
110 | ||
111 | /* an unsigned 8-bit value */ | |
0f113f3e | 112 | typedef unsigned char AEP_U8; |
2eaabb71 RL |
113 | |
114 | /* an unsigned 8-bit character */ | |
0f113f3e | 115 | typedef char AEP_CHAR; |
2eaabb71 RL |
116 | |
117 | /* a BYTE-sized Boolean flag */ | |
0f113f3e | 118 | typedef AEP_U8 AEP_BBOOL; |
2eaabb71 | 119 | |
0f113f3e MC |
120 | /* |
121 | * Unsigned value, at least 16 bits long | |
122 | */ | |
123 | typedef unsigned short AEP_U16; | |
2eaabb71 RL |
124 | |
125 | /* an unsigned value, at least 32 bits long */ | |
126 | #ifdef SIXTY_FOUR_BIT_LONG | |
0f113f3e | 127 | typedef unsigned int AEP_U32; |
2eaabb71 | 128 | #else |
0f113f3e | 129 | typedef unsigned long AEP_U32; |
2eaabb71 RL |
130 | #endif |
131 | ||
132 | #ifdef SIXTY_FOUR_BIT_LONG | |
0f113f3e | 133 | typedef unsigned long AEP_U64; |
2eaabb71 | 134 | #else |
0f113f3e MC |
135 | typedef struct { |
136 | unsigned long l1, l2; | |
137 | } AEP_U64; | |
2eaabb71 RL |
138 | #endif |
139 | ||
140 | /* at least 32 bits; each bit is a Boolean flag */ | |
0f113f3e | 141 | typedef AEP_U32 AEP_FLAGS; |
2eaabb71 | 142 | |
0f113f3e MC |
143 | typedef AEP_U8 *AEP_U8_PTR; |
144 | typedef AEP_CHAR *AEP_CHAR_PTR; | |
145 | typedef AEP_U32 *AEP_U32_PTR; | |
146 | typedef AEP_U64 *AEP_U64_PTR; | |
147 | typedef void *AEP_VOID_PTR; | |
2eaabb71 RL |
148 | |
149 | /* Pointer to a AEP_VOID_PTR-- i.e., pointer to pointer to void */ | |
0f113f3e | 150 | typedef AEP_VOID_PTR *AEP_VOID_PTR_PTR; |
2eaabb71 | 151 | |
0f113f3e MC |
152 | /* |
153 | * Used to identify an AEP connection handle | |
154 | */ | |
155 | typedef AEP_U32 AEP_CONNECTION_HNDL; | |
2eaabb71 | 156 | |
0f113f3e MC |
157 | /* |
158 | * Pointer to an AEP connection handle | |
159 | */ | |
160 | typedef AEP_CONNECTION_HNDL *AEP_CONNECTION_HNDL_PTR; | |
2eaabb71 | 161 | |
0f113f3e MC |
162 | /* |
163 | * Used by an application (in conjunction with the apps process id) to | |
164 | * identify an individual transaction | |
165 | */ | |
166 | typedef AEP_U32 AEP_TRANSACTION_ID; | |
2eaabb71 | 167 | |
0f113f3e MC |
168 | /* |
169 | * Pointer to an applications transaction identifier | |
170 | */ | |
171 | typedef AEP_TRANSACTION_ID *AEP_TRANSACTION_ID_PTR; | |
2eaabb71 | 172 | |
0f113f3e MC |
173 | /* |
174 | * Return value type | |
175 | */ | |
176 | typedef AEP_U32 AEP_RV; | |
2eaabb71 RL |
177 | |
178 | #define MAX_PROCESS_CONNECTIONS 256 | |
179 | ||
180 | #define RAND_BLK_SIZE 1024 | |
181 | ||
0f113f3e MC |
182 | typedef enum { |
183 | NotConnected = 0, | |
184 | Connected = 1, | |
185 | InUse = 2 | |
2eaabb71 RL |
186 | } AEP_CONNECTION_STATE; |
187 | ||
0f113f3e MC |
188 | typedef struct AEP_CONNECTION_ENTRY { |
189 | AEP_CONNECTION_STATE conn_state; | |
190 | AEP_CONNECTION_HNDL conn_hndl; | |
2eaabb71 RL |
191 | } AEP_CONNECTION_ENTRY; |
192 | ||
2eaabb71 RL |
193 | typedef AEP_RV t_AEP_OpenConnection(AEP_CONNECTION_HNDL_PTR phConnection); |
194 | typedef AEP_RV t_AEP_CloseConnection(AEP_CONNECTION_HNDL hConnection); | |
195 | ||
196 | typedef AEP_RV t_AEP_ModExp(AEP_CONNECTION_HNDL hConnection, | |
0f113f3e MC |
197 | AEP_VOID_PTR pA, AEP_VOID_PTR pP, |
198 | AEP_VOID_PTR pN, | |
199 | AEP_VOID_PTR pResult, | |
200 | AEP_TRANSACTION_ID *pidTransID); | |
2eaabb71 RL |
201 | |
202 | typedef AEP_RV t_AEP_ModExpCrt(AEP_CONNECTION_HNDL hConnection, | |
0f113f3e MC |
203 | AEP_VOID_PTR pA, AEP_VOID_PTR pP, |
204 | AEP_VOID_PTR pQ, | |
205 | AEP_VOID_PTR pDmp1, AEP_VOID_PTR pDmq1, | |
206 | AEP_VOID_PTR pIqmp, | |
207 | AEP_VOID_PTR pResult, | |
208 | AEP_TRANSACTION_ID *pidTransID); | |
2eaabb71 RL |
209 | |
210 | #ifdef AEPRAND | |
211 | typedef AEP_RV t_AEP_GenRandom(AEP_CONNECTION_HNDL hConnection, | |
0f113f3e MC |
212 | AEP_U32 Len, |
213 | AEP_U32 Type, | |
214 | AEP_VOID_PTR pResult, | |
215 | AEP_TRANSACTION_ID *pidTransID); | |
2eaabb71 RL |
216 | #endif |
217 | ||
218 | typedef AEP_RV t_AEP_Initialize(AEP_VOID_PTR pInitArgs); | |
41a15c4f | 219 | typedef AEP_RV t_AEP_Finalize(void); |
0f113f3e MC |
220 | typedef AEP_RV t_AEP_SetBNCallBacks(AEP_RV (*GetBigNumSizeFunc) |
221 | (AEP_VOID_PTR ArbBigNum, | |
222 | AEP_U32 *BigNumSize), | |
223 | AEP_RV (*MakeAEPBigNumFunc) (AEP_VOID_PTR | |
224 | ArbBigNum, | |
225 | AEP_U32 | |
226 | BigNumSize, | |
227 | unsigned char | |
228 | *AEP_BigNum), | |
229 | AEP_RV (*ConverAEPBigNumFunc) (void | |
230 | *ArbBigNum, | |
231 | AEP_U32 | |
232 | BigNumSize, | |
233 | unsigned | |
234 | char | |
235 | *AEP_BigNum)); |