You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright 1995-2020 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. {
  21. #endif
  22. #define RC5_32_BLOCK 8
  23. #define RC5_32_KEY_LENGTH 16 /* This is a default, max is 255 */
  24. #ifndef OPENSSL_NO_DEPRECATED_3_0
  25. #define RC5_ENCRYPT 1
  26. #define RC5_DECRYPT 0
  27. #define RC5_32_INT unsigned int
  28. /*
  29. * This are the only values supported. Tweak the code if you want more The
  30. * most supported modes will be RC5-32/12/16 RC5-32/16/8
  31. */
  32. #define RC5_8_ROUNDS 8
  33. #define RC5_12_ROUNDS 12
  34. #define RC5_16_ROUNDS 16
  35. typedef struct rc5_key_st
  36. {
  37. /* Number of rounds */
  38. int rounds;
  39. RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)];
  40. } RC5_32_KEY;
  41. #endif
  42. #ifndef OPENSSL_NO_DEPRECATED_3_0
  43. OSSL_DEPRECATEDIN_3_0 int RC5_32_set_key(RC5_32_KEY* key, int len, const unsigned char* data, int rounds);
  44. OSSL_DEPRECATEDIN_3_0 void RC5_32_ecb_encrypt(const unsigned char* in, unsigned char* out, RC5_32_KEY* key, int enc);
  45. OSSL_DEPRECATEDIN_3_0 void RC5_32_encrypt(unsigned long* data, RC5_32_KEY* key);
  46. OSSL_DEPRECATEDIN_3_0 void RC5_32_decrypt(unsigned long* data, RC5_32_KEY* key);
  47. OSSL_DEPRECATEDIN_3_0 void RC5_32_cbc_encrypt(const unsigned char* in, unsigned char* out, long length, RC5_32_KEY* ks, unsigned char* iv, int enc);
  48. OSSL_DEPRECATEDIN_3_0 void RC5_32_cfb64_encrypt(const unsigned char* in, unsigned char* out, long length, RC5_32_KEY* schedule, unsigned char* ivec, int* num, int enc);
  49. OSSL_DEPRECATEDIN_3_0 void RC5_32_ofb64_encrypt(const unsigned char* in, unsigned char* out, long length, RC5_32_KEY* schedule, unsigned char* ivec, int* num);
  50. #endif
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif
  55. #endif