Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
3.1 KiB

  1. #ifndef _CSPDEFS_H_
  2. #define _CSPDEFS_H_
  3. #include <windows.h>
  4. #include <wincrypt.h>
  5. #include "carddefs.h"
  6. #include "cspcache.h"
  7. /*
  8. CSP Specific entry points. Wrappers for card-specific
  9. entry points.
  10. CSPQueryCapabilities
  11. CSPEnumContainers
  12. CSPDeleteContainer
  13. CSPCreateContainer
  14. CSPGetContainerInfo
  15. CSPSubmitPin
  16. CSPChangePin
  17. CSPReadFile
  18. CSPWriteFile
  19. CSPDeleteFile
  20. CSPEnumFiles
  21. CSPQueryFreeSpace
  22. CSPRsaDecrypt
  23. CSPEnumKeySizes
  24. */
  25. //
  26. // Type: CSP_PROV_CTX
  27. //
  28. // Purpose: This is the HCRYPTPROV struct for the MS SmartCard CSP
  29. //
  30. typedef struct _CSP_PROV_CTX
  31. {
  32. // hProv disposition - VERIFYCONTEXT, MACHINE_CONTEXT, etc.
  33. // Used to verify correct access per-call as appropriate.
  34. DWORD dwCtxDisposition;
  35. // Associate this prov handle with a specific card
  36. CHAR rgszCardSerialNumber[cchCARD_SERIAL_NUMBER];
  37. // Redirect calls to this context to the software CSP
  38. BOOL fRedirect;
  39. PCARD_CACHE pCardCache;
  40. LPSTR pszContName;
  41. //CONTAINER_INFO ContInfo;
  42. //PBYTE pbCertData;
  43. // Context data from advapi
  44. PBYTE pbContextInfo;
  45. DWORD cbContextInfo;
  46. LPSTR pszProvName;
  47. } CSP_PROV_CTX, *PCSP_PROV_CTX;
  48. //
  49. // Type: CSP_KEY_CTX
  50. //
  51. // Purpose: This is the HCRYPTKEY struct for the MS SmartCard CSP
  52. //
  53. typedef struct _CSP_KEY_CTX
  54. {
  55. PCSP_PROV_CTX pProvCtx;
  56. HCRYPTKEY hRedirectKey;
  57. } CSP_KEY_CTX, *PCSP_KEY_CTX;
  58. //
  59. // Type: CSP_HASH_CTX
  60. //
  61. // Purpose: This is the HCRYPTHASH struct for the MS SmartCard CSP
  62. //
  63. typedef struct _CSP_HASH_CTX
  64. {
  65. PCSP_PROV_CTX pProvCtx;
  66. HCRYPTHASH hRedirectHash;
  67. } CSP_HASH_CTX, *PCSP_HASH_CTX;
  68. //
  69. // Type: CARD_CACHE_ITEM
  70. //
  71. // Purpose: For card data to be stored in a Cache List, this struct
  72. // is the data type to be cached with each key.
  73. //
  74. typedef struct _CARD_CACHE_ITEM
  75. {
  76. DWORD dwCacheStamp;
  77. PBYTE pbData;
  78. DWORD cbData;
  79. } CARD_CACHE_ITEM, *PCARD_CACHE_ITEM;
  80. //
  81. // Type: CARD_CACHE
  82. //
  83. // Purpose: This is the process-wide cache containing data from
  84. // the SmartCard currently in use.
  85. //
  86. typedef struct _CARD_CACHE
  87. {
  88. // Increment each time this instance is referenced
  89. // by a new hProv. Decrement each time a referring
  90. // context is released.
  91. DWORD dwRefCount;
  92. // Cached data for this card
  93. PCARD_CAPABILITIES pCardCapabilities;
  94. DWORD dwCardCapabilitiesCacheStamp;
  95. PCARD_FREE_SPACE pCardFreeSpace;
  96. DWORD dwCardFreeSpaceCacheStamp;
  97. CACHE_HANDLE hCardFileCache;
  98. CACHE_HANDLE hCardContainerCache;
  99. //PINCACHE_HANDLE hPinCache;
  100. CHAR rgszCardSerialNumber[cchCARD_SERIAL_NUMBER];
  101. LPSTR pszDefContName;
  102. DWORD dwDefContNameCacheStamp;
  103. PCARD_DATA pCardData;
  104. PCARD_KEY_SIZES pSignatureKeySizes;
  105. PCARD_KEY_SIZES pExchangeKeySizes;
  106. HCRYPTPROV hRedirectCtx;
  107. CRITICAL_SECTION CritSec;
  108. } CARD_CACHE, *PCARD_CACHE;
  109. //
  110. // Type: CSP_DATA
  111. //
  112. // Purpose: Global CSP data.
  113. //
  114. typedef struct _CSP_DATA
  115. {
  116. HCRYPTPROV hRedirectCtx;
  117. DWORD dwInitRedirectCtx;
  118. // This critsec is used to protect hCachedCards
  119. CRITICAL_SECTION CritSec;
  120. // Each item in the hCachedCards cache list
  121. // is cached as type CARD_CACHE.
  122. CACHE_HANDLE hCachedCards;
  123. } CSP_DATA, *PCSP_DATA;
  124. #endif