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.

189 lines
4.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: global.h
  8. //
  9. // Contents: Top level internal header file for CertStor APIs. This file
  10. // includes all base header files and contains other global
  11. // stuff.
  12. //
  13. // History: 14-May-96 kevinr created
  14. //
  15. //--------------------------------------------------------------------------
  16. // #define USE_TEST_ROOT_FOR_TESTING 1
  17. #define CMS_PKCS7 1
  18. #define CERT_CHAIN_PARA_HAS_EXTRA_FIELDS 1
  19. #define CERT_REVOCATION_PARA_HAS_EXTRA_FIELDS 1
  20. #define CERT_CHAIN_FIND_BY_ISSUER_PARA_HAS_EXTRA_FIELDS 1
  21. // #define DEBUG_CRYPT_ASN1_MASTER 1
  22. #ifdef CMS_PKCS7
  23. #define CMSG_SIGNER_ENCODE_INFO_HAS_CMS_FIELDS 1
  24. #define CRYPT_SIGN_MESSAGE_PARA_HAS_CMS_FIELDS 1
  25. #define CMSG_ENVELOPED_ENCODE_INFO_HAS_CMS_FIELDS 1
  26. #endif // CMS_PKCS7
  27. #define CRYPT_DECRYPT_MESSAGE_PARA_HAS_EXTRA_FIELDS 1
  28. #define STRUCT_CBSIZE(StructName, FieldName) \
  29. (offsetof(StructName, FieldName) + sizeof(((StructName *) 0)->FieldName))
  30. #pragma warning(push,3)
  31. #include <windows.h>
  32. #include <assert.h>
  33. #include <malloc.h>
  34. #include <memory.h>
  35. #include <stdio.h>
  36. #include <stdlib.h>
  37. #include <stddef.h>
  38. #include <string.h>
  39. #include <time.h>
  40. #include <crtdbg.h>
  41. #include <userenv.h>
  42. #include <shlobj.h>
  43. #pragma warning (pop)
  44. // unreferenced inline function has been removed
  45. #pragma warning (disable: 4514)
  46. // unreferenced formal parameter
  47. #pragma warning (disable: 4100)
  48. // conditional expression is constant
  49. #pragma warning (disable: 4127)
  50. // assignment within conditional expression
  51. #pragma warning (disable: 4706)
  52. // nonstandard extension used : nameless struct/union
  53. #pragma warning (disable: 4201)
  54. #include "crtem.h"
  55. #include "pkistr.h"
  56. #include "pkicrit.h"
  57. #include "wincrypt.h"
  58. #include "unicode.h"
  59. #include "crypttls.h"
  60. #include "crypthlp.h"
  61. #include "certprot.h"
  62. #include "pkialloc.h"
  63. #include "asn1util.h"
  64. #include "pkiasn1.h"
  65. #include "utf8.h"
  66. #include "certperf.h"
  67. #include "logstor.h"
  68. #include "protroot.h"
  69. #include "rootlist.h"
  70. #include "dblog.h"
  71. #include "crypt32msg.h"
  72. #include "md5.h"
  73. #include "sha.h"
  74. extern HMODULE hCertStoreInst;
  75. #include "resource.h"
  76. #ifdef __cplusplus
  77. extern "C" {
  78. #endif
  79. // # of bytes for a hash. Such as, SHA (20) or MD5 (16)
  80. #define MAX_HASH_LEN 20
  81. #define SHA1_HASH_LEN 20
  82. // Null terminated ascii hex characters of the hash.
  83. // For Win95 Remote Registry Access:: Need extra character
  84. #define MAX_CERT_REG_VALUE_NAME_LEN (2 * MAX_HASH_LEN + 1 + 1)
  85. #define MAX_HASH_NAME_LEN MAX_CERT_REG_VALUE_NAME_LEN
  86. //+-------------------------------------------------------------------------
  87. // Compares the certificate's public key with the provider's public key
  88. // to see if they are identical.
  89. //
  90. // Returns TRUE if the keys are identical.
  91. //
  92. // Implemented in certhlpr.cpp.
  93. //--------------------------------------------------------------------------
  94. BOOL
  95. WINAPI
  96. I_CertCompareCertAndProviderPublicKey(
  97. IN PCCERT_CONTEXT pCert,
  98. IN HCRYPTPROV hProv,
  99. IN DWORD dwKeySpec
  100. );
  101. //+-------------------------------------------------------------------------
  102. // Find chain helper functions
  103. //
  104. // Implemented in fndchain.cpp.
  105. //--------------------------------------------------------------------------
  106. BOOL IFC_IsEndCertValidForUsage(
  107. IN PCCERT_CONTEXT pCert,
  108. IN LPCSTR pszUsageIdentifier
  109. );
  110. BOOL IFC_IsEndCertValidForUsages(
  111. IN PCCERT_CONTEXT pCert,
  112. IN PCERT_ENHKEY_USAGE pUsage,
  113. IN BOOL fOrUsage
  114. );
  115. #include "x509.h"
  116. //+-------------------------------------------------------------------------
  117. // Convert to/from EncodedOID
  118. //
  119. // Implemented in oidconv.cpp.
  120. //--------------------------------------------------------------------------
  121. BOOL
  122. WINAPI
  123. I_CryptOIDConvDllMain(
  124. HMODULE hInst,
  125. ULONG ulReason,
  126. LPVOID lpReserved
  127. );
  128. BOOL
  129. WINAPI
  130. I_CryptSetEncodedOID(
  131. IN LPSTR pszObjId,
  132. OUT ASN1encodedOID_t *pEncodedOid
  133. );
  134. void
  135. WINAPI
  136. I_CryptGetEncodedOID(
  137. IN ASN1encodedOID_t *pEncodedOid,
  138. IN DWORD dwFlags,
  139. OUT LPSTR *ppszObjId,
  140. IN OUT BYTE **ppbExtra,
  141. IN OUT LONG *plRemainExtra
  142. );
  143. #ifdef __cplusplus
  144. } // Balance extern "C" above
  145. #endif
  146. #include "ekuhlpr.h"
  147. #include <scrdcert.h>
  148. #include <scstore.h>
  149. #pragma hdrstop