diff options
Diffstat (limited to 'src/lib/libcrypto/camellia/camellia.h')
-rw-r--r-- | src/lib/libcrypto/camellia/camellia.h | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/src/lib/libcrypto/camellia/camellia.h b/src/lib/libcrypto/camellia/camellia.h index b8a8b6e10b..cf0457dd97 100644 --- a/src/lib/libcrypto/camellia/camellia.h +++ b/src/lib/libcrypto/camellia/camellia.h | |||
@@ -58,6 +58,8 @@ | |||
58 | #error CAMELLIA is disabled. | 58 | #error CAMELLIA is disabled. |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | #include <stddef.h> | ||
62 | |||
61 | #define CAMELLIA_ENCRYPT 1 | 63 | #define CAMELLIA_ENCRYPT 1 |
62 | #define CAMELLIA_DECRYPT 0 | 64 | #define CAMELLIA_DECRYPT 0 |
63 | 65 | ||
@@ -74,24 +76,18 @@ extern "C" { | |||
74 | #define CAMELLIA_TABLE_BYTE_LEN 272 | 76 | #define CAMELLIA_TABLE_BYTE_LEN 272 |
75 | #define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) | 77 | #define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) |
76 | 78 | ||
77 | /* to match with WORD */ | 79 | typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match with WORD */ |
78 | typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; | ||
79 | 80 | ||
80 | struct camellia_key_st | 81 | struct camellia_key_st |
81 | { | 82 | { |
82 | KEY_TABLE_TYPE rd_key; | 83 | union { |
83 | int bitLength; | 84 | double d; /* ensures 64-bit align */ |
84 | void (*enc)(const unsigned int *subkey, unsigned int *io); | 85 | KEY_TABLE_TYPE rd_key; |
85 | void (*dec)(const unsigned int *subkey, unsigned int *io); | 86 | } u; |
87 | int grand_rounds; | ||
86 | }; | 88 | }; |
87 | |||
88 | typedef struct camellia_key_st CAMELLIA_KEY; | 89 | typedef struct camellia_key_st CAMELLIA_KEY; |
89 | 90 | ||
90 | #ifdef OPENSSL_FIPS | ||
91 | int private_Camellia_set_key(const unsigned char *userKey, const int bits, | ||
92 | CAMELLIA_KEY *key); | ||
93 | #endif | ||
94 | |||
95 | int Camellia_set_key(const unsigned char *userKey, const int bits, | 91 | int Camellia_set_key(const unsigned char *userKey, const int bits, |
96 | CAMELLIA_KEY *key); | 92 | CAMELLIA_KEY *key); |
97 | 93 | ||
@@ -103,25 +99,22 @@ void Camellia_decrypt(const unsigned char *in, unsigned char *out, | |||
103 | void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out, | 99 | void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out, |
104 | const CAMELLIA_KEY *key, const int enc); | 100 | const CAMELLIA_KEY *key, const int enc); |
105 | void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out, | 101 | void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out, |
106 | const unsigned long length, const CAMELLIA_KEY *key, | 102 | size_t length, const CAMELLIA_KEY *key, |
107 | unsigned char *ivec, const int enc); | 103 | unsigned char *ivec, const int enc); |
108 | void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out, | 104 | void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out, |
109 | const unsigned long length, const CAMELLIA_KEY *key, | 105 | size_t length, const CAMELLIA_KEY *key, |
110 | unsigned char *ivec, int *num, const int enc); | 106 | unsigned char *ivec, int *num, const int enc); |
111 | void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out, | 107 | void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out, |
112 | const unsigned long length, const CAMELLIA_KEY *key, | 108 | size_t length, const CAMELLIA_KEY *key, |
113 | unsigned char *ivec, int *num, const int enc); | 109 | unsigned char *ivec, int *num, const int enc); |
114 | void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out, | 110 | void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out, |
115 | const unsigned long length, const CAMELLIA_KEY *key, | 111 | size_t length, const CAMELLIA_KEY *key, |
116 | unsigned char *ivec, int *num, const int enc); | 112 | unsigned char *ivec, int *num, const int enc); |
117 | void Camellia_cfbr_encrypt_block(const unsigned char *in,unsigned char *out, | ||
118 | const int nbits,const CAMELLIA_KEY *key, | ||
119 | unsigned char *ivec,const int enc); | ||
120 | void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, | 113 | void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, |
121 | const unsigned long length, const CAMELLIA_KEY *key, | 114 | size_t length, const CAMELLIA_KEY *key, |
122 | unsigned char *ivec, int *num); | 115 | unsigned char *ivec, int *num); |
123 | void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, | 116 | void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, |
124 | const unsigned long length, const CAMELLIA_KEY *key, | 117 | size_t length, const CAMELLIA_KEY *key, |
125 | unsigned char ivec[CAMELLIA_BLOCK_SIZE], | 118 | unsigned char ivec[CAMELLIA_BLOCK_SIZE], |
126 | unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], | 119 | unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], |
127 | unsigned int *num); | 120 | unsigned int *num); |
@@ -131,4 +124,3 @@ void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, | |||
131 | #endif | 124 | #endif |
132 | 125 | ||
133 | #endif /* !HEADER_Camellia_H */ | 126 | #endif /* !HEADER_Camellia_H */ |
134 | |||