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.

camellia.h 3.2 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright 2006-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_CAMELLIA_H
  10. #define OPENSSL_CAMELLIA_H
  11. #pragma once
  12. #include <openssl/macros.h>
  13. #ifndef OPENSSL_NO_DEPRECATED_3_0
  14. #define HEADER_CAMELLIA_H
  15. #endif
  16. #include <openssl/opensslconf.h>
  17. #ifndef OPENSSL_NO_CAMELLIA
  18. #include <stddef.h>
  19. #ifdef __cplusplus
  20. extern "C"
  21. {
  22. #endif
  23. #define CAMELLIA_BLOCK_SIZE 16
  24. #ifndef OPENSSL_NO_DEPRECATED_3_0
  25. #define CAMELLIA_ENCRYPT 1
  26. #define CAMELLIA_DECRYPT 0
  27. /*
  28. * Because array size can't be a const in C, the following two are macros.
  29. * Both sizes are in bytes.
  30. */
  31. /* This should be a hidden type, but EVP requires that the size be known */
  32. #define CAMELLIA_TABLE_BYTE_LEN 272
  33. #define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4)
  34. typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match
  35. * with WORD */
  36. struct camellia_key_st
  37. {
  38. union
  39. {
  40. double d; /* ensures 64-bit align */
  41. KEY_TABLE_TYPE rd_key;
  42. } u;
  43. int grand_rounds;
  44. };
  45. typedef struct camellia_key_st CAMELLIA_KEY;
  46. #endif /* OPENSSL_NO_DEPRECATED_3_0 */
  47. #ifndef OPENSSL_NO_DEPRECATED_3_0
  48. OSSL_DEPRECATEDIN_3_0 int Camellia_set_key(const unsigned char* userKey, const int bits, CAMELLIA_KEY* key);
  49. OSSL_DEPRECATEDIN_3_0 void Camellia_encrypt(const unsigned char* in, unsigned char* out, const CAMELLIA_KEY* key);
  50. OSSL_DEPRECATEDIN_3_0 void Camellia_decrypt(const unsigned char* in, unsigned char* out, const CAMELLIA_KEY* key);
  51. OSSL_DEPRECATEDIN_3_0 void Camellia_ecb_encrypt(const unsigned char* in, unsigned char* out, const CAMELLIA_KEY* key, const int enc);
  52. OSSL_DEPRECATEDIN_3_0 void Camellia_cbc_encrypt(const unsigned char* in, unsigned char* out, size_t length, const CAMELLIA_KEY* key, unsigned char* ivec, const int enc);
  53. OSSL_DEPRECATEDIN_3_0 void Camellia_cfb128_encrypt(const unsigned char* in, unsigned char* out, size_t length, const CAMELLIA_KEY* key, unsigned char* ivec, int* num, const int enc);
  54. OSSL_DEPRECATEDIN_3_0 void Camellia_cfb1_encrypt(const unsigned char* in, unsigned char* out, size_t length, const CAMELLIA_KEY* key, unsigned char* ivec, int* num, const int enc);
  55. OSSL_DEPRECATEDIN_3_0 void Camellia_cfb8_encrypt(const unsigned char* in, unsigned char* out, size_t length, const CAMELLIA_KEY* key, unsigned char* ivec, int* num, const int enc);
  56. OSSL_DEPRECATEDIN_3_0 void Camellia_ofb128_encrypt(const unsigned char* in, unsigned char* out, size_t length, const CAMELLIA_KEY* key, unsigned char* ivec, int* num);
  57. OSSL_DEPRECATEDIN_3_0
  58. void Camellia_ctr128_encrypt(const unsigned char* in, unsigned char* out, size_t length, const CAMELLIA_KEY* key, unsigned char ivec[CAMELLIA_BLOCK_SIZE], unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], unsigned int* num);
  59. #endif
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63. #endif
  64. #endif