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.

113 lines
4.1 KiB

  1. #include "wzccrypt.h"
  2. #pragma once
  3. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. // MEMORY ALLOCATION UTILITIES (defines, structs, funcs)
  5. #define MemCAlloc(nBytes) Process_user_allocate(nBytes)
  6. #define MemFree(pMem) Process_user_free(pMem)
  7. PVOID
  8. Process_user_allocate(size_t NumBytes);
  9. VOID
  10. Process_user_free(LPVOID pMem);
  11. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  12. // NDIS UTILITIES (defines, structs, funcs)
  13. //-----------------------------------------------------------
  14. // Searches pwzcConfig in the list pwzcVList. The entries are
  15. // matched exclusively based on the matching SSIDs and on
  16. // matching Infrastructure Mode.
  17. // [in] pwzcVList: Set of WZC_WLAN_CONFIGs to search in
  18. // [in] pwzcConfig: WZC_WLAN_CONFIG to look for
  19. // [in] nIdx: index in pwzcVList to start searching from
  20. // Returns: Pointer to the entry that matches pwzcConfig or NULL
  21. // if none matches
  22. PWZC_WLAN_CONFIG
  23. WzcFindConfig(
  24. PWZC_802_11_CONFIG_LIST pwzcList,
  25. PWZC_WLAN_CONFIG pwzcConfig,
  26. ULONG nIdx);
  27. // Matches the content of the two configurations one against the other.
  28. // [in] pwzcConfigA: | configs to match
  29. // [in] pwzcConfigB: |
  30. // [in/out] pbWepDiffOnly: TRUE if there is a difference and the difference is exclusively
  31. // in the WEP Key index or in WEP Key Material. Otherwise is false.
  32. // Returns: TRUE if the configs match, FALSE otherwise;
  33. BOOL
  34. WzcMatchConfig(
  35. PWZC_WLAN_CONFIG pwzcConfigA,
  36. PWZC_WLAN_CONFIG pwzcConfigB,
  37. PBOOL pbWepDiffOnly);
  38. // Converts an NDIS_802_11_BSSID_LIST object to an equivalent
  39. // (imaged) WZC_802_11_CONFIG_LIST
  40. // [in] pndList: NDIS BSSID list to convert
  41. // Returns: Pointer to the list of copied WZC configurations
  42. PWZC_802_11_CONFIG_LIST
  43. WzcNdisToWzc(
  44. PNDIS_802_11_BSSID_LIST pndList);
  45. // WzcCleanupList: Cleanup a list of WZC_WLAN_CONFIG objects
  46. VOID
  47. WzcCleanupWzcList(
  48. PWZC_802_11_CONFIG_LIST pwzcList);
  49. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  50. // SYNCHRONIZATION UTILITIES
  51. //-----------------------------------------------------------
  52. // Datastructures
  53. // RCCS_SYNC encapsulates a critical section and a reference counter.
  54. typedef struct _RCCS_SYNC
  55. {
  56. CRITICAL_SECTION csMutex;
  57. UINT nRefCount;
  58. } RCCS_SYNC, *PRCCS_SYNC;
  59. //-----------------------------------------------------------
  60. // RccsInit: Initializes an RCCS structure
  61. DWORD
  62. RccsInit(PRCCS_SYNC pRccs);
  63. //-----------------------------------------------------------
  64. // RccsInit: Deletes an RCCS structure
  65. DWORD
  66. RccsDestroy(PRCCS_SYNC pRccs);
  67. //-----------------------------------------------------------
  68. // WzcCryptBuffer: Randomly generates a nBufLen bytes in the range
  69. // [loByte hiByte], all stored in pBuffer (buffer assumed preallocated)
  70. // Returns a win32 error code.
  71. DWORD
  72. WzcRndGenBuffer(LPBYTE pBuffer, UINT nBufLen, BYTE loByte, BYTE hiByte);
  73. //-----------------------------------------------------------
  74. // WzcIsNullBuffer: Checks whether a buffer of nBufLen characters
  75. // is all filled with null characters.
  76. BOOL
  77. WzcIsNullBuffer(LPBYTE pBuffer, UINT nBufLen);
  78. //-----------------------------------------------------------
  79. // WzcSSKClean: Cleans up the PSEC_SESSION_KEYS object given as parameter
  80. VOID
  81. WzcSSKClean(PSEC_SESSION_KEYS pSSK);
  82. //-----------------------------------------------------------
  83. // WzcSSKFree: Frees up the memory used by the PSEC_SESSION_KEYS parameter
  84. VOID
  85. WzcSSKFree(PSEC_SESSION_KEYS pSSK);
  86. //-----------------------------------------------------------
  87. // WzcSSKEncrypt: Creates/Allocates a SEC_SESSION_KEYS object
  88. // by encrypting the SESSION_KEYS object provided as parameter.
  89. DWORD
  90. WzcSSKEncrypt(PSEC_SESSION_KEYS pSSK, PSESSION_KEYS pSK);
  91. //-----------------------------------------------------------
  92. // WzcSSKDecrypt: Creates/Allocates a SESSION_KEYS object
  93. // by dencrypting the SEC_SESSION_KEYS object provided as parameter.
  94. DWORD
  95. WzcSSKDecrypt(PSEC_SESSION_KEYS pSSK, PSESSION_KEYS pSK);