rc2.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the OpenSSL license (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #ifndef HEADER_RC2_H
  10. # define HEADER_RC2_H
  11. # include <openssl/opensslconf.h>
  12. # ifndef OPENSSL_NO_RC2
  13. # ifdef __cplusplus
  14. extern "C" {
  15. # endif
  16. typedef unsigned int RC2_INT;
  17. # define RC2_ENCRYPT 1
  18. # define RC2_DECRYPT 0
  19. # define RC2_BLOCK 8
  20. # define RC2_KEY_LENGTH 16
  21. typedef struct rc2_key_st {
  22. RC2_INT data[64];
  23. } RC2_KEY;
  24. void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits);
  25. void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out,
  26. RC2_KEY *key, int enc);
  27. void RC2_encrypt(unsigned long *data, RC2_KEY *key);
  28. void RC2_decrypt(unsigned long *data, RC2_KEY *key);
  29. void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
  30. RC2_KEY *ks, unsigned char *iv, int enc);
  31. void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out,
  32. long length, RC2_KEY *schedule, unsigned char *ivec,
  33. int *num, int enc);
  34. void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out,
  35. long length, RC2_KEY *schedule, unsigned char *ivec,
  36. int *num);
  37. # ifdef __cplusplus
  38. }
  39. # endif
  40. # endif
  41. #endif