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.

91 lines
3.7 KiB

  1. // ALG_ID crackers
  2. #define GET_ALG_CLASS(x) (x & (3 << 14))
  3. #define GET_ALG_TYPE(x) (x & (15 << 10))
  4. #define GET_ALG_SID(x) (x & (511))
  5. // Algorithm classes
  6. //
  7. #define ALG_CLASS_SIGNATURE (0 << 14)
  8. #define ALG_CLASS_MSG_ENCRYPT (1 << 14)
  9. #define ALG_CLASS_DATA_ENCRYPT (2 << 14)
  10. #define ALG_CLASS_HASH (3 << 14)
  11. #define ALG_CLASS_KEY_EXCHANGE (4 << 14)
  12. // Algorithm types
  13. //
  14. #define ALG_TYPE_ANY (0)
  15. #define ALG_TYPE_DSA (1 << 10)
  16. #define ALG_TYPE_RSA (2 << 10)
  17. #define ALG_TYPE_BLOCK (3 << 10)
  18. #define ALG_TYPE_STREAM (4 << 10)
  19. // Some RSA sub-ids
  20. //
  21. #define ALG_SID_RSA_ANY 0
  22. #define ALG_SID_RSA_PKCS 1
  23. #define ALG_SID_RSA_MSATWORK 2
  24. #define ALG_SID_RSA_ENTRUST 3
  25. #define ALG_SID_RSA_PGP 4
  26. // Some DSS sub-ids
  27. //
  28. #define ALG_SID_DSS_ANY 0
  29. #define ALG_SID_DSS_PKCS 1
  30. #define ALG_SID_DSS_DMS 2
  31. // Block cipher sub ids
  32. // DES sub_ids
  33. #define ALG_SID_DES_ECB 0
  34. #define ALG_SID_DES_CBC 1
  35. #define ALG_SID_DES_CFB 2
  36. #define ALG_SID_DES_OFB 3
  37. // RC2 sub-ids
  38. #define ALG_SID_RC2_ECB 4
  39. #define ALG_SID_RC2_CBC 5
  40. #define ALG_SID_RC2_CFB 6
  41. #define ALG_SID_RC2_OFB 7
  42. // Stream cipher sub-ids
  43. #define ALG_SID_RC4 0
  44. #define ALG_SID_SEAL 1
  45. // Hash sub ids
  46. #define ALG_SID_MD2 0
  47. #define ALG_SID_MD4 1
  48. #define ALG_SID_MD5 2
  49. #define ALG_SID_SHA 3
  50. // Our example sub-id
  51. #define ALG_SID_EXAMPLE 80
  52. typedef int ALG_ID;
  53. #define MD2 ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD2
  54. #define MD4 ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD4
  55. #define MD5 ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD5
  56. #define SHA ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA
  57. #define RSA_SIGNATURE ALG_CLASS_SIGNATURE | ALG_TYPE_RSA | ALG_SID_RSA_ANY
  58. #define DSS_SIGNATURE ALG_CLASS_SIGNATURE | ALG_TYPE_DSA | ALG_SID_DSA_ANY
  59. #define RSA_KEYEXCHANGE ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_RSA | ALG_SID_RSA_ANY
  60. #define DES_ECB ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES_ECB
  61. #define DES_CBC ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES_CBC
  62. #define DES_CFB ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES_CFB
  63. #define DES_OFB ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES_OFB
  64. #define RC2_ECB ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2_ECB
  65. #define RC2_CBC ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2_CBC
  66. #define RC2_CFB ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2_CFB
  67. #define RC2_OFB ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2_OFB
  68. #define RC4 ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_RC4
  69. #define SEAL ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_SEAL
  70. #define MAXNAMELEN 0x60
  71. #define BASIC_RSA 0
  72. #define MD2_WITH_RSA 1
  73. #define MD5_WITH_RSA 2
  74. #define RC4_STREAM 3