cast.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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_CAST_H
  10. # define HEADER_CAST_H
  11. # include <openssl/opensslconf.h>
  12. # ifndef OPENSSL_NO_CAST
  13. # ifdef __cplusplus
  14. extern "C" {
  15. # endif
  16. # define CAST_ENCRYPT 1
  17. # define CAST_DECRYPT 0
  18. # define CAST_LONG unsigned int
  19. # define CAST_BLOCK 8
  20. # define CAST_KEY_LENGTH 16
  21. typedef struct cast_key_st {
  22. CAST_LONG data[32];
  23. int short_key; /* Use reduced rounds for short key */
  24. } CAST_KEY;
  25. void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data);
  26. void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out,
  27. const CAST_KEY *key, int enc);
  28. void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key);
  29. void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key);
  30. void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out,
  31. long length, const CAST_KEY *ks, unsigned char *iv,
  32. int enc);
  33. void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out,
  34. long length, const CAST_KEY *schedule,
  35. unsigned char *ivec, int *num, int enc);
  36. void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out,
  37. long length, const CAST_KEY *schedule,
  38. unsigned char *ivec, int *num);
  39. # ifdef __cplusplus
  40. }
  41. # endif
  42. # endif
  43. #endif