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.

191 lines
4.2 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. extern CRITICAL_SECTION InitializationSecLock;
  18. extern PSecurityFunctionTable GlobalSecFuncTable;
  19. extern WIN_VERIFY_TRUST_FN pWinVerifyTrust;
  20. extern WT_HELPER_PROV_DATA_FROM_STATE_DATA_FN pWTHelperProvDataFromStateData;
  21. extern SSL_CRACK_CERTIFICATE_FN pSslCrackCertificate;
  22. extern SSL_FREE_CERTIFICATE_FN pSslFreeCertificate;
  23. extern HCERTSTORE g_hMyCertStore;
  24. extern BOOL g_bOpenMyCertStore;
  25. extern BOOL g_fDoSpecialMagicForSGCCerts;
  26. #define g_EnumerateSecurityPackages \
  27. (*(GlobalSecFuncTable->EnumerateSecurityPackagesA))
  28. #define g_AcquireCredentialsHandle \
  29. (*(GlobalSecFuncTable->AcquireCredentialsHandleA))
  30. #define g_FreeCredentialsHandle \
  31. (*(GlobalSecFuncTable->FreeCredentialHandle))
  32. #define g_InitializeSecurityContext \
  33. (*(GlobalSecFuncTable->InitializeSecurityContextA))
  34. #define g_DeleteSecurityContext \
  35. (*(GlobalSecFuncTable->DeleteSecurityContext))
  36. #define g_QueryContextAttributes \
  37. (*(GlobalSecFuncTable->QueryContextAttributesA))
  38. #define g_FreeContextBuffer \
  39. (*(GlobalSecFuncTable->FreeContextBuffer))
  40. #define g_SealMessage \
  41. (*((SEAL_MESSAGE_FN)GlobalSecFuncTable->Reserved3))
  42. #define g_UnsealMessage \
  43. (*((UNSEAL_MESSAGE_FN)GlobalSecFuncTable->Reserved4))
  44. LONG WINAPI WinVerifySecureChannel(HWND hwnd, WINTRUST_DATA *pWTD);
  45. // Don't use WinVerifyTrust directly to verify secure channel connections.
  46. // Use the wininet wrapper WinVerifySecureChannel instead.
  47. #define g_WinVerifyTrust \
  48. pWinVerifyTrust
  49. #define g_SslCrackCertificate \
  50. pSslCrackCertificate
  51. #define g_SslFreeCertificate pSslFreeCertificate
  52. typedef PSecurityFunctionTable (APIENTRY *INITSECURITYINTERFACE) (VOID);
  53. #define CRYPT_INSTALL_DEFAULT_CONTEXT_NAME "CryptInstallDefaultContext"
  54. typedef BOOL
  55. (WINAPI * CRYPT_INSTALL_DEFAULT_CONTEXT_FN)
  56. (
  57. IN HCRYPTPROV hCryptProv,
  58. IN DWORD dwDefaultType,
  59. IN const void *pvDefaultPara,
  60. IN DWORD dwFlags,
  61. IN void *pvReserved,
  62. OUT HCRYPTDEFAULTCONTEXT *phDefaultContext
  63. );
  64. #define CRYPT_UNINSTALL_DEFAULT_CONTEXT_NAME "CryptUninstallDefaultContext"
  65. typedef BOOL
  66. (WINAPI * CRYPT_UNINSTALL_DEFAULT_CONTEXT_FN)
  67. (
  68. HCRYPTDEFAULTCONTEXT hDefaultContext,
  69. IN DWORD dwFlags,
  70. IN void *pvReserved
  71. );
  72. typedef PCCERT_CHAIN_CONTEXT
  73. (WINAPI *CERT_FIND_CHAIN_IN_STORE_FN)
  74. (
  75. IN HCERTSTORE hCertStore,
  76. IN DWORD dwCertEncodingType,
  77. IN DWORD dwFindFlags,
  78. IN DWORD dwFindType,
  79. IN const void *pvFindPara,
  80. IN PCCERT_CHAIN_CONTEXT pPrevChainContext
  81. );
  82. #define CERT_FIND_CHAIN_IN_STORE_NAME "CertFindChainInStore"
  83. typedef VOID
  84. (WINAPI *CERT_FREE_CERTIFICATE_CHAIN_FN)
  85. (
  86. IN PCCERT_CHAIN_CONTEXT pChainContext
  87. );
  88. #define CERT_FREE_CERTIFICATE_CHAIN_NAME "CertFreeCertificateChain"
  89. extern CRYPT_INSTALL_DEFAULT_CONTEXT_FN g_CryptInstallDefaultContext;
  90. extern CRYPT_UNINSTALL_DEFAULT_CONTEXT_FN g_CryptUninstallDefaultContext;
  91. extern CERT_FIND_CHAIN_IN_STORE_FN g_CertFindChainInStore;
  92. extern CERT_FREE_CERTIFICATE_CHAIN_FN g_CertFreeCertificateChain;
  93. extern HCRYPTPROV GlobalFortezzaCryptProv;
  94. #define LOCK_SECURITY() EnterCriticalSection( &InitializationSecLock )
  95. #define UNLOCK_SECURITY() LeaveCriticalSection( &InitializationSecLock )
  96. //
  97. // prototypes
  98. //
  99. VOID
  100. SecurityInitialize(
  101. VOID
  102. );
  103. VOID
  104. SecurityTerminate(
  105. VOID
  106. );
  107. DWORD
  108. ReopenMyCertStore(
  109. VOID
  110. );
  111. DWORD
  112. CloseMyCertStore(
  113. VOID
  114. );
  115. DWORD
  116. LoadSecurity(
  117. VOID
  118. );
  119. VOID
  120. UnloadSecurity(
  121. VOID
  122. );
  123. DWORD
  124. LoadWinTrust(
  125. VOID
  126. );
  127. BOOL
  128. IsFortezzaInstalled(
  129. VOID
  130. );
  131. BOOL AttemptedFortezzaLogin(
  132. VOID
  133. );
  134. DWORD FortezzaLogOn(
  135. HWND hwnd
  136. );
  137. #if defined(__cplusplus)
  138. }
  139. #endif
  140. #endif // _SECINIT_