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.

122 lines
2.8 KiB

  1. #include "precomp.h"
  2. ULONG IPSecNumResets = 0;
  3. #if DBG
  4. ULONG NumAddSA = 0;
  5. ULONG NumAddSU = 0;
  6. ULONG NumAddFA = 0;
  7. ULONG NumDelSA = 0;
  8. ULONG NumDelSU = 0;
  9. ULONG NumDelFA = 0;
  10. ULONG NumReset = 0;
  11. ULONG NumAddEncapSA = 0;
  12. ULONG NumAddEncapSU = 0;
  13. ULONG NumAddEncapFA = 0;
  14. ULONG NumDelEncapSA = 0;
  15. ULONG NumDelEncapSU = 0;
  16. ULONG NumDelEncapFA = 0;
  17. #endif
  18. //
  19. // Max timeout value (in seconds) for each class.
  20. //
  21. ULONG IPSecMaxTimerValue[IPSEC_CLASS_MAX] = {
  22. IPSEC_MAX_TIMER_SHORT_DURATION,
  23. IPSEC_MAX_TIMER_LONG_DURATION,
  24. IPSEC_MAX_TIMER_SUPER_LONG_DURATION
  25. };
  26. //
  27. // Size of each timer wheel.
  28. //
  29. ULONG IPSecTimerListSize[IPSEC_CLASS_MAX] = {
  30. SECONDS_TO_SHORT_TICKS(IPSEC_MAX_TIMER_SHORT_DURATION),
  31. SECONDS_TO_LONG_TICKS(IPSEC_MAX_TIMER_LONG_DURATION),
  32. SECONDS_TO_SUPER_LONG_TICKS(IPSEC_MAX_TIMER_SUPER_LONG_DURATION)
  33. };
  34. //
  35. // Interval between ticks, in seconds, for each class.
  36. //
  37. ULONG IPSecTimerPeriod[IPSEC_CLASS_MAX] = {
  38. IPSEC_SHORT_DURATION_TIMER_PERIOD,
  39. IPSEC_LONG_DURATION_TIMER_PERIOD,
  40. IPSEC_SUPER_LONG_DURATION_TIMER_PERIOD
  41. };
  42. #if GPC
  43. ULONG DebugGPC = 0;
  44. #endif
  45. #if DBG
  46. ULONG IPSecDebug = 0;
  47. #endif
  48. UCHAR DefaultPad[MAX_PAD_LEN] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
  49. #if DBG
  50. IPAddr DebugSrc = 0;
  51. IPAddr DebugDst = 0;
  52. UCHAR DebugPro = 0;
  53. ULONG DebugPkt = 0;
  54. ULONG DebugOff = 0;
  55. ULONG DebugQry = 1;
  56. #endif
  57. RC4_KEYSTRUCT IPSecRngKey;
  58. WORK_QUEUE_ITEM IPSecRngQueueItem;
  59. ULONG IPSecRngBytes = 0;
  60. #if DBG
  61. ULONG IPSecRngInRekey = 0;
  62. #endif
  63. unsigned char weak_keys[][DES_BLOCKLEN] = {
  64. /* the weak keys */
  65. { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 },
  66. { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
  67. { 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f },
  68. { 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0 },
  69. /* the semi-weak keys */
  70. { 0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe },
  71. { 0x1f, 0xe0, 0x1f, 0xe0, 0x1f, 0xe0, 0x1f, 0xe0 },
  72. { 0x01, 0xe0, 0x01, 0xe0, 0x01, 0xe0, 0x01, 0xe0 },
  73. { 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe },
  74. { 0x01, 0x1f, 0x01, 0x1f, 0x01, 0x1f, 0x01, 0x1f },
  75. { 0xe0, 0xfe, 0xe0, 0xfe, 0xe0, 0xfe, 0xe0, 0xfe },
  76. { 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01 },
  77. { 0xe0, 0x1f, 0xe0, 0x1f, 0xe0, 0x1f, 0xe0, 0x1f },
  78. { 0xe0, 0x01, 0xe0, 0x01, 0xe0, 0x01, 0xe0, 0x01 },
  79. { 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f },
  80. { 0x1f, 0x01, 0x1f, 0x01, 0x1f, 0x01, 0x1f, 0x01 },
  81. { 0xfe, 0xe0, 0xfe, 0xe0, 0xfe, 0xe0, 0xfe, 0xe0 }
  82. };
  83. PDEVICE_OBJECT IPSecDevice = NULL;
  84. ULONG IPSecInitFlag = 0;
  85. IPSEC_GLOBAL g_ipsec;
  86. LARGE_INTEGER IPSecDelayInterval;
  87. DWORD gdwInitEsp = 0;
  88. DWORD gdwInitAh = 0;
  89. PPARSER_IFENTRY gpParserIfEntry = NULL;