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.

53 lines
1.1 KiB

  1. #ifndef __RC4_H__
  2. #define __RC4_H__
  3. #ifndef RSA32API
  4. #define RSA32API __stdcall
  5. #endif
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. /* Key structure */
  10. #if defined(_WIN64) && !defined(MIDL_PASS)
  11. __declspec(align(8))
  12. #endif
  13. typedef struct RC4_KEYSTRUCT
  14. {
  15. unsigned char S[256]; /* State table */
  16. unsigned char i,j; /* Indices */
  17. } RC4_KEYSTRUCT;
  18. /* rc4_key()
  19. *
  20. * Generate the key control structure. Key can be any size.
  21. *
  22. * Parameters:
  23. * Key A KEYSTRUCT structure that will be initialized.
  24. * dwLen Size of the key, in bytes.
  25. * pbKey Pointer to the key.
  26. *
  27. * MTS: Assumes pKS is locked against simultaneous use.
  28. */
  29. void RSA32API rc4_key(struct RC4_KEYSTRUCT *pKS, unsigned int dwLen, unsigned char *pbKey);
  30. /* rc4()
  31. *
  32. * Performs the actual encryption
  33. *
  34. * Parameters:
  35. *
  36. * pKS Pointer to the KEYSTRUCT created using rc4_key().
  37. * dwLen Size of buffer, in bytes.
  38. * pbuf Buffer to be encrypted.
  39. *
  40. * MTS: Assumes pKS is locked against simultaneous use.
  41. */
  42. void RSA32API rc4(struct RC4_KEYSTRUCT *pKS, unsigned int dwLen, unsigned char *pbuf);
  43. #ifdef __cplusplus
  44. }
  45. #endif
  46. #endif // __RC4_H__