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
2.1 KiB

  1. #ifndef __RC2_H__
  2. #define __RC2_H__
  3. #ifndef RSA32API
  4. #define RSA32API __stdcall
  5. #endif
  6. /* Copyright (C) RSA Data Security, Inc. created 1990. This is an
  7. unpublished work protected as such under copyright law. This work
  8. contains proprietary, confidential, and trade secret information of
  9. RSA Data Security, Inc. Use, disclosure or reproduction without the
  10. express written authorization of RSA Data Security, Inc. is
  11. prohibited.
  12. */
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. /* Actual table size to use */
  17. #define RC2_TABLESIZE 128
  18. /* number of bytes in an RC2 block */
  19. #define RC2_BLOCKLEN 8
  20. /* RC2Key()
  21. *
  22. * Generate the key control structure. Key can be any size.
  23. *
  24. * Parameters:
  25. * pwKT Pointer to a key table that will be initialized.
  26. * MUST be RC2_TABLESIZE.
  27. * pbKey Pointer to the key.
  28. * dwLen Size of the key, in bytes.
  29. * MUST be <= RC2_TABLESIZE.
  30. *
  31. * MTS: Assumes pwKT is locked against simultaneous use.
  32. */
  33. int
  34. RSA32API
  35. RC2Key (
  36. WORD *pwKT,
  37. BYTE *pbKey,
  38. DWORD dwLen
  39. );
  40. /* RC2KeyEx()
  41. *
  42. * Generate the key control structure. Key can be any size.
  43. *
  44. * Parameters:
  45. * pwKT Pointer to a key table that will be initialized.
  46. * MUST be RC2_TABLESIZE.
  47. * pbKey Pointer to the key.
  48. * dwLen Size of the key, in bytes.
  49. * MUST be <= RC2_TABLESIZE.
  50. * eSpace effective key space in bits, 0 < n <= 1024
  51. *
  52. * MTS: Assumes pwKT is locked against simultaneous use.
  53. */
  54. int
  55. RSA32API
  56. RC2KeyEx (
  57. WORD *keyTable,
  58. BYTE *key,
  59. DWORD keyLen,
  60. DWORD eSpace
  61. );
  62. /* RC2()
  63. *
  64. * Performs the actual encryption
  65. *
  66. * Parameters:
  67. *
  68. * pbIn Input buffer -- MUST be RC2_BLOCKLEN
  69. * pbOut Output buffer -- MUST be RC2_BLOCKLEN
  70. * pwKT Pointer to an initialized (by RC2Key) key table.
  71. * op ENCRYPT, or DECRYPT
  72. *
  73. * MTS: Assumes pwKT is locked against simultaneous use.
  74. */
  75. void RSA32API RC2 (BYTE *pbIn, BYTE *pbOut, void *pwKT, int op);
  76. #ifdef __cplusplus
  77. }
  78. #endif
  79. #endif // __RC2_H__