2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* This header declares the necessary definitions for using the
|
|
|
|
* exponentiation acceleration capabilities, and rnd number generation of the
|
|
|
|
* AEP card.
|
2002-10-11 17:10:59 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Some AEP defines
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Successful return value
|
|
|
|
*/
|
2002-10-11 17:10:59 +00:00
|
|
|
#define AEP_R_OK 0x00000000
|
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Miscelleanous unsuccessful return value
|
|
|
|
*/
|
2002-10-11 17:10:59 +00:00
|
|
|
#define AEP_R_GENERAL_ERROR 0x10000001
|
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Insufficient host memory
|
|
|
|
*/
|
2002-10-11 17:10:59 +00:00
|
|
|
#define AEP_R_HOST_MEMORY 0x10000002
|
|
|
|
|
|
|
|
#define AEP_R_FUNCTION_FAILED 0x10000006
|
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Invalid arguments in function call
|
|
|
|
*/
|
2002-10-11 17:10:59 +00:00
|
|
|
#define AEP_R_ARGUMENTS_BAD 0x10020000
|
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
#define AEP_R_NO_TARGET_RESOURCES 0x10030000
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Error occuring on socket operation
|
|
|
|
*/
|
|
|
|
#define AEP_R_SOCKERROR 0x10000010
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Socket has been closed from the other end
|
|
|
|
*/
|
|
|
|
#define AEP_R_SOCKEOF 0x10000011
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Invalid handles
|
|
|
|
*/
|
2002-10-11 17:10:59 +00:00
|
|
|
#define AEP_R_CONNECTION_HANDLE_INVALID 0x100000B3
|
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
#define AEP_R_TRANSACTION_HANDLE_INVALID 0x10040000
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Transaction has not yet returned from accelerator
|
|
|
|
*/
|
|
|
|
#define AEP_R_TRANSACTION_NOT_READY 0x00010000
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* There is already a thread waiting on this transaction
|
|
|
|
*/
|
|
|
|
#define AEP_R_TRANSACTION_CLAIMED 0x10050000
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* The transaction timed out
|
|
|
|
*/
|
|
|
|
#define AEP_R_TIMED_OUT 0x10060000
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
#define AEP_R_FXN_NOT_IMPLEMENTED 0x10070000
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
#define AEP_R_TARGET_ERROR 0x10080000
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Error in the AEP daemon process
|
|
|
|
*/
|
|
|
|
#define AEP_R_DAEMON_ERROR 0x10090000
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Invalid ctx id
|
|
|
|
*/
|
|
|
|
#define AEP_R_INVALID_CTX_ID 0x10009000
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
#define AEP_R_NO_KEY_MANAGER 0x1000a000
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Error obtaining a mutex
|
|
|
|
*/
|
2002-10-11 17:10:59 +00:00
|
|
|
#define AEP_R_MUTEX_BAD 0x000001A0
|
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Fxn call before AEP_Initialise ot after AEP_Finialise
|
|
|
|
*/
|
|
|
|
#define AEP_R_AEPAPI_NOT_INITIALIZED 0x10000190
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* AEP_Initialise has already been called
|
|
|
|
*/
|
|
|
|
#define AEP_R_AEPAPI_ALREADY_INITIALIZED 0x10000191
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Maximum number of connections to daemon reached
|
|
|
|
*/
|
|
|
|
#define AEP_R_NO_MORE_CONNECTION_HNDLS 0x10000200
|
2002-10-11 17:10:59 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Some AEP Type definitions
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* an unsigned 8-bit value */
|
2015-01-22 03:40:55 +00:00
|
|
|
typedef unsigned char AEP_U8;
|
2002-10-11 17:10:59 +00:00
|
|
|
|
|
|
|
/* an unsigned 8-bit character */
|
2015-01-22 03:40:55 +00:00
|
|
|
typedef char AEP_CHAR;
|
2002-10-11 17:10:59 +00:00
|
|
|
|
|
|
|
/* a BYTE-sized Boolean flag */
|
2015-01-22 03:40:55 +00:00
|
|
|
typedef AEP_U8 AEP_BBOOL;
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Unsigned value, at least 16 bits long
|
|
|
|
*/
|
|
|
|
typedef unsigned short AEP_U16;
|
2002-10-11 17:10:59 +00:00
|
|
|
|
|
|
|
/* an unsigned value, at least 32 bits long */
|
|
|
|
#ifdef SIXTY_FOUR_BIT_LONG
|
2015-01-22 03:40:55 +00:00
|
|
|
typedef unsigned int AEP_U32;
|
2002-10-11 17:10:59 +00:00
|
|
|
#else
|
2015-01-22 03:40:55 +00:00
|
|
|
typedef unsigned long AEP_U32;
|
2002-10-11 17:10:59 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef SIXTY_FOUR_BIT_LONG
|
2015-01-22 03:40:55 +00:00
|
|
|
typedef unsigned long AEP_U64;
|
2002-10-11 17:10:59 +00:00
|
|
|
#else
|
2015-01-22 03:40:55 +00:00
|
|
|
typedef struct {
|
|
|
|
unsigned long l1, l2;
|
|
|
|
} AEP_U64;
|
2002-10-11 17:10:59 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* at least 32 bits; each bit is a Boolean flag */
|
2015-01-22 03:40:55 +00:00
|
|
|
typedef AEP_U32 AEP_FLAGS;
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
typedef AEP_U8 *AEP_U8_PTR;
|
|
|
|
typedef AEP_CHAR *AEP_CHAR_PTR;
|
|
|
|
typedef AEP_U32 *AEP_U32_PTR;
|
|
|
|
typedef AEP_U64 *AEP_U64_PTR;
|
|
|
|
typedef void *AEP_VOID_PTR;
|
2002-10-11 17:10:59 +00:00
|
|
|
|
|
|
|
/* Pointer to a AEP_VOID_PTR-- i.e., pointer to pointer to void */
|
2015-01-22 03:40:55 +00:00
|
|
|
typedef AEP_VOID_PTR *AEP_VOID_PTR_PTR;
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Used to identify an AEP connection handle
|
|
|
|
*/
|
|
|
|
typedef AEP_U32 AEP_CONNECTION_HNDL;
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Pointer to an AEP connection handle
|
|
|
|
*/
|
|
|
|
typedef AEP_CONNECTION_HNDL *AEP_CONNECTION_HNDL_PTR;
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Used by an application (in conjunction with the apps process id) to
|
|
|
|
* identify an individual transaction
|
|
|
|
*/
|
|
|
|
typedef AEP_U32 AEP_TRANSACTION_ID;
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Pointer to an applications transaction identifier
|
|
|
|
*/
|
|
|
|
typedef AEP_TRANSACTION_ID *AEP_TRANSACTION_ID_PTR;
|
2002-10-11 17:10:59 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Return value type
|
|
|
|
*/
|
|
|
|
typedef AEP_U32 AEP_RV;
|
2002-10-11 17:10:59 +00:00
|
|
|
|
|
|
|
#define MAX_PROCESS_CONNECTIONS 256
|
|
|
|
|
|
|
|
#define RAND_BLK_SIZE 1024
|
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
typedef enum {
|
|
|
|
NotConnected = 0,
|
|
|
|
Connected = 1,
|
|
|
|
InUse = 2
|
2002-10-11 17:10:59 +00:00
|
|
|
} AEP_CONNECTION_STATE;
|
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
typedef struct AEP_CONNECTION_ENTRY {
|
|
|
|
AEP_CONNECTION_STATE conn_state;
|
|
|
|
AEP_CONNECTION_HNDL conn_hndl;
|
2002-10-11 17:10:59 +00:00
|
|
|
} AEP_CONNECTION_ENTRY;
|
|
|
|
|
|
|
|
typedef AEP_RV t_AEP_OpenConnection(AEP_CONNECTION_HNDL_PTR phConnection);
|
|
|
|
typedef AEP_RV t_AEP_CloseConnection(AEP_CONNECTION_HNDL hConnection);
|
|
|
|
|
|
|
|
typedef AEP_RV t_AEP_ModExp(AEP_CONNECTION_HNDL hConnection,
|
2015-01-22 03:40:55 +00:00
|
|
|
AEP_VOID_PTR pA, AEP_VOID_PTR pP,
|
|
|
|
AEP_VOID_PTR pN,
|
|
|
|
AEP_VOID_PTR pResult,
|
|
|
|
AEP_TRANSACTION_ID *pidTransID);
|
2002-10-11 17:10:59 +00:00
|
|
|
|
|
|
|
typedef AEP_RV t_AEP_ModExpCrt(AEP_CONNECTION_HNDL hConnection,
|
2015-01-22 03:40:55 +00:00
|
|
|
AEP_VOID_PTR pA, AEP_VOID_PTR pP,
|
|
|
|
AEP_VOID_PTR pQ,
|
|
|
|
AEP_VOID_PTR pDmp1, AEP_VOID_PTR pDmq1,
|
|
|
|
AEP_VOID_PTR pIqmp,
|
|
|
|
AEP_VOID_PTR pResult,
|
|
|
|
AEP_TRANSACTION_ID *pidTransID);
|
2002-10-11 17:10:59 +00:00
|
|
|
|
|
|
|
#ifdef AEPRAND
|
|
|
|
typedef AEP_RV t_AEP_GenRandom(AEP_CONNECTION_HNDL hConnection,
|
2015-01-22 03:40:55 +00:00
|
|
|
AEP_U32 Len,
|
|
|
|
AEP_U32 Type,
|
|
|
|
AEP_VOID_PTR pResult,
|
|
|
|
AEP_TRANSACTION_ID *pidTransID);
|
2002-10-11 17:10:59 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef AEP_RV t_AEP_Initialize(AEP_VOID_PTR pInitArgs);
|
2005-03-31 09:26:39 +00:00
|
|
|
typedef AEP_RV t_AEP_Finalize(void);
|
2015-01-22 03:40:55 +00:00
|
|
|
typedef AEP_RV t_AEP_SetBNCallBacks(AEP_RV (*GetBigNumSizeFunc)
|
|
|
|
(AEP_VOID_PTR ArbBigNum,
|
|
|
|
AEP_U32 *BigNumSize),
|
|
|
|
AEP_RV (*MakeAEPBigNumFunc) (AEP_VOID_PTR
|
|
|
|
ArbBigNum,
|
|
|
|
AEP_U32
|
|
|
|
BigNumSize,
|
|
|
|
unsigned char
|
|
|
|
*AEP_BigNum),
|
|
|
|
AEP_RV (*ConverAEPBigNumFunc) (void
|
|
|
|
*ArbBigNum,
|
|
|
|
AEP_U32
|
|
|
|
BigNumSize,
|
|
|
|
unsigned
|
|
|
|
char
|
|
|
|
*AEP_BigNum));
|