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.

115 lines
4.1 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 2000
  3. Module Name:
  4. LimitTest1
  5. Abstract:
  6. This file provides the static data structures used to declare National Key
  7. Length Limits, modified for specific testing requirements.
  8. Author:
  9. Doug Barlow (dbarlow) 2/2/2000
  10. Notes:
  11. ?Notes?
  12. --*/
  13. #ifndef WIN32_LEAN_AND_MEAN
  14. #define WIN32_LEAN_AND_MEAN
  15. #endif
  16. #include <windows.h>
  17. #include <limits.h>
  18. #include <wincrypt.h>
  19. #include <keylimit.h>
  20. // #define KEYLIMIT_API __declspec(dllexport)
  21. #define KEYLIMIT_API
  22. // Shorthand notation
  23. #define PCT CRYPTLIMIT_USING_PCT
  24. #define SGC CRYPTLIMIT_USING_SGC
  25. #define PCT_SGC (PCT | SGC)
  26. //
  27. // Add country-specific limit arrays here. These lists will be referenced in
  28. // the locale array, below.
  29. //
  30. /* Here's an example:
  31. static KEYLIMIT_LIMITS FranceLimits[] =
  32. { // Add algorithmic limits here.
  33. //Algorithm Minimum Maximum Required Disallowed
  34. // Id Key Key Flags Flags
  35. //---------------------- ------- ------- -------- ----------
  36. { ALG_CLASS_SIGNATURE, 0, ULONG_MAX, 0, 0 },
  37. { ALG_CLASS_KEY_EXCHANGE, 0, ULONG_MAX, 0, 0 },
  38. { ALG_CLASS_MSG_ENCRYPT, 0, 128, 0, PCT },
  39. { ALG_CLASS_DATA_ENCRYPT, 0, 128, 0, PCT },
  40. { ALG_CLASS_MSG_ENCRYPT, 0, 40, 0, 0 },
  41. { ALG_CLASS_DATA_ENCRYPT, 0, 40, 0, 0 },
  42. { ALG_CLASS_HASH, 0, ULONG_MAX, 0, 0 },
  43. // This entry terminates the list, and disallows any other algId.
  44. { 0, 0, 0, 0, 0 }
  45. };
  46. */
  47. /* Small subset of interesting flags and keysize combinations */
  48. static KEYLIMIT_LIMITS FranceLimits[] =
  49. {
  50. //Algorithm Minimum Maximum Required Disallowed
  51. // Id Key Key Flags Flags
  52. //---------------------- ------- ------- -------- ----------
  53. { ALG_CLASS_SIGNATURE, 1024, ULONG_MAX, 0, 0 },
  54. { ALG_CLASS_KEY_EXCHANGE, 0, ULONG_MAX, 0, 0 },
  55. { ALG_CLASS_MSG_ENCRYPT, 0, 128, PCT, 0 },
  56. { ALG_CLASS_MSG_ENCRYPT, 0, 40, 0, 0 },
  57. { ALG_CLASS_DATA_ENCRYPT, 56, 128, SGC, 0 },
  58. { ALG_CLASS_DATA_ENCRYPT, 0, 40, 0, 0 },
  59. { ALG_CLASS_HASH, 0, ULONG_MAX, 0, 0 },
  60. // This entry terminates the list, and disallows any other algId.
  61. { 0, 0, 0, 0, 0 }
  62. };
  63. /* hashing enabled, plus weak encryption */
  64. static KEYLIMIT_LIMITS ChinaLimits[] =
  65. {
  66. //Algorithm Minimum Maximum Required Disallowed
  67. // Id Key Key Flags Flags
  68. //---------------------- ------- ------- -------- ----------
  69. { ALG_CLASS_SIGNATURE, 0, 512, 0, 0 },
  70. { ALG_CLASS_KEY_EXCHANGE, 0, 512, 0, 0 },
  71. { ALG_CLASS_MSG_ENCRYPT, 0, 40, 0, 0 },
  72. { ALG_CLASS_DATA_ENCRYPT, 0, 40, 0, 0 },
  73. { ALG_CLASS_HASH, 0, ULONG_MAX, 0, 0 },
  74. // This entry terminates the list, and disallows any other algId.
  75. { 0, 0, 0, 0, 0 }
  76. };
  77. //
  78. // This is the local array. It is the actual exported structure.
  79. //
  80. KEYLIMIT_API KEYLIMIT_LOCALE g_LimitsList[] =
  81. { // Add National Limit structures here.
  82. /* Here's an example:
  83. { CTRY_FRANCE, MAKELANGID(LANG_FRENCH ,SUBLANG_FRENCH), FranceLimits },
  84. */
  85. { CTRY_FRANCE, MAKELANGID(LANG_FRENCH, SUBLANG_FRENCH), FranceLimits },
  86. { CTRY_PRCHINA, MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), ChinaLimits },
  87. // This entry terminates the list.
  88. { 0, 0, NULL }
  89. };