aep.h
上传用户:yisoukefu
上传日期:2020-08-09
资源大小:39506k
文件大小:5k
源码类别:

其他游戏

开发平台:

Visual C++

  1. /* This header declares the necessary definitions for using the exponentiation
  2.  * acceleration capabilities, and rnd number generation of the AEP card. 
  3.  *
  4.  */
  5. /*
  6.  *
  7.  * Some AEP defines
  8.  *
  9.  */
  10. /*Successful return value*/
  11. #define AEP_R_OK                                0x00000000
  12. /*Miscelleanous unsuccessful return value*/
  13. #define AEP_R_GENERAL_ERROR                     0x10000001
  14. /*Insufficient host memory*/
  15. #define AEP_R_HOST_MEMORY                       0x10000002
  16. #define AEP_R_FUNCTION_FAILED                   0x10000006
  17. /*Invalid arguments in function call*/
  18. #define AEP_R_ARGUMENTS_BAD                     0x10020000
  19. #define AEP_R_NO_TARGET_RESOURCES 0x10030000
  20. /*Error occuring on socket operation*/
  21. #define AEP_R_SOCKERROR 0x10000010
  22. /*Socket has been closed from the other end*/
  23. #define AEP_R_SOCKEOF 0x10000011
  24. /*Invalid handles*/
  25. #define AEP_R_CONNECTION_HANDLE_INVALID         0x100000B3
  26. #define AEP_R_TRANSACTION_HANDLE_INVALID 0x10040000
  27. /*Transaction has not yet returned from accelerator*/
  28. #define AEP_R_TRANSACTION_NOT_READY 0x00010000
  29. /*There is already a thread waiting on this transaction*/
  30. #define AEP_R_TRANSACTION_CLAIMED 0x10050000
  31. /*The transaction timed out*/
  32. #define AEP_R_TIMED_OUT 0x10060000
  33. #define AEP_R_FXN_NOT_IMPLEMENTED 0x10070000
  34. #define AEP_R_TARGET_ERROR 0x10080000
  35. /*Error in the AEP daemon process*/
  36. #define AEP_R_DAEMON_ERROR 0x10090000
  37. /*Invalid ctx id*/
  38. #define AEP_R_INVALID_CTX_ID 0x10009000
  39. #define AEP_R_NO_KEY_MANAGER 0x1000a000
  40. /*Error obtaining a mutex*/
  41. #define AEP_R_MUTEX_BAD                         0x000001A0
  42. /*Fxn call before AEP_Initialise ot after AEP_Finialise*/
  43. #define AEP_R_AEPAPI_NOT_INITIALIZED 0x10000190
  44. /*AEP_Initialise has already been called*/
  45. #define AEP_R_AEPAPI_ALREADY_INITIALIZED 0x10000191
  46. /*Maximum number of connections to daemon reached*/
  47. #define AEP_R_NO_MORE_CONNECTION_HNDLS 0x10000200
  48. /*
  49.  *
  50.  * Some AEP Type definitions
  51.  *
  52.  */
  53. /* an unsigned 8-bit value */
  54. typedef unsigned char AEP_U8;
  55. /* an unsigned 8-bit character */
  56. typedef char AEP_CHAR;
  57. /* a BYTE-sized Boolean flag */
  58. typedef AEP_U8 AEP_BBOOL;
  59. /*Unsigned value, at least 16 bits long*/
  60. typedef unsigned short AEP_U16;
  61. /* an unsigned value, at least 32 bits long */
  62. #ifdef SIXTY_FOUR_BIT_LONG
  63. typedef unsigned int AEP_U32;
  64. #else
  65. typedef unsigned long AEP_U32;
  66. #endif
  67. #ifdef SIXTY_FOUR_BIT_LONG
  68. typedef unsigned long AEP_U64;
  69. #else
  70. typedef struct { unsigned long l1, l2; } AEP_U64;
  71. #endif
  72. /* at least 32 bits; each bit is a Boolean flag */
  73. typedef AEP_U32 AEP_FLAGS;
  74. typedef AEP_U8      *AEP_U8_PTR;
  75. typedef AEP_CHAR     *AEP_CHAR_PTR;
  76. typedef AEP_U32 *AEP_U32_PTR;
  77. typedef AEP_U64 *AEP_U64_PTR;
  78. typedef void         *AEP_VOID_PTR;
  79. /* Pointer to a AEP_VOID_PTR-- i.e., pointer to pointer to void */
  80. typedef AEP_VOID_PTR  *AEP_VOID_PTR_PTR;
  81. /*Used to identify an AEP connection handle*/
  82. typedef AEP_U32 AEP_CONNECTION_HNDL;
  83. /*Pointer to an AEP connection handle*/
  84. typedef AEP_CONNECTION_HNDL  *AEP_CONNECTION_HNDL_PTR;
  85. /*Used by an application (in conjunction with the apps process id) to 
  86. identify an individual transaction*/
  87. typedef AEP_U32 AEP_TRANSACTION_ID;
  88. /*Pointer to an applications transaction identifier*/
  89. typedef AEP_TRANSACTION_ID  *AEP_TRANSACTION_ID_PTR;
  90. /*Return value type*/
  91. typedef AEP_U32 AEP_RV;
  92. #define MAX_PROCESS_CONNECTIONS 256
  93. #define RAND_BLK_SIZE 1024
  94. typedef enum{
  95.         NotConnected=   0,
  96.         Connected=              1,
  97.         InUse=                  2
  98. } AEP_CONNECTION_STATE;
  99. typedef struct AEP_CONNECTION_ENTRY{
  100.         AEP_CONNECTION_STATE    conn_state;
  101.         AEP_CONNECTION_HNDL     conn_hndl;
  102. } AEP_CONNECTION_ENTRY;
  103. typedef AEP_RV t_AEP_OpenConnection(AEP_CONNECTION_HNDL_PTR phConnection);
  104. typedef AEP_RV t_AEP_CloseConnection(AEP_CONNECTION_HNDL hConnection);
  105. typedef AEP_RV t_AEP_ModExp(AEP_CONNECTION_HNDL hConnection,
  106.     AEP_VOID_PTR pA, AEP_VOID_PTR pP,
  107.     AEP_VOID_PTR pN,
  108.     AEP_VOID_PTR pResult,
  109.     AEP_TRANSACTION_ID* pidTransID);
  110. typedef AEP_RV t_AEP_ModExpCrt(AEP_CONNECTION_HNDL hConnection,
  111.        AEP_VOID_PTR pA, AEP_VOID_PTR pP,
  112.        AEP_VOID_PTR pQ,
  113.        AEP_VOID_PTR pDmp1, AEP_VOID_PTR pDmq1,
  114.        AEP_VOID_PTR pIqmp,
  115.        AEP_VOID_PTR pResult,
  116.        AEP_TRANSACTION_ID* pidTransID);
  117. #ifdef AEPRAND
  118. typedef AEP_RV t_AEP_GenRandom(AEP_CONNECTION_HNDL hConnection,
  119.        AEP_U32 Len,
  120.        AEP_U32 Type,
  121.        AEP_VOID_PTR pResult,
  122.        AEP_TRANSACTION_ID* pidTransID);
  123. #endif
  124. typedef AEP_RV t_AEP_Initialize(AEP_VOID_PTR pInitArgs);
  125. typedef AEP_RV t_AEP_Finalize(void);
  126. typedef AEP_RV t_AEP_SetBNCallBacks(AEP_RV (*GetBigNumSizeFunc)(AEP_VOID_PTR ArbBigNum, AEP_U32* BigNumSize),
  127.     AEP_RV (*MakeAEPBigNumFunc)(AEP_VOID_PTR ArbBigNum, AEP_U32 BigNumSize, unsigned char* AEP_BigNum),
  128.     AEP_RV (*ConverAEPBigNumFunc)(void* ArbBigNum, AEP_U32 BigNumSize, unsigned char* AEP_BigNum));