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.

137 lines
3.7 KiB

  1. //+-------------------------------------------------------------------------
  2. // Microsoft Windows
  3. //
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: pkialloc.h
  7. //
  8. // Contents: PKI Allocation Functions
  9. //
  10. // APIs:
  11. // PkiAlloc
  12. //
  13. // History: 19-Jan-98 philh created
  14. //--------------------------------------------------------------------------
  15. #ifndef __PKIALLOC_H__
  16. #define __PKIALLOC_H__
  17. #include <wincrypt.h>
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. //+-------------------------------------------------------------------------
  22. // The following functions use the 'C' runtime's allocation functions
  23. // when DBG is defined. Otherwise, use LocalAlloc, LocalReAlloc or
  24. // LocalFree Win32 APIs.
  25. //--------------------------------------------------------------------------
  26. // Calls malloc when DBG is defined. Otherwise, does a
  27. // ZEROINIT LocalAlloc.
  28. LPVOID
  29. WINAPI
  30. PkiAlloc(
  31. IN size_t cbBytes
  32. );
  33. // Calls malloc and does a memory clear when DBG is defined.
  34. // Otherwise, does a ZEROINIT LocalAlloc.
  35. LPVOID
  36. WINAPI
  37. PkiZeroAlloc(
  38. IN size_t cbBytes
  39. );
  40. // Calls malloc when DBG is defined. Otherwise, does a
  41. // LocalAlloc without ZEOINIT.
  42. LPVOID
  43. WINAPI
  44. PkiNonzeroAlloc(
  45. IN size_t cbBytes
  46. );
  47. LPVOID
  48. WINAPI
  49. PkiRealloc(
  50. IN LPVOID pvOrg,
  51. IN size_t cbBytes
  52. );
  53. VOID
  54. WINAPI
  55. PkiFree(
  56. IN LPVOID pv
  57. );
  58. //+-------------------------------------------------------------------------
  59. // The following functions always use LocalAlloc and LocalFree Win32 APIs.
  60. //--------------------------------------------------------------------------
  61. LPVOID
  62. WINAPI
  63. PkiDefaultCryptAlloc(
  64. IN size_t cbSize
  65. );
  66. VOID
  67. WINAPI
  68. PkiDefaultCryptFree(
  69. IN LPVOID pv
  70. );
  71. //+-------------------------------------------------------------------------
  72. // The following data structure's pfnAlloc and pfnFree are set to
  73. // PkiNonzeroAlloc and PkiFree.
  74. //--------------------------------------------------------------------------
  75. extern CRYPT_ENCODE_PARA PkiEncodePara;
  76. //+-------------------------------------------------------------------------
  77. // If pfnAlloc isn't defined, returns PkiDefaultCryptAlloc
  78. //--------------------------------------------------------------------------
  79. PFN_CRYPT_ALLOC
  80. WINAPI
  81. PkiGetEncodeAllocFunction(
  82. IN OPTIONAL PCRYPT_ENCODE_PARA pEncodePara
  83. );
  84. //+-------------------------------------------------------------------------
  85. // If pfnFree isn't defined, returns PkiDefaultCryptFree
  86. //--------------------------------------------------------------------------
  87. PFN_CRYPT_FREE
  88. WINAPI
  89. PkiGetEncodeFreeFunction(
  90. IN OPTIONAL PCRYPT_ENCODE_PARA pEncodePara
  91. );
  92. //+-------------------------------------------------------------------------
  93. // The following data structure's pfnAlloc and pfnFree are set to
  94. // PkiNonzeroAlloc and PkiFree.
  95. //--------------------------------------------------------------------------
  96. extern CRYPT_DECODE_PARA PkiDecodePara;
  97. //+-------------------------------------------------------------------------
  98. // If pfnAlloc isn't defined, returns PkiDefaultCryptAlloc
  99. //--------------------------------------------------------------------------
  100. PFN_CRYPT_ALLOC
  101. WINAPI
  102. PkiGetDecodeAllocFunction(
  103. IN OPTIONAL PCRYPT_DECODE_PARA pDecodePara
  104. );
  105. //+-------------------------------------------------------------------------
  106. // If pfnFree isn't defined, returns PkiDefaultCryptFree
  107. //--------------------------------------------------------------------------
  108. PFN_CRYPT_FREE
  109. WINAPI
  110. PkiGetDecodeFreeFunction(
  111. IN OPTIONAL PCRYPT_DECODE_PARA pDecodePara
  112. );
  113. #ifdef __cplusplus
  114. } // Balance extern "C" above
  115. #endif
  116. #endif