rc5.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (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 OPENSSL_RC5_H
  10. # define OPENSSL_RC5_H
  11. # pragma once
  12. # include <openssl/macros.h>
  13. # ifndef OPENSSL_NO_DEPRECATED_3_0
  14. # define HEADER_RC5_H
  15. # endif
  16. # include <openssl/opensslconf.h>
  17. # ifndef OPENSSL_NO_RC5
  18. # ifdef __cplusplus
  19. extern "C" {
  20. # endif
  21. # define RC5_32_BLOCK 8
  22. # define RC5_32_KEY_LENGTH 16/* This is a default, max is 255 */
  23. # ifndef OPENSSL_NO_DEPRECATED_3_0
  24. # define RC5_ENCRYPT 1
  25. # define RC5_DECRYPT 0
  26. # define RC5_32_INT unsigned int
  27. /*
  28. * This are the only values supported. Tweak the code if you want more The
  29. * most supported modes will be RC5-32/12/16 RC5-32/16/8
  30. */
  31. # define RC5_8_ROUNDS 8
  32. # define RC5_12_ROUNDS 12
  33. # define RC5_16_ROUNDS 16
  34. typedef struct rc5_key_st {
  35. /* Number of rounds */
  36. int rounds;
  37. RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)];
  38. } RC5_32_KEY;
  39. # endif
  40. DEPRECATEDIN_3_0(int RC5_32_set_key(RC5_32_KEY *key, int len,
  41. const unsigned char *data, int rounds))
  42. DEPRECATEDIN_3_0(void RC5_32_ecb_encrypt(const unsigned char *in,
  43. unsigned char *out, RC5_32_KEY *key,
  44. int enc))
  45. DEPRECATEDIN_3_0(void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key))
  46. DEPRECATEDIN_3_0(void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key))
  47. DEPRECATEDIN_3_0(void RC5_32_cbc_encrypt(const unsigned char *in,
  48. unsigned char *out, long length,
  49. RC5_32_KEY *ks, unsigned char *iv,
  50. int enc))
  51. DEPRECATEDIN_3_0(void RC5_32_cfb64_encrypt(const unsigned char *in,
  52. unsigned char *out, long length,
  53. RC5_32_KEY *schedule,
  54. unsigned char *ivec, int *num,
  55. int enc))
  56. DEPRECATEDIN_3_0(void RC5_32_ofb64_encrypt(const unsigned char *in,
  57. unsigned char *out, long length,
  58. RC5_32_KEY *schedule,
  59. unsigned char *ivec, int *num))
  60. # ifdef __cplusplus
  61. }
  62. # endif
  63. # endif
  64. #endif