PolarSSL v1.3.8
camellia.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_CAMELLIA_H
28 #define POLARSSL_CAMELLIA_H
29 
30 #if !defined(POLARSSL_CONFIG_FILE)
31 #include "config.h"
32 #else
33 #include POLARSSL_CONFIG_FILE
34 #endif
35 
36 #include <string.h>
37 
38 #if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
39 #include <basetsd.h>
40 typedef UINT32 uint32_t;
41 #else
42 #include <inttypes.h>
43 #endif
44 
45 #define CAMELLIA_ENCRYPT 1
46 #define CAMELLIA_DECRYPT 0
47 
48 #define POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0024
49 #define POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
51 #if !defined(POLARSSL_CAMELLIA_ALT)
52 // Regular implementation
53 //
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
62 typedef struct
63 {
64  int nr;
65  uint32_t rk[68];
66 }
68 
74 void camellia_init( camellia_context *ctx );
75 
81 void camellia_free( camellia_context *ctx );
82 
92 int camellia_setkey_enc( camellia_context *ctx, const unsigned char *key,
93  unsigned int keysize );
94 
104 int camellia_setkey_dec( camellia_context *ctx, const unsigned char *key,
105  unsigned int keysize );
106 
118  int mode,
119  const unsigned char input[16],
120  unsigned char output[16] );
121 
122 #if defined(POLARSSL_CIPHER_MODE_CBC)
123 
139  int mode,
140  size_t length,
141  unsigned char iv[16],
142  const unsigned char *input,
143  unsigned char *output );
144 #endif /* POLARSSL_CIPHER_MODE_CBC */
145 
146 #if defined(POLARSSL_CIPHER_MODE_CFB)
147 
166  int mode,
167  size_t length,
168  size_t *iv_off,
169  unsigned char iv[16],
170  const unsigned char *input,
171  unsigned char *output );
172 #endif /* POLARSSL_CIPHER_MODE_CFB */
173 
174 #if defined(POLARSSL_CIPHER_MODE_CTR)
175 
198  size_t length,
199  size_t *nc_off,
200  unsigned char nonce_counter[16],
201  unsigned char stream_block[16],
202  const unsigned char *input,
203  unsigned char *output );
204 #endif /* POLARSSL_CIPHER_MODE_CTR */
205 
206 #ifdef __cplusplus
207 }
208 #endif
209 
210 #else /* POLARSSL_CAMELLIA_ALT */
211 #include "camellia_alt.h"
212 #endif /* POLARSSL_CAMELLIA_ALT */
213 
214 #ifdef __cplusplus
215 extern "C" {
216 #endif
217 
223 int camellia_self_test( int verbose );
224 
225 #ifdef __cplusplus
226 }
227 #endif
228 
229 #endif /* camellia.h */