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.

133 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1997-2001 Microsoft Corporation
  3. Module Name:
  4. ah.h
  5. Abstract:
  6. Contains AH specific structures
  7. Author:
  8. Sanjay Anand (SanjayAn) 2-January-1997
  9. ChunYe
  10. Environment:
  11. Kernel mode
  12. Revision History:
  13. --*/
  14. #ifndef _AH_
  15. #define _AH_
  16. #define MD5DIGESTLEN 16
  17. #define SHADIGESTLEN 20
  18. #define AH_SIZE (sizeof(AH) + MD5DIGESTLEN * sizeof(UCHAR))
  19. //
  20. // State buffers for the individual algorithms
  21. //
  22. typedef struct _AlgoState {
  23. union { // internal algo state
  24. MD5_CTX as_md5ctx;
  25. A_SHA_CTX as_shactx;
  26. };
  27. PSA_TABLE_ENTRY as_sa;
  28. } ALGO_STATE, *PALGO_STATE;
  29. typedef NTSTATUS
  30. (*PALGO_INIT) (
  31. PALGO_STATE pEntry,
  32. ULONG Index
  33. );
  34. typedef NTSTATUS
  35. (*PALGO_UPDATE) (
  36. PALGO_STATE State,
  37. PUCHAR Data,
  38. ULONG Length
  39. );
  40. typedef NTSTATUS
  41. (*PALGO_FINISH) (
  42. PALGO_STATE State,
  43. PUCHAR Data,
  44. ULONG Index
  45. );
  46. //
  47. // Array of function ptrs for the AH authentication algorithms
  48. //
  49. typedef struct _auth_algorithm {
  50. PALGO_INIT init; // ptr to init fn for alg.
  51. PALGO_UPDATE update; // ptr to update fn for alg
  52. PALGO_FINISH finish; // ptr to finish fn for alg
  53. ULONG OutputLen; // Length (in u_int8s) of output
  54. // data. MUST be a multiple of 4
  55. } AUTH_ALGO, *PAUTH_ALGO;
  56. #define NUM_AUTH_ALGOS (sizeof(auth_algorithms)/sizeof(AUTH_ALGO)-1)
  57. //
  58. // The IPSEC AH payload
  59. //
  60. typedef struct _AH {
  61. UCHAR ah_next;
  62. UCHAR ah_len;
  63. USHORT ah_reserved;
  64. tSPI ah_spi;
  65. ULONG ah_replay;
  66. } AH, *PAH;
  67. NTSTATUS
  68. IPSecCreateAH(
  69. IN PUCHAR pIPHeader,
  70. IN PVOID pData,
  71. IN PVOID IPContext,
  72. IN PSA_TABLE_ENTRY pSA,
  73. IN ULONG Index,
  74. OUT PVOID *ppNewData,
  75. OUT PVOID *ppSCContext,
  76. OUT PULONG pExtraBytes,
  77. IN ULONG HdrSpace,
  78. IN BOOLEAN fSrcRoute,
  79. IN BOOLEAN fCryptoOnly
  80. );
  81. NTSTATUS
  82. IPSecVerifyAH(
  83. IN PUCHAR *pIPHeader,
  84. IN PVOID pData,
  85. IN PSA_TABLE_ENTRY pSA,
  86. IN ULONG Index,
  87. OUT PULONG pExtraBytes,
  88. IN BOOLEAN fSrcRoute,
  89. IN BOOLEAN fCryptoDone,
  90. IN BOOLEAN fFastRcv
  91. );
  92. NTSTATUS
  93. IPSecGenerateHash(
  94. IN PUCHAR pIPHeader,
  95. IN PVOID pData,
  96. IN PSA_TABLE_ENTRY pSA,
  97. IN PUCHAR pAHData,
  98. IN BOOLEAN fMuteDest,
  99. IN BOOLEAN fIncoming,
  100. IN PAUTH_ALGO pAlgo,
  101. IN ULONG Index
  102. );
  103. #endif _AH_