Source code of Windows XP (NT5)
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.

221 lines
4.5 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. typedef struct _IsakmpPolicy {
  85. GUID PolicyId;
  86. BOOL IdentityProtectionRequired;
  87. BOOL PfsIdentityRequired;
  88. DWORD ThreadingFactor;
  89. DWORD AcquireLimit;
  90. DWORD ReceiveLimit;
  91. DWORD AcquireSize;
  92. DWORD ReceiveSize;
  93. DWORD ReaperInterval;
  94. DWORD RpcMaxCalls;
  95. DWORD RetryInterval;
  96. DWORD RetryLimit;
  97. } ISAKMP_POLICY, *PISAKMP_POLICY;
  98. typedef struct {
  99. GUID PolicyId;
  100. DWORD Version;
  101. DWORD RefreshInterval;
  102. IPADDR TunnelAddress;
  103. BOOL PfsQMRequired;
  104. } IPSEC_POLICY, *PIPSEC_POLICY;
  105. typedef struct _SpiPair {
  106. SPI Inbound;
  107. SPI Outbound;
  108. } SPI_PAIR, *PSPI_PAIR;
  109. typedef struct _CookiePair {
  110. COOKIE Initiator;
  111. COOKIE Responder;
  112. } COOKIE_PAIR, *PCOOKIE_PAIR;
  113. typedef struct _IsakmpSa {
  114. GUID PolicyId;
  115. COOKIE_PAIR Spi;
  116. IPADDR Me;
  117. IPADDR Peer;
  118. BOOL IdentityProtectionUsed;
  119. BOOL PerfectForwardSecrecyUsed;
  120. CRYPTO_BUNDLE CryptoSelected;
  121. OAKLEY_STATE CurrentState;
  122. } ISAKMP_SA, *PISAKMP_SA;
  123. typedef struct _IpsecSa {
  124. GUID PolicyId;
  125. SPI_PAIR Spi;
  126. IPADDR Source;
  127. IPADDR Destination;
  128. IPADDR Tunnel;
  129. OAKLEY_ALGORITHM ConfidentialityAlgorithm;
  130. OAKLEY_ALGORITHM IntegrityAlgorithm;
  131. OAKLEY_STATE CurrentState;
  132. } IPSEC_SA, *PIPSEC_SA;
  133. typedef struct _IPSEC_ALGO_INFO {
  134. ULONG algoIdentifier; // ESP_ALGO or AH_ALGO
  135. ULONG secondaryAlgoIdentifier; // for hmac in ESP case
  136. ULONG operation; // of type OPERATION_E (ipsec.h)
  137. ULONG algoKeylen; // len in bytes
  138. ULONG algoRounds; // # of algo rounds
  139. } IPSEC_ALGO_INFO, *PIPSEC_ALGO_INFO;
  140. typedef struct {
  141. LIFETIME Lifetime;
  142. DWORD Flags;
  143. BOOL PfsQMRequired;
  144. DWORD Count; //Number of Algos
  145. IPSEC_ALGO_INFO Algos[MAX_ALGOS];
  146. } IPSEC_ALG_TYPE, *PIPSEC_ALG_TYPE;
  147. typedef enum _AuthenicationEnum {
  148. OAK_PRESHARED_KEY = 1,
  149. OAK_DSS_SIGNATURE = 2,
  150. OAK_RSA_SIGNATURE = 3,
  151. OAK_RSA_ENCRYPTION = 4,
  152. OAK_SSPI = 5
  153. }AuthenticationEnum ;
  154. typedef struct _SA_FAIL_INFO {
  155. GUID PolicyId;
  156. IPSEC_FILTER Filter;
  157. DWORD Status;
  158. DWORD Flags;
  159. } SA_FAIL_INFO;
  160. typedef struct _IPSEC_AUTH_INFO
  161. {
  162. AuthenticationEnum AuthMethod;
  163. wchar_t *AuthInfo;
  164. DWORD AuthInfoSize;
  165. } IPSEC_AUTH_INFO, *PIPSEC_AUTH_INFO;
  166. #endif /* __OAKRPC */