home *** CD-ROM | disk | FTP | other *** search
/ ftp.rsa.com / 2014.05.ftp.rsa.com.tar / ftp.rsa.com / pub / pkcs / pkcs-11 / pkcs11.h < prev    next >
C/C++ Source or Header  |  2014-05-02  |  3KB  |  116 lines

  1. /* Define API */
  2. #ifndef _PKCS11_H_
  3. #define _PKCS11_H_ 1
  4.  
  5. #ifndef FALSE
  6. #define FALSE             0
  7. #endif
  8.  
  9. #ifndef TRUE
  10. #define TRUE              (!FALSE)
  11. #endif
  12.  
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16.  
  17. /* All the various Cryptoki types and #define'd values are in the file
  18.  * pkcs11t.h.  CK_PTR should be defined there, too; it's the recipe for
  19.  * making pointers. */
  20. #include "pkcs11t.h"
  21.  
  22. #define __PASTE(x,y)      x##y
  23.  
  24. /* =================================================================
  25.  * Define the "extern" form of all the entry points */
  26.  
  27. #define CK_EXTERN         extern
  28. #define CK_FUNC(name)     CK_ENTRY name
  29. #define CK_NEED_ARG_LIST  1
  30. #define _CK_RV            CK_RV
  31.  
  32. /* pkcs11f.h has all the information about the Cryptoki functions. */
  33. #include "pkcs11f.h"
  34.  
  35. #undef CK_FUNC
  36. #undef CK_EXTERN
  37. #undef CK_NEED_ARG_LIST
  38. #undef _CK_RV
  39.  
  40. /* =================================================================
  41.  * Define the typedef form of all the entry points.
  42.  * That is, for each Cryptoki function C_XXX, define a type CK_C_XXX
  43.  * which is a pointer to that kind of function. */
  44.  
  45. #define CK_EXTERN         typedef
  46. #define CK_FUNC(name)     CK_ENTRY (CK_PTR __PASTE(CK_,name))
  47. #define CK_NEED_ARG_LIST  1
  48. #define _CK_RV            CK_RV
  49.  
  50. #include "pkcs11f.h"
  51.  
  52. #undef CK_FUNC
  53. #undef CK_EXTERN
  54. #undef CK_NEED_ARG_LIST
  55. #undef _CK_RV
  56.  
  57. /* =================================================================
  58.  * Define structed vector of entry points.
  59.  * The CK_FUNCTION_LIST contains a CK_VERSION indicating the Cryptoki
  60.  * version, and then a whole slew of function pointers to the routines
  61.  * in the library.  This type was declared, but not defined, in
  62.  * pkcs11t.h. */
  63.  
  64.  
  65. /* These data types are platform/implementation dependent. */
  66. #if defined(WINDOWS) 
  67. #if defined(_WIN32)
  68. #define CK_ENTRY          __declspec( dllexport )
  69. #define CK_PTR            *
  70. #define NULL_PTR          0
  71. #pragma pack(push, cryptoki, 1)
  72. #else /* win16 */
  73. #define CK_ENTRY          _export _far _pascal
  74. #define CK_PTR            far *
  75. #define NULL_PTR          0
  76. #pragma pack(push, cryptoki, 1)
  77. #endif
  78. #else /* not windows */
  79. #define CK_ENTRY
  80. #define CK_PTR            *
  81. #define NULL_PTR          0
  82. #endif
  83.  
  84.  
  85. #define CK_EXTERN 
  86. #define CK_FUNC(name)     __PASTE(CK_,name) name;
  87. #define _CK_RV
  88.  
  89. struct CK_FUNCTION_LIST {
  90.  
  91.   CK_VERSION    version;  /* Cryptoki version */
  92.  
  93. /* Pile all the function pointers into it. */
  94. #include "pkcs11f.h"
  95.  
  96. };
  97.  
  98. #undef CK_FUNC
  99. #undef CK_EXTERN
  100. #undef _CK_RV
  101.  
  102.  
  103. #if defined(WINDOWS)
  104. #pragma pack(pop, cryptoki)
  105. #endif
  106.  
  107.  
  108. #undef __PASTE
  109. /* ================================================================= */
  110.  
  111. #ifdef __cplusplus
  112. }
  113. #endif
  114.  
  115. #endif
  116.