idea.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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_IDEA_H
  10. # define HEADER_IDEA_H
  11. # include <openssl/opensslconf.h>
  12. # ifndef OPENSSL_NO_IDEA
  13. # ifdef __cplusplus
  14. extern "C" {
  15. # endif
  16. typedef unsigned int IDEA_INT;
  17. # define IDEA_ENCRYPT 1
  18. # define IDEA_DECRYPT 0
  19. # define IDEA_BLOCK 8
  20. # define IDEA_KEY_LENGTH 16
  21. typedef struct idea_key_st {
  22. IDEA_INT data[9][6];
  23. } IDEA_KEY_SCHEDULE;
  24. const char *IDEA_options(void);
  25. void IDEA_ecb_encrypt(const unsigned char *in, unsigned char *out,
  26. IDEA_KEY_SCHEDULE *ks);
  27. void IDEA_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks);
  28. void IDEA_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk);
  29. void IDEA_cbc_encrypt(const unsigned char *in, unsigned char *out,
  30. long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
  31. int enc);
  32. void IDEA_cfb64_encrypt(const unsigned char *in, unsigned char *out,
  33. long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
  34. int *num, int enc);
  35. void IDEA_ofb64_encrypt(const unsigned char *in, unsigned char *out,
  36. long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
  37. int *num);
  38. void IDEA_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks);
  39. # if OPENSSL_API_COMPAT < 0x10100000L
  40. # define idea_options IDEA_options
  41. # define idea_ecb_encrypt IDEA_ecb_encrypt
  42. # define idea_set_encrypt_key IDEA_set_encrypt_key
  43. # define idea_set_decrypt_key IDEA_set_decrypt_key
  44. # define idea_cbc_encrypt IDEA_cbc_encrypt
  45. # define idea_cfb64_encrypt IDEA_cfb64_encrypt
  46. # define idea_ofb64_encrypt IDEA_ofb64_encrypt
  47. # define idea_encrypt IDEA_encrypt
  48. # endif
  49. # ifdef __cplusplus
  50. }
  51. # endif
  52. # endif
  53. #endif