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.

215 lines
4.7 KiB

  1. /*++
  2. Copyright (C) 1997 Cisco Systems, Inc. All Rights Reserved.
  3. Module Name:
  4. oakrpc.h
  5. Abstract:
  6. This module contains the definitions requires for the
  7. ISAKMP/Oakley RPC interface.
  8. Author:
  9. Derrell Piper (v-dpiper)
  10. Facility:
  11. ISAKMP/Oakley
  12. Revision History:
  13. --*/
  14. #ifndef __OAKRPC
  15. #define __OAKRPC
  16. typedef unsigned long IPADDR, *PIPADDR;
  17. typedef unsigned long SPI, *PSPI;
  18. /* Oakley hash algorithms */
  19. #define OAK_MD5 1
  20. #define OAK_SHA 2
  21. #define OAK_TIGER 3
  22. /* Oakley pseudo-random functions */
  23. #define OAK_3DES_CBC_MAC 1
  24. /* Oakley authentication methods */
  25. // See oakrpc.idl
  26. #define IPSEC_POLICY_CLEAR 0x00000010
  27. #define IPSEC_POLICY_BLOCK 0x00000020
  28. #define None 0
  29. #define Auth 1
  30. #define Encypt 2
  31. // Status flags
  32. #define STATUS_MM 0x1
  33. #define STATUS_QM 0x2
  34. #define STATUS_ME 0x4
  35. #define STATUS_PEER 0x8
  36. /* Oakley encryption algorithms */
  37. #define OAK_DES_CBC 1
  38. #define OAK_IDEA_CBC 2
  39. #define OAK_BLOWFISH_CBC 3
  40. #define OAK_RC5_R12_B64_CBC 4
  41. #define OAK_3DES_CBC 5
  42. #define OAK_CAST_CBC 6
  43. #define OAK_MM_NO_STATE 0
  44. #define OAK_MM_SA_SETUP 1
  45. #define OAK_MM_KEY_EXCH 2
  46. #define OAK_MM_KEY_AUTH 3
  47. #define OAK_MM_CONTINUE 4
  48. #define OAK_QM_SA_ACCEPT 7
  49. #define OAK_QM_AUTH_AWAIT 8
  50. #define OAK_QM_IDLE 9
  51. typedef DWORD OAKLEY_STATE;
  52. /* Oakley states */
  53. #define OAK_QM_SA_ACCEPT 7
  54. #define OAK_QM_AUTH_AWAIT 8
  55. #define OAK_QM_IDLE 9
  56. #define OAK_QM_CONNECT_WAIT 10
  57. /* generic crypto lifetime */
  58. typedef struct _Lifetime {
  59. DWORD KBytes;
  60. DWORD Seconds;
  61. } OAKLEY_LIFETIME, *POAKLEY_LIFETIME;
  62. /* generic algorithm descriptor */
  63. typedef struct _Algorithm {
  64. ULONG AlgorithmIdentifier;
  65. ULONG KeySize;
  66. ULONG Rounds;
  67. } OAKLEY_ALGORITHM, *POAKLEY_ALGORITHM;
  68. #define CRYPTO_VERSION_MAJOR 1 /* MajorVersion */
  69. #define CRYPTO_VERSION_MINOR 0 /* MinorVersion */
  70. #define MAX_ALGOS 3 //comp,ah,esp
  71. typedef LARGE_INTEGER COOKIE, *PCOOKIE;
  72. typedef struct _CryptoBundle {
  73. BYTE MajorVersion;
  74. BYTE MinorVersion;
  75. OAKLEY_ALGORITHM EncryptionAlgorithm;
  76. OAKLEY_ALGORITHM HashAlgorithm;
  77. OAKLEY_ALGORITHM PseudoRandomFunction; //unused
  78. BYTE AuthenticationMethod;
  79. DWORD OakleyGroup;
  80. DWORD QuickModeLimit;
  81. OAKLEY_LIFETIME Lifetime;
  82. BOOL PfsIdentityRequired;
  83. } CRYPTO_BUNDLE, *PCRYPTO_BUNDLE;
  84. // LeadingBundleFlags, possible on each byte of the DWORD
  85. #define BYTE_DES_MD5_2048 1
  86. #define BYTE_DES_SHA_2048 2
  87. #define BYTE_3DES_MD5_2048 3
  88. #define BYTE_3DES_SHA_2048 4
  89. typedef struct _IsakmpPolicy {
  90. GUID PolicyId;
  91. BOOL IdentityProtectionRequired;
  92. BOOL PfsIdentityRequired;
  93. DWORD dwFlags;
  94. BYTE bLeadingBundleFlags[4];
  95. DWORD dwQMLimit;
  96. DWORD dwLifetimeSec;
  97. DWORD dwUnused[5];
  98. } ISAKMP_POLICY, *PISAKMP_POLICY;
  99. typedef struct _SpiPair {
  100. SPI Inbound;
  101. SPI Outbound;
  102. } SPI_PAIR, *PSPI_PAIR;
  103. typedef struct _CookiePair {
  104. COOKIE Initiator;
  105. COOKIE Responder;
  106. } COOKIE_PAIR, *PCOOKIE_PAIR;
  107. typedef struct _IsakmpSa {
  108. GUID PolicyId;
  109. COOKIE_PAIR Spi;
  110. IPADDR Me;
  111. IPADDR Peer;
  112. BOOL IdentityProtectionUsed;
  113. BOOL PerfectForwardSecrecyUsed;
  114. CRYPTO_BUNDLE CryptoSelected;
  115. OAKLEY_STATE CurrentState;
  116. } ISAKMP_SA, *PISAKMP_SA;
  117. typedef struct _IpsecSa {
  118. GUID PolicyId;
  119. SPI_PAIR Spi;
  120. IPADDR Source;
  121. IPADDR Destination;
  122. IPADDR Tunnel;
  123. OAKLEY_ALGORITHM ConfidentialityAlgorithm;
  124. OAKLEY_ALGORITHM IntegrityAlgorithm;
  125. OAKLEY_STATE CurrentState;
  126. } IPSEC_SA, *PIPSEC_SA;
  127. typedef struct _IPSEC_ALGO_INFO {
  128. ULONG algoIdentifier; // ESP_ALGO or AH_ALGO
  129. ULONG secondaryAlgoIdentifier; // for hmac in ESP case
  130. ULONG operation; // of type OPERATION_E (ipsec.h)
  131. ULONG algoKeylen; // len in bytes
  132. ULONG algoRounds; // # of algo rounds
  133. } IPSEC_ALGO_INFO, *PIPSEC_ALGO_INFO;
  134. typedef struct {
  135. LIFETIME Lifetime;
  136. DWORD Flags;
  137. BOOL PfsQMRequired;
  138. DWORD Count; //Number of Algos
  139. IPSEC_ALGO_INFO Algos[MAX_ALGOS];
  140. } IPSEC_ALG_TYPE, *PIPSEC_ALG_TYPE;
  141. typedef enum _AuthenicationEnum {
  142. OAK_PRESHARED_KEY = 1,
  143. OAK_DSS_SIGNATURE = 2,
  144. OAK_RSA_SIGNATURE = 3,
  145. OAK_RSA_ENCRYPTION = 4,
  146. OAK_SSPI = 5
  147. }AuthenticationEnum ;
  148. typedef struct _SA_FAIL_INFO {
  149. GUID PolicyId;
  150. IPSEC_FILTER Filter;
  151. DWORD Status;
  152. DWORD Flags;
  153. } SA_FAIL_INFO;
  154. typedef struct _IPSEC_AUTH_INFO
  155. {
  156. AuthenticationEnum AuthMethod;
  157. wchar_t *AuthInfo;
  158. DWORD AuthInfoSize;
  159. } IPSEC_AUTH_INFO, *PIPSEC_AUTH_INFO;
  160. #endif /* __OAKRPC */