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.

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