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