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.

556 lines
22 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 2000
  3. Module Name:
  4. locpolicy
  5. Abstract:
  6. This module provides the local policy tables used for algorithm strength
  7. control in this CSP.
  8. Author:
  9. Doug Barlow (dbarlow) 8/11/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 <wincrypt.h>
  18. #include <cspdk.h>
  19. #include <scp.h>
  20. #include <contman.h>
  21. #include <ntagimp1.h>
  22. #include <sha.h>
  23. #include <nt_rsa.h>
  24. #include <md4.h>
  25. #include <md5.h>
  26. #include <policy.h>
  27. #define SUPPORTED_PROTOCOLS \
  28. CRYPT_FLAG_PCT1 | CRYPT_FLAG_SSL2 | CRYPT_FLAG_SSL3 | CRYPT_FLAG_TLS1
  29. #define AlgNm(alg) (sizeof(alg) / sizeof(TCHAR)), TEXT(alg)
  30. #define MD2LEN (MD2DIGESTLEN * 8)
  31. #define MD4LEN (MD4DIGESTLEN * 8)
  32. #define MD5LEN (MD5DIGESTLEN * 8)
  33. #define SHALEN (A_SHA_DIGEST_LEN * 8)
  34. #define SHAMD5LEN ((MD5DIGESTLEN + A_SHA_DIGEST_LEN) * 8)
  35. #ifndef MAXHASHLEN
  36. #define MAXHASHLEN SHAMD5LEN
  37. #endif
  38. #define MAC_MIN_LEN 0
  39. #define MAC_WEAK_LEN 0
  40. #define MAC_WEAK_MAX 0
  41. #define MAC_STRONG_LEN 0
  42. #define MAC_MAX_LEN 0
  43. #define HMAC_MIN_LEN 0
  44. #define HMAC_WEAK_LEN 0
  45. #define HMAC_WEAK_MAX 0
  46. #define HMAC_STRONG_LEN 0
  47. #define HMAC_MAX_LEN 0
  48. #define RC2_MIN_LEN 40
  49. #define RC2_WEAK_LEN 40
  50. #define RC2_WEAK_MAX 56
  51. #define RC2_STRONG_LEN 128
  52. #define RC2_MAX_LEN 128
  53. #define RC4_MIN_LEN 40
  54. #define RC4_WEAK_LEN 40
  55. #define RC4_WEAK_MAX 56
  56. #define RC4_STRONG_LEN 128
  57. #define RC4_MAX_LEN 128
  58. #define DES_MIN_LEN 56
  59. #define DES_WEAK_LEN 56
  60. #define DES_WEAK_MAX 56
  61. #define DES_STRONG_LEN 56
  62. #define DES_MAX_LEN 56
  63. #define RSAS_MIN_LEN 384
  64. #define RSAS_WEAK_LEN 512
  65. #define RSAS_WEAK_MAX 16384
  66. #define RSAS_STRONG_LEN 1024
  67. #define RSAS_MAX_LEN 16384
  68. #define RSAX_MIN_LEN 384
  69. #define RSAX_WEAK_LEN 512
  70. #define RSAX_WEAK_MAX 1024
  71. #define RSAX_STRONG_LEN 1024
  72. #define RSAX_MAX_LEN 16384
  73. #ifndef TLS1_MASTER_KEYSIZE
  74. #define TLS1_MASTER_KEYSIZE SSL3_MASTER_KEYSIZE
  75. #endif
  76. #define PCT1_MASTER_MIN_LEN PCT1_MASTER_KEYSIZE * 8
  77. #define PCT1_MASTER_DEF_LEN PCT1_MASTER_KEYSIZE * 8
  78. #define PCT1_MASTER_MAX_LEN PCT1_MASTER_KEYSIZE * 8
  79. #define SSL2_MASTER_MIN_LEN 40
  80. #define SSL2_MASTER_DEF_LEN SSL2_MASTER_KEYSIZE * 8
  81. #define SSL2_MASTER_MAX_LEN SSL2_MAX_MASTER_KEYSIZE * 8
  82. #define SSL3_MASTER_MIN_LEN SSL3_MASTER_KEYSIZE * 8
  83. #define SSL3_MASTER_DEF_LEN SSL3_MASTER_KEYSIZE * 8
  84. #define SSL3_MASTER_MAX_LEN SSL3_MASTER_KEYSIZE * 8
  85. #define TLS1_MASTER_MIN_LEN TLS1_MASTER_KEYSIZE * 8
  86. #define TLS1_MASTER_DEF_LEN TLS1_MASTER_KEYSIZE * 8
  87. #define TLS1_MASTER_MAX_LEN TLS1_MASTER_KEYSIZE * 8
  88. // check for the maximum hash length greater than the mod length
  89. #if RSAS_MIN_LEN < MAXHASHLEN
  90. #error "RSAS_MIN_LEN must be greater than or equal to MAXHASHLEN"
  91. #endif
  92. //
  93. /////////////////////////////////////////////////////////////////////////////
  94. //
  95. // The following tables define the minimum, default, and maximum key lengths
  96. // supported by the CSP. There are four tables, representing each
  97. // incarnation of the CSP:
  98. //
  99. // * Microsoft Base Cryptographic Provider v1.0
  100. // * Microsoft Strong Cryptographic Provider
  101. // * Microsoft Enhanced Cryptographic Provider v1.0
  102. // * Microsoft RSA SChannel Cryptographic Provider
  103. // * A yet unnamed Signature Only CSP
  104. //
  105. // Tables are built from the PROV_ENUMALGS_EX structure defined in
  106. // wincrypt.h.
  107. //
  108. PROV_ENUMALGS_EX g_RsaBasePolicy[] = {
  109. // Algorithm Default Minimum Maximum Supported
  110. // Id Length Length Length Protocols
  111. // --------- ------- ------- ------- ---------
  112. // Simple Long
  113. // Name Name
  114. // --------- -------
  115. #ifdef CSP_USE_RC2
  116. { CALG_RC2, RC2_WEAK_LEN, RC2_MIN_LEN, RC2_WEAK_MAX, 0,
  117. AlgNm("RC2"), AlgNm("RSA Data Security's RC2") },
  118. #endif
  119. #ifdef CSP_USE_RC4
  120. { CALG_RC4, RC4_WEAK_LEN, RC4_MIN_LEN, RC4_WEAK_MAX, 0,
  121. AlgNm("RC4"), AlgNm("RSA Data Security's RC4") },
  122. #endif
  123. #ifdef CSP_USE_DES
  124. { CALG_DES, DES_WEAK_LEN, DES_MIN_LEN, DES_WEAK_MAX, 0,
  125. AlgNm("DES"), AlgNm("Data Encryption Standard (DES)") },
  126. #endif
  127. #ifdef CSP_USE_SHA
  128. { CALG_SHA, SHALEN, SHALEN, SHALEN, CRYPT_FLAG_SIGNING,
  129. AlgNm("SHA-1"), AlgNm("Secure Hash Algorithm (SHA-1)") },
  130. #endif
  131. #ifdef CSP_USE_MD2
  132. { CALG_MD2, MD2LEN, MD2LEN, MD2LEN, CRYPT_FLAG_SIGNING,
  133. AlgNm("MD2"), AlgNm("Message Digest 2 (MD2)") },
  134. #endif
  135. #ifdef CSP_USE_MD4
  136. { CALG_MD4, MD4LEN, MD4LEN, MD4LEN, CRYPT_FLAG_SIGNING,
  137. AlgNm("MD4"), AlgNm("Message Digest 4 (MD4)") },
  138. #endif
  139. #ifdef CSP_USE_MD5
  140. { CALG_MD5, MD5LEN, MD5LEN, MD5LEN, CRYPT_FLAG_SIGNING,
  141. AlgNm("MD5"), AlgNm("Message Digest 5 (MD5)") },
  142. #endif
  143. { CALG_SSL3_SHAMD5,
  144. SHAMD5LEN, SHAMD5LEN, SHAMD5LEN, 0,
  145. AlgNm("SSL3 SHAMD5"), AlgNm("SSL3 SHAMD5") },
  146. #ifdef CSP_USE_MAC
  147. { CALG_MAC, MAC_WEAK_LEN, MAC_MIN_LEN, MAC_WEAK_MAX, 0,
  148. AlgNm("MAC"), AlgNm("Message Authentication Code") },
  149. #endif
  150. { CALG_RSA_SIGN,
  151. RSAS_WEAK_LEN, RSAS_MIN_LEN, RSAS_WEAK_MAX, CRYPT_FLAG_IPSEC | CRYPT_FLAG_SIGNING,
  152. AlgNm("RSA_SIGN"), AlgNm("RSA Signature") },
  153. { CALG_RSA_KEYX,
  154. RSAX_WEAK_LEN, RSAX_MIN_LEN, RSAX_WEAK_MAX, CRYPT_FLAG_IPSEC | CRYPT_FLAG_SIGNING,
  155. AlgNm("RSA_KEYX"), AlgNm("RSA Key Exchange") },
  156. { CALG_HMAC, HMAC_WEAK_LEN, HMAC_MIN_LEN, HMAC_WEAK_MAX, 0,
  157. AlgNm("HMAC"), AlgNm("Hugo's MAC (HMAC)") },
  158. // List Terminator
  159. { 0, 0, 0, 0, 0,
  160. 0, 0, 0, 0 } };
  161. PROV_ENUMALGS_EX g_RsaStrongPolicy[] = {
  162. // Algorithm Default Minimum Maximum Supported
  163. // Id Length Length Length Protocols
  164. // --------- ------- ------- ------- ---------
  165. // Simple Long
  166. // Name Name
  167. // --------- -------
  168. #ifdef CSP_USE_RC2
  169. { CALG_RC2, RC2_MAX_LEN, RC2_MIN_LEN, RC2_MAX_LEN, 0,
  170. AlgNm("RC2"), AlgNm("RSA Data Security's RC2") },
  171. #endif
  172. #ifdef CSP_USE_RC4
  173. { CALG_RC4, RC4_MAX_LEN, RC4_MIN_LEN, RC4_MAX_LEN, 0,
  174. AlgNm("RC4"), AlgNm("RSA Data Security's RC4") },
  175. #endif
  176. #ifdef CSP_USE_DES
  177. { CALG_DES, DES_WEAK_LEN, DES_MIN_LEN, DES_MAX_LEN, 0,
  178. AlgNm("DES"), AlgNm("Data Encryption Standard (DES)") },
  179. #endif
  180. #ifdef CSP_USE_3DES
  181. { CALG_3DES_112,
  182. DES_WEAK_LEN * 2,
  183. DES_MIN_LEN * 2,
  184. DES_MAX_LEN * 2,
  185. 0,
  186. AlgNm("3DES TWO KEY"), AlgNm("Two Key Triple DES") },
  187. { CALG_3DES, DES_WEAK_LEN * 3,
  188. DES_MIN_LEN * 3,
  189. 168,
  190. 0,
  191. AlgNm("3DES"), AlgNm("Three Key Triple DES") },
  192. #endif
  193. #ifdef CSP_USE_SHA
  194. { CALG_SHA, SHALEN, SHALEN, SHALEN, CRYPT_FLAG_SIGNING,
  195. AlgNm("SHA-1"), AlgNm("Secure Hash Algorithm (SHA-1)") },
  196. #endif
  197. #ifdef CSP_USE_MD2
  198. { CALG_MD2, MD2LEN, MD2LEN, MD2LEN, CRYPT_FLAG_SIGNING,
  199. AlgNm("MD2"), AlgNm("Message Digest 2 (MD2)") },
  200. #endif
  201. #ifdef CSP_USE_MD4
  202. { CALG_MD4, MD4LEN, MD4LEN, MD4LEN, CRYPT_FLAG_SIGNING,
  203. AlgNm("MD4"), AlgNm("Message Digest 4 (MD4)") },
  204. #endif
  205. #ifdef CSP_USE_MD5
  206. { CALG_MD5, MD5LEN, MD5LEN, MD5LEN, CRYPT_FLAG_SIGNING,
  207. AlgNm("MD5"), AlgNm("Message Digest 5 (MD5)") },
  208. #endif
  209. { CALG_SSL3_SHAMD5,
  210. SHAMD5LEN, SHAMD5LEN, SHAMD5LEN, 0,
  211. AlgNm("SSL3 SHAMD5"), AlgNm("SSL3 SHAMD5") },
  212. #ifdef CSP_USE_MAC
  213. { CALG_MAC, MAC_WEAK_LEN, MAC_MIN_LEN, MAC_MAX_LEN, 0,
  214. AlgNm("MAC"), AlgNm("Message Authentication Code") },
  215. #endif
  216. { CALG_RSA_SIGN,
  217. RSAS_STRONG_LEN, RSAS_MIN_LEN, RSAS_MAX_LEN, CRYPT_FLAG_IPSEC | CRYPT_FLAG_SIGNING,
  218. AlgNm("RSA_SIGN"), AlgNm("RSA Signature") },
  219. { CALG_RSA_KEYX,
  220. RSAX_STRONG_LEN, RSAX_MIN_LEN, RSAX_MAX_LEN, CRYPT_FLAG_IPSEC | CRYPT_FLAG_SIGNING,
  221. AlgNm("RSA_KEYX"), AlgNm("RSA Key Exchange") },
  222. { CALG_HMAC, HMAC_WEAK_LEN, HMAC_MIN_LEN, HMAC_MAX_LEN, 0,
  223. AlgNm("HMAC"), AlgNm("Hugo's MAC (HMAC)") },
  224. // List Terminator
  225. { 0, 0, 0, 0, 0,
  226. 0, 0, 0, 0 } };
  227. PROV_ENUMALGS_EX g_RsaEnhPolicy[] = {
  228. // Algorithm Default Minimum Maximum Supported
  229. // Id Length Length Length Protocols
  230. // --------- ------- ------- ------- ---------
  231. // Simple Long
  232. // Name Name
  233. // --------- -------
  234. #ifdef CSP_USE_RC2
  235. { CALG_RC2, RC2_STRONG_LEN, RC2_MIN_LEN, RC2_MAX_LEN, 0,
  236. AlgNm("RC2"), AlgNm("RSA Data Security's RC2") },
  237. #endif
  238. #ifdef CSP_USE_RC4
  239. { CALG_RC4, RC4_STRONG_LEN, RC2_MIN_LEN, RC4_MAX_LEN, 0,
  240. AlgNm("RC4"), AlgNm("RSA Data Security's RC4") },
  241. #endif
  242. #ifdef CSP_USE_DES
  243. { CALG_DES, DES_STRONG_LEN, DES_MIN_LEN, DES_MAX_LEN, 0,
  244. AlgNm("DES"), AlgNm("Data Encryption Standard (DES)") },
  245. #endif
  246. #ifdef CSP_USE_3DES
  247. { CALG_3DES_112,
  248. DES_STRONG_LEN * 2,
  249. DES_MIN_LEN * 2,
  250. DES_MAX_LEN * 2,
  251. 0,
  252. AlgNm("3DES TWO KEY"), AlgNm("Two Key Triple DES") },
  253. { CALG_3DES,
  254. DES_STRONG_LEN * 3,
  255. DES_MIN_LEN * 3,
  256. DES_MAX_LEN * 3,
  257. 0,
  258. AlgNm("3DES"), AlgNm("Three Key Triple DES") },
  259. #endif
  260. #ifdef CSP_USE_SHA
  261. { CALG_SHA, SHALEN, SHALEN, SHALEN, CRYPT_FLAG_SIGNING,
  262. AlgNm("SHA-1"), AlgNm("Secure Hash Algorithm (SHA-1)") },
  263. #endif
  264. #ifdef CSP_USE_MD2
  265. { CALG_MD2, MD2LEN, MD2LEN, MD2LEN, CRYPT_FLAG_SIGNING,
  266. AlgNm("MD2"), AlgNm("Message Digest 2 (MD2)") },
  267. #endif
  268. #ifdef CSP_USE_MD4
  269. { CALG_MD4, MD4LEN, MD4LEN, MD4LEN, CRYPT_FLAG_SIGNING,
  270. AlgNm("MD4"), AlgNm("Message Digest 4 (MD4)") },
  271. #endif
  272. #ifdef CSP_USE_MD5
  273. { CALG_MD5, MD5LEN, MD5LEN, MD5LEN, CRYPT_FLAG_SIGNING,
  274. AlgNm("MD5"), AlgNm("Message Digest 5 (MD5)") },
  275. #endif
  276. { CALG_SSL3_SHAMD5,
  277. SHAMD5LEN, SHAMD5LEN, SHAMD5LEN, 0,
  278. AlgNm("SSL3 SHAMD5"), AlgNm("SSL3 SHAMD5") },
  279. #ifdef CSP_USE_MAC
  280. { CALG_MAC, MAC_STRONG_LEN, MAC_MIN_LEN, MAC_MAX_LEN, 0,
  281. AlgNm("MAC"), AlgNm("Message Authentication Code") },
  282. #endif
  283. { CALG_RSA_SIGN,
  284. RSAS_STRONG_LEN,
  285. RSAS_MIN_LEN, RSAS_MAX_LEN, CRYPT_FLAG_IPSEC | CRYPT_FLAG_SIGNING,
  286. AlgNm("RSA_SIGN"), AlgNm("RSA Signature") },
  287. { CALG_RSA_KEYX,
  288. RSAX_STRONG_LEN,
  289. RSAX_MIN_LEN, RSAX_MAX_LEN, CRYPT_FLAG_IPSEC | CRYPT_FLAG_SIGNING,
  290. AlgNm("RSA_KEYX"), AlgNm("RSA Key Exchange") },
  291. { CALG_HMAC, HMAC_STRONG_LEN,
  292. HMAC_MIN_LEN, HMAC_MAX_LEN, 0,
  293. AlgNm("HMAC"), AlgNm("Hugo's MAC (HMAC)") },
  294. // List Terminator
  295. { 0, 0, 0, 0, 0,
  296. 0, 0, 0, 0 } };
  297. PROV_ENUMALGS_EX g_RsaAesPolicy[] = {
  298. // Algorithm Default Minimum Maximum Supported
  299. // Id Length Length Length Protocols
  300. // --------- ------- ------- ------- ---------
  301. // Simple Long
  302. // Name Name
  303. // --------- -------
  304. #ifdef CSP_USE_RC2
  305. { CALG_RC2, RC2_STRONG_LEN, RC2_MIN_LEN, RC2_MAX_LEN, 0,
  306. AlgNm("RC2"), AlgNm("RSA Data Security's RC2") },
  307. #endif
  308. #ifdef CSP_USE_RC4
  309. { CALG_RC4, RC4_STRONG_LEN, RC2_MIN_LEN, RC4_MAX_LEN, 0,
  310. AlgNm("RC4"), AlgNm("RSA Data Security's RC4") },
  311. #endif
  312. #ifdef CSP_USE_DES
  313. { CALG_DES, DES_STRONG_LEN, DES_MIN_LEN, DES_MAX_LEN, 0,
  314. AlgNm("DES"), AlgNm("Data Encryption Standard (DES)") },
  315. #endif
  316. #ifdef CSP_USE_3DES
  317. { CALG_3DES_112,
  318. DES_STRONG_LEN * 2,
  319. DES_MIN_LEN * 2,
  320. DES_MAX_LEN * 2,
  321. 0,
  322. AlgNm("3DES TWO KEY"), AlgNm("Two Key Triple DES") },
  323. { CALG_3DES,
  324. DES_STRONG_LEN * 3,
  325. DES_MIN_LEN * 3,
  326. DES_MAX_LEN * 3,
  327. 0,
  328. AlgNm("3DES"), AlgNm("Three Key Triple DES") },
  329. #endif
  330. #ifdef CSP_USE_SHA
  331. { CALG_SHA, SHALEN, SHALEN, SHALEN, CRYPT_FLAG_SIGNING,
  332. AlgNm("SHA-1"), AlgNm("Secure Hash Algorithm (SHA-1)") },
  333. #endif
  334. #ifdef CSP_USE_MD2
  335. { CALG_MD2, MD2LEN, MD2LEN, MD2LEN, CRYPT_FLAG_SIGNING,
  336. AlgNm("MD2"), AlgNm("Message Digest 2 (MD2)") },
  337. #endif
  338. #ifdef CSP_USE_MD4
  339. { CALG_MD4, MD4LEN, MD4LEN, MD4LEN, CRYPT_FLAG_SIGNING,
  340. AlgNm("MD4"), AlgNm("Message Digest 4 (MD4)") },
  341. #endif
  342. #ifdef CSP_USE_MD5
  343. { CALG_MD5, MD5LEN, MD5LEN, MD5LEN, CRYPT_FLAG_SIGNING,
  344. AlgNm("MD5"), AlgNm("Message Digest 5 (MD5)") },
  345. #endif
  346. { CALG_SSL3_SHAMD5,
  347. SHAMD5LEN, SHAMD5LEN, SHAMD5LEN, 0,
  348. AlgNm("SSL3 SHAMD5"), AlgNm("SSL3 SHAMD5") },
  349. #ifdef CSP_USE_MAC
  350. { CALG_MAC, MAC_STRONG_LEN, MAC_MIN_LEN, MAC_MAX_LEN, 0,
  351. AlgNm("MAC"), AlgNm("Message Authentication Code") },
  352. #endif
  353. { CALG_RSA_SIGN,
  354. RSAS_STRONG_LEN,
  355. RSAS_MIN_LEN, RSAS_MAX_LEN, CRYPT_FLAG_IPSEC | CRYPT_FLAG_SIGNING,
  356. AlgNm("RSA_SIGN"), AlgNm("RSA Signature") },
  357. { CALG_RSA_KEYX,
  358. RSAX_STRONG_LEN,
  359. RSAX_MIN_LEN, RSAX_MAX_LEN, CRYPT_FLAG_IPSEC | CRYPT_FLAG_SIGNING,
  360. AlgNm("RSA_KEYX"), AlgNm("RSA Key Exchange") },
  361. { CALG_HMAC, HMAC_STRONG_LEN,
  362. HMAC_MIN_LEN, HMAC_MAX_LEN, 0,
  363. AlgNm("HMAC"), AlgNm("Hugo's MAC (HMAC)") },
  364. #ifdef CSP_USE_AES
  365. { CALG_AES_128,
  366. 128, 128, 128, 0,
  367. AlgNm("AES 128"), AlgNm("American Encryption Standard 128-bit") },
  368. { CALG_AES_192,
  369. 192, 192, 192, 0,
  370. AlgNm("AES 192"), AlgNm("American Encryption Standard 192-bit") },
  371. { CALG_AES_256,
  372. 256, 256, 256, 0,
  373. AlgNm("AES 256"), AlgNm("American Encryption Standard 256-bit") },
  374. #endif
  375. // List Terminator
  376. { 0, 0, 0, 0, 0,
  377. 0, 0, 0, 0 } };
  378. PROV_ENUMALGS_EX g_RsaSchPolicy[] = {
  379. // Algorithm Default Minimum Maximum Supported
  380. // Id Length Length Length Protocols
  381. // --------- ------- ------- ------- ---------
  382. // Simple Long
  383. // Name Name
  384. // --------- -------
  385. #ifdef CSP_USE_RC2
  386. { CALG_RC2, RC2_STRONG_LEN, RC2_MIN_LEN, RC2_MAX_LEN, SUPPORTED_PROTOCOLS,
  387. AlgNm("RC2"), AlgNm("RSA Data Security's RC2") },
  388. #endif
  389. #ifdef CSP_USE_RC4
  390. { CALG_RC4, RC4_STRONG_LEN, RC4_MIN_LEN, RC4_MAX_LEN, SUPPORTED_PROTOCOLS,
  391. AlgNm("RC4"), AlgNm("RSA Data Security's RC4") },
  392. #endif
  393. #ifdef CSP_USE_DES
  394. { CALG_DES, DES_STRONG_LEN, DES_MIN_LEN, DES_MAX_LEN, SUPPORTED_PROTOCOLS,
  395. AlgNm("DES"), AlgNm("Data Encryption Standard (DES)") },
  396. #endif
  397. #ifdef CSP_USE_3DES
  398. { CALG_3DES_112,
  399. DES_STRONG_LEN * 2,
  400. DES_MIN_LEN * 2,
  401. DES_MAX_LEN * 2,
  402. SUPPORTED_PROTOCOLS,
  403. AlgNm("3DES TWO KEY"), AlgNm("Two Key Triple DES") },
  404. { CALG_3DES,
  405. DES_STRONG_LEN * 3,
  406. DES_MIN_LEN * 3,
  407. DES_MAX_LEN * 3,
  408. SUPPORTED_PROTOCOLS,
  409. AlgNm("3DES"), AlgNm("Three Key Triple DES") },
  410. #endif
  411. #ifdef CSP_USE_SHA
  412. { CALG_SHA, SHALEN, SHALEN, SHALEN, SUPPORTED_PROTOCOLS | CRYPT_FLAG_SIGNING,
  413. AlgNm("SHA-1"), AlgNm("Secure Hash Algorithm (SHA-1)") },
  414. #endif
  415. #ifdef CSP_USE_MD5
  416. { CALG_MD5, MD5LEN, MD5LEN, MD5LEN, SUPPORTED_PROTOCOLS | CRYPT_FLAG_SIGNING,
  417. AlgNm("MD5"), AlgNm("Message Digest 5 (MD5)") },
  418. #endif
  419. { CALG_SSL3_SHAMD5,
  420. SHAMD5LEN, SHAMD5LEN, SHAMD5LEN, 0,
  421. AlgNm("SSL3 SHAMD5"), AlgNm("SSL3 SHAMD5") },
  422. #ifdef CSP_USE_MAC
  423. { CALG_MAC, MAC_STRONG_LEN, MAC_MIN_LEN, MAC_MAX_LEN, 0,
  424. AlgNm("MAC"), AlgNm("Message Authentication Code") },
  425. #endif
  426. { CALG_RSA_SIGN,
  427. RSAS_STRONG_LEN,
  428. RSAS_MIN_LEN, RSAS_MAX_LEN, SUPPORTED_PROTOCOLS | CRYPT_FLAG_SIGNING,
  429. AlgNm("RSA_SIGN"), AlgNm("RSA Signature") },
  430. { CALG_RSA_KEYX,
  431. RSAX_STRONG_LEN,
  432. RSAX_MIN_LEN, RSAX_MAX_LEN, SUPPORTED_PROTOCOLS | CRYPT_FLAG_SIGNING,
  433. AlgNm("RSA_KEYX"), AlgNm("RSA Key Exchange") },
  434. { CALG_HMAC, HMAC_STRONG_LEN,
  435. HMAC_MIN_LEN, HMAC_MAX_LEN, 0,
  436. AlgNm("HMAC"), AlgNm("Hugo's MAC (HMAC)") },
  437. { CALG_PCT1_MASTER,
  438. PCT1_MASTER_DEF_LEN,
  439. PCT1_MASTER_MIN_LEN,
  440. PCT1_MASTER_MAX_LEN,
  441. CRYPT_FLAG_PCT1,
  442. AlgNm("PCT1 MASTER"), AlgNm("PCT1 Master") },
  443. { CALG_SSL2_MASTER,
  444. SSL2_MASTER_DEF_LEN,
  445. SSL2_MASTER_MIN_LEN,
  446. SSL2_MASTER_MAX_LEN,
  447. CRYPT_FLAG_SSL2,
  448. AlgNm("SSL2 MASTER"), AlgNm("SSL2 Master") },
  449. { CALG_SSL3_MASTER,
  450. SSL3_MASTER_DEF_LEN,
  451. SSL3_MASTER_MIN_LEN,
  452. SSL3_MASTER_MAX_LEN,
  453. CRYPT_FLAG_SSL3,
  454. AlgNm("SSL3 MASTER"), AlgNm("SSL3 Master") },
  455. { CALG_TLS1_MASTER,
  456. TLS1_MASTER_DEF_LEN,
  457. TLS1_MASTER_MIN_LEN,
  458. TLS1_MASTER_MAX_LEN,
  459. CRYPT_FLAG_TLS1,
  460. AlgNm("TLS1 MASTER"), AlgNm("TLS1 Master") },
  461. { CALG_SCHANNEL_MASTER_HASH,
  462. 0, 0, (DWORD)(-1), 0,
  463. AlgNm("SCH MASTER HASH"), AlgNm("SChannel Master Hash") },
  464. { CALG_SCHANNEL_MAC_KEY,
  465. 0, 0, (DWORD)(-1), 0,
  466. AlgNm("SCH MAC KEY"), AlgNm("SChannel MAC Key") },
  467. { CALG_SCHANNEL_ENC_KEY,
  468. 0, 0, (DWORD)(-1), 0,
  469. AlgNm("SCH ENC KEY"), AlgNm("SChannel Encryption Key") },
  470. // List Terminator
  471. { 0, 0, 0, 0, 0,
  472. 0, 0, 0, 0 } };
  473. PROV_ENUMALGS_EX g_RsaSigPolicy[] = {
  474. // Algorithm Default Minimum Maximum Supported
  475. // Id Length Length Length Protocols
  476. // --------- ------- ------- ------- ---------
  477. // Simple Long
  478. // Name Name
  479. // --------- -------
  480. #ifdef CSP_USE_SHA
  481. { CALG_SHA, SHALEN, SHALEN, SHALEN, CRYPT_FLAG_SIGNING,
  482. AlgNm("SHA-1"), AlgNm("Secure Hash Algorithm (SHA-1)") },
  483. #endif
  484. #ifdef CSP_USE_MD2
  485. { CALG_MD2, MD2LEN, MD2LEN, MD2LEN, CRYPT_FLAG_SIGNING,
  486. AlgNm("MD2"), AlgNm("Message Digest 2 (MD2)") },
  487. #endif
  488. #ifdef CSP_USE_MD4
  489. { CALG_MD4, MD4LEN, MD4LEN, MD4LEN, CRYPT_FLAG_SIGNING,
  490. AlgNm("MD4"), AlgNm("Message Digest 4 (MD4)") },
  491. #endif
  492. #ifdef CSP_USE_MD5
  493. { CALG_MD5, MD5LEN, MD5LEN, MD5LEN, CRYPT_FLAG_SIGNING,
  494. AlgNm("MD5"), AlgNm("Message Digest 5 (MD5)") },
  495. #endif
  496. { CALG_SSL3_SHAMD5,
  497. SHAMD5LEN, SHAMD5LEN, SHAMD5LEN, 0,
  498. AlgNm("SSL3 SHAMD5"), AlgNm("SSL3 SHAMD5") },
  499. { CALG_RSA_SIGN,
  500. RSAS_STRONG_LEN,
  501. RSAS_MIN_LEN, RSAS_MAX_LEN, CRYPT_FLAG_SIGNING,
  502. AlgNm("RSA_SIGN"), AlgNm("RSA Signature") },
  503. // List Terminator
  504. { 0, 0, 0, 0, 0,
  505. 0, 0, 0, 0 } };
  506. //
  507. // The list of tables.
  508. //
  509. PROV_ENUMALGS_EX *g_AlgTables[] = {
  510. g_RsaBasePolicy, // Key length table for PROV_MS_DEF
  511. g_RsaStrongPolicy, // Key length table for PROV_MS_STRONG
  512. g_RsaEnhPolicy, // Key length table for PROV_MS_ENHANCED
  513. g_RsaSchPolicy, // Key length table for PROV_MS_SCHANNEL
  514. g_RsaSigPolicy, // Key length table for undefined signature only CSP
  515. g_RsaAesPolicy }; // Key length table for MS_ENH_RSA_AES_PROV