Leaked source code of windows server 2003
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.

174 lines
4.0 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. secinit.h
  5. Abstract:
  6. Contains prototypes for indirected security functions
  7. Author:
  8. Sophia Chung (sophiac) 7-Feb-1996
  9. Revision History:
  10. --*/
  11. #if !defined(_SECINIT_)
  12. #define _SECINIT_
  13. #if defined(__cplusplus)
  14. extern "C" {
  15. #endif
  16. #include <sspi.h>
  17. #if defined(__cplusplus)
  18. }
  19. #endif
  20. extern CCritSec InitializationSecLock;
  21. extern PSecurityFunctionTable GlobalSecFuncTable;
  22. extern WIN_VERIFY_TRUST_FN pWinVerifyTrust;
  23. extern WT_HELPER_PROV_DATA_FROM_STATE_DATA_FN pWTHelperProvDataFromStateData;
  24. #define g_EnumerateSecurityPackages \
  25. (*(GlobalSecFuncTable->EnumerateSecurityPackagesA))
  26. #define g_AcquireCredentialsHandle \
  27. (*(GlobalSecFuncTable->AcquireCredentialsHandleA))
  28. #define g_FreeCredentialsHandle \
  29. (*(GlobalSecFuncTable->FreeCredentialHandle))
  30. #define g_InitializeSecurityContext \
  31. (*(GlobalSecFuncTable->InitializeSecurityContextA))
  32. #define g_DeleteSecurityContext \
  33. (*(GlobalSecFuncTable->DeleteSecurityContext))
  34. #define g_QueryContextAttributes \
  35. (*(GlobalSecFuncTable->QueryContextAttributesA))
  36. #define g_FreeContextBuffer \
  37. (*(GlobalSecFuncTable->FreeContextBuffer))
  38. #define g_SealMessage \
  39. (*((SEAL_MESSAGE_FN)GlobalSecFuncTable->Reserved3))
  40. #define g_UnsealMessage \
  41. (*((UNSEAL_MESSAGE_FN)GlobalSecFuncTable->Reserved4))
  42. LONG WINAPI WinVerifySecureChannel(HWND hwnd, WINTRUST_DATA *pWTD, BOOL fNoRevert);
  43. // Don't use WinVerifyTrust directly to verify secure channel connections.
  44. // Use the wininet wrapper WinVerifySecureChannel instead.
  45. #define g_WinVerifyTrust \
  46. pWinVerifyTrust
  47. typedef PSecurityFunctionTable (APIENTRY *INITSECURITYINTERFACE) (VOID);
  48. typedef HCERTSTORE
  49. (WINAPI *CERT_OPEN_STORE_FN)
  50. (IN LPCSTR lpszStoreProvider,
  51. IN DWORD dwMsgAndCertEncodingType,
  52. IN HCRYPTPROV hCryptProv,
  53. IN DWORD dwFlags,
  54. IN const void *pvPara
  55. );
  56. typedef BOOL
  57. (WINAPI *CERT_CLOSE_STORE_FN)
  58. (IN HCERTSTORE hCertStore,
  59. IN DWORD dwFlags
  60. );
  61. typedef PCCERT_CONTEXT
  62. (WINAPI *CERT_FIND_CERTIFICATE_IN_STORE_FN)
  63. (IN HCERTSTORE hCertStore,
  64. IN DWORD dwCertEncodingType,
  65. IN DWORD dwFindFlags,
  66. IN DWORD dwFindType,
  67. IN const void *pvFindPara,
  68. IN PCCERT_CONTEXT pPrevCertContext
  69. );
  70. typedef DWORD
  71. (WINAPI *CERT_NAME_TO_STR_W_FN)
  72. (IN DWORD dwCertEncodingType,
  73. IN PCERT_NAME_BLOB pName,
  74. IN DWORD dwStrType,
  75. OUT LPWSTR psz,
  76. IN DWORD csz
  77. );
  78. typedef BOOL
  79. (WINAPI *CERT_CONTROL_STORE_FN)
  80. (IN HCERTSTORE hCertStore,
  81. IN DWORD dwFlags,
  82. IN DWORD dwCtrlType,
  83. IN void const *pvCtrlPara
  84. );
  85. typedef BOOL
  86. (WINAPI * CERT_GET_CERT_PROPERTY)
  87. (
  88. PCCERT_CONTEXT pCertContext,
  89. DWORD dwPropId,
  90. void* pvData,
  91. DWORD* pcbData
  92. );
  93. typedef BOOL
  94. (WINAPI *CRYPT_UNPROTECT_DATA_FN)
  95. (IN DATA_BLOB *pDataIn,
  96. OUT OPTIONAL LPWSTR *ppszDataDescr,
  97. IN DATA_BLOB *pOptionalEntropy,
  98. IN PVOID pvReserved,
  99. IN OPTIONAL CRYPTPROTECT_PROMPTSTRUCT *pPromptStruct,
  100. IN DWORD dwFlags,
  101. OUT DATA_BLOB *pDataOut
  102. );
  103. #define CRYPT_UNPROTECT_DATA_FN_DEFINE
  104. extern CERT_OPEN_STORE_FN g_pfnCertOpenStore;
  105. extern CERT_CLOSE_STORE_FN g_pfnCertCloseStore;
  106. extern CERT_FIND_CERTIFICATE_IN_STORE_FN g_pfnCertFindCertificateInStore;
  107. extern CERT_NAME_TO_STR_W_FN g_pfnCertNameToStr;
  108. extern CERT_CONTROL_STORE_FN g_pfnCertControlStore;
  109. extern CRYPT_UNPROTECT_DATA_FN g_pfnCryptUnprotectData;
  110. extern CERT_GET_CERT_PROPERTY g_pfnCertGetCertProperty;
  111. #define LOCK_SECURITY() (InitializationSecLock.Lock())
  112. #define UNLOCK_SECURITY() (InitializationSecLock.Unlock())
  113. //
  114. // prototypes
  115. //
  116. BOOL
  117. SecurityInitialize(
  118. VOID
  119. );
  120. VOID
  121. SecurityTerminate(
  122. VOID
  123. );
  124. DWORD
  125. LoadSecurity(
  126. VOID
  127. );
  128. VOID
  129. UnloadSecurity(
  130. VOID
  131. );
  132. DWORD
  133. LoadWinTrust(
  134. VOID
  135. );
  136. #endif // _SECINIT_