PolarSSL v1.3.3
camellia.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_CAMELLIA_H
28 #define POLARSSL_CAMELLIA_H
29 
30 #include "config.h"
31 
32 #include <string.h>
33 
34 #if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
35 #include <basetsd.h>
36 typedef UINT32 uint32_t;
37 #else
38 #include <inttypes.h>
39 #endif
40 
41 #define CAMELLIA_ENCRYPT 1
42 #define CAMELLIA_DECRYPT 0
43 
44 #define POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0024
45 #define POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
47 #if !defined(POLARSSL_CAMELLIA_ALT)
48 // Regular implementation
49 //
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
58 typedef struct
59 {
60  int nr;
61  uint32_t rk[68];
62 }
64 
74 int camellia_setkey_enc( camellia_context *ctx, const unsigned char *key, unsigned int keysize );
75 
85 int camellia_setkey_dec( camellia_context *ctx, const unsigned char *key, unsigned int keysize );
86 
98  int mode,
99  const unsigned char input[16],
100  unsigned char output[16] );
101 
102 #if defined(POLARSSL_CIPHER_MODE_CBC)
103 
118  int mode,
119  size_t length,
120  unsigned char iv[16],
121  const unsigned char *input,
122  unsigned char *output );
123 #endif /* POLARSSL_CIPHER_MODE_CBC */
124 
125 #if defined(POLARSSL_CIPHER_MODE_CFB)
126 
144  int mode,
145  size_t length,
146  size_t *iv_off,
147  unsigned char iv[16],
148  const unsigned char *input,
149  unsigned char *output );
150 #endif /* POLARSSL_CIPHER_MODE_CFB */
151 
152 #if defined(POLARSSL_CIPHER_MODE_CTR)
153 
176  size_t length,
177  size_t *nc_off,
178  unsigned char nonce_counter[16],
179  unsigned char stream_block[16],
180  const unsigned char *input,
181  unsigned char *output );
182 #endif /* POLARSSL_CIPHER_MODE_CTR */
183 
184 #ifdef __cplusplus
185 }
186 #endif
187 
188 #else /* POLARSSL_CAMELLIA_ALT */
189 #include "camellia_alt.h"
190 #endif /* POLARSSL_CAMELLIA_ALT */
191 
192 #ifdef __cplusplus
193 extern "C" {
194 #endif
195 
201 int camellia_self_test( int verbose );
202 
203 #ifdef __cplusplus
204 }
205 #endif
206 
207 #endif /* camellia.h */
int camellia_crypt_cbc(camellia_context *ctx, int mode, size_t length, unsigned char iv[16], const unsigned char *input, unsigned char *output)
CAMELLIA-CBC buffer encryption/decryption Length should be a multiple of the block size (16 bytes) ...
Configuration options (set of defines)
int camellia_setkey_enc(camellia_context *ctx, const unsigned char *key, unsigned int keysize)
CAMELLIA key schedule (encryption)
int camellia_crypt_ctr(camellia_context *ctx, size_t length, size_t *nc_off, unsigned char nonce_counter[16], unsigned char stream_block[16], const unsigned char *input, unsigned char *output)
CAMELLIA-CTR buffer encryption/decryption.
int camellia_self_test(int verbose)
Checkup routine.
int camellia_crypt_cfb128(camellia_context *ctx, int mode, size_t length, size_t *iv_off, unsigned char iv[16], const unsigned char *input, unsigned char *output)
CAMELLIA-CFB128 buffer encryption/decryption.
CAMELLIA context structure.
Definition: camellia.h:58
int camellia_crypt_ecb(camellia_context *ctx, int mode, const unsigned char input[16], unsigned char output[16])
CAMELLIA-ECB block encryption/decryption.
int camellia_setkey_dec(camellia_context *ctx, const unsigned char *key, unsigned int keysize)
CAMELLIA key schedule (decryption)