rc4.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef RC4_H
  2. #define RC4_H
  3. #include "wm_crypto_hard.h"
  4. void Arc4Init(psCipherContext_t *ctx, unsigned char *key, uint32 keylen);
  5. int32 Arc4_skip(psCipherContext_t *ctx, unsigned char *in,
  6. unsigned char *out, size_t skip, uint32 len);
  7. /**
  8. * rc4_skip - XOR RC4 stream to given data with skip-stream-start
  9. * @key: RC4 key
  10. * @keylen: RC4 key length
  11. * @skip: number of bytes to skip from the beginning of the RC4 stream
  12. * @data: data to be XOR'ed with RC4 stream
  13. * @data_len: buf length
  14. * Returns: 0 on success, -1 on failure
  15. *
  16. * Generate RC4 pseudo random stream for the given key, skip beginning of the
  17. * stream, and XOR the end result with the data buffer to perform RC4
  18. * encryption/decryption.
  19. */
  20. int rc4_skip(const u8 *key, size_t keylen, size_t skip,
  21. u8 *data, size_t data_len);
  22. /**
  23. * rc4 - XOR RC4 stream to given data with skip-stream-start
  24. * @key: RC4 key
  25. * @keylen: RC4 key length
  26. * @data: data to be XOR'ed with RC4 stream
  27. * @data_len: buf length
  28. * Returns: 0 on success, -1 on failure
  29. *
  30. * Generate RC4 pseudo random stream for the given key, skip beginning of the
  31. * stream, and XOR the end result with the data buffer to perform RC4
  32. * encryption/decryption.
  33. */
  34. int rc4(const u8 *key, size_t keylen, u8 *data, size_t data_len);
  35. #endif /* end of RC4_H */