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.

173 lines
4.2 KiB

  1. //
  2. // CSPStruc.h
  3. //
  4. // 7/17/00 dangriff created
  5. //
  6. #ifndef __CSPSTRUC__H__
  7. #define __CSPSTRUC__H__
  8. #include <windows.h>
  9. #include <wincrypt.h>
  10. #define LOG_TRY(X) { if (! X) { goto Cleanup; } }
  11. typedef enum _KNOWN_ERROR_ID
  12. {
  13. KNOWN_ERROR_UNKNOWN,
  14. //
  15. // Positive test cases
  16. //
  17. KNOWN_CRYPTGETPROVPARAM_MAC,
  18. KNOWN_CRYPTGETPROVPARAM_PPNAME,
  19. KNOWN_CRYPTSETKEYPARAM_EXPORT,
  20. KNOWN_CRYPTGETKEYPARAM_SALT,
  21. KNOWN_CRYPTGENKEY_SALTDES,
  22. //
  23. // Negative test cases
  24. //
  25. KNOWN_CRYPTACQUIRECONTEXT_NULLPHPROV,
  26. KNOWN_CRYPTACQUIRECONTEXT_BADFLAGS,
  27. KNOWN_ERRORINVALIDHANDLE,
  28. KNOWN_CRYPTGETPROVPARAM_MOREDATA,
  29. KNOWN_CRYPTSETPROVPARAM_RNG,
  30. KNOWN_CRYPTSETPROVPARAM_BADFLAGS,
  31. KNOWN_CRYPTCREATEHASH_BADKEY,
  32. KNOWN_CRYPTIMPORTKEY_BADFLAGS,
  33. KNOWN_CRYPTIMPORTKEY_BADALGID,
  34. KNOWN_NTEBADKEY,
  35. KNOWN_NTEBADHASH,
  36. KNOWN_CRYPTGENKEY_SILENTCONTEXT,
  37. //
  38. // Scenario test cases
  39. //
  40. KNOWN_TESTDECRYPTPROC_3DES112
  41. } KNOWN_ERROR_ID;
  42. //
  43. // Struct: TESTCASE
  44. // Purpose: Contains test case state data that is passed to
  45. // the API wrappers for logging and setting result expectation.
  46. //
  47. typedef struct _TESTCASE
  48. {
  49. DWORD dwErrorLevel;
  50. DWORD dwTestCaseID;
  51. KNOWN_ERROR_ID KnownErrorID;
  52. BOOL fExpectSuccess;
  53. DWORD dwErrorCode;
  54. DWORD dwTestLevel;
  55. DWORD dwCSPClass;
  56. BOOL fSmartCardCSP;
  57. //
  58. // If fEnumerating is TRUE, calls to TGetProv will directly return
  59. // what CryptGetProvParam returned.
  60. //
  61. // If fEnumerating is FALSE, TGetProv will return the result
  62. // of CheckContinueStatus.
  63. //
  64. BOOL fEnumerating;
  65. //
  66. // If fTestingReleaseContext is TRUE, TRelease will check fExpectSuccess
  67. // to determine the expected return value of the call to CryptReleaseContext.
  68. //
  69. // If fTestingReleaseContext if FALSE, TRelease will always expect
  70. // CryptReleaseContext to succeed. If it doesn't succeed, an error
  71. // will be logged.
  72. //
  73. BOOL fTestingReleaseContext;
  74. //
  75. // Use of fTestingDestroyKey is similar to fTestingReleaseContext above.
  76. //
  77. BOOL fTestingDestroyKey;
  78. //
  79. // Use of fTestingDestroyHash is similar to fTestingReleaseContext above.
  80. //
  81. BOOL fTestingDestroyHash;
  82. //
  83. // If fTestingUserProtected is FALSE, CreateNewContext will acquire a
  84. // CRYPT_SILENT context handle regardless of the dwFlags parameter.
  85. //
  86. // If fTestingUserProtected is TRUE, CreateNewContext will not OR in
  87. // the CRYPT_SILENT flag.
  88. //
  89. BOOL fTestingUserProtected;
  90. //
  91. // Optional. If pwszErrorHelp is non-null when a test case fails, the string
  92. // will be part of the logging output.
  93. //
  94. LPWSTR pwszErrorHelp;
  95. } TESTCASE, *PTESTCASE;
  96. //
  97. // Struct: KNOWN_ERROR_INFO
  98. // Purpose: Data regarding a known error in the Microsoft CSP's
  99. //
  100. typedef struct _KNOWN_ERROR_INFO
  101. {
  102. KNOWN_ERROR_ID KnownErrorID;
  103. DWORD dwMajorVersion;
  104. DWORD dwMinorVersion;
  105. DWORD dwServicePackMajor;
  106. DWORD dwServicePackMinor;
  107. DWORD dwErrorLevel;
  108. } KNOWN_ERROR_INFO, *PKNOWN_ERROR_INFO;
  109. //
  110. // Struct: ALGNODE
  111. // Purpose: A list-node structure that stores information about each algorithm
  112. // supported by the CSP under test.
  113. //
  114. typedef struct _ALGNODE
  115. {
  116. PROV_ENUMALGS_EX ProvEnumalgsEx;
  117. BOOL fIsRequiredAlg;
  118. BOOL fIsKnownAlg;
  119. struct _ALGNODE *pAlgNodeNext;
  120. } ALGNODE, *PALGNODE;
  121. //
  122. // Struct: CSPINFO
  123. // Purpose: This struct is used to pass data that has been gathered about
  124. // the CSP under test through the testing routines.
  125. //
  126. typedef struct _CSPINFO
  127. {
  128. PALGNODE pAlgList;
  129. LPWSTR pwszCSPName;
  130. DWORD dwCSPInternalClass;
  131. DWORD dwExternalProvType;
  132. DWORD dwInternalProvType;
  133. DWORD dwSigKeysizeInc;
  134. DWORD dwKeyXKeysizeInc;
  135. DWORD dwKeySpec;
  136. TESTCASE TestCase;
  137. //
  138. // This flag is set to true if the CSP under test is a
  139. // Smart Card CSP.
  140. //
  141. BOOL fSmartCardCSP;
  142. //
  143. // For SmartCard CSP's, this flag will be set to true after the execution
  144. // of the first CSP entry point that is expected to have resulted in
  145. // the user being prompted to enter the card PIN. For software CSP's
  146. // this field is ignored.
  147. //
  148. BOOL fPinEntered;
  149. } CSPINFO, *PCSPINFO;
  150. typedef BOOL (*PFN_CSPTEST)(PCSPINFO pCspInfo);
  151. #endif