PolarSSL v1.3.7
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 
78 int camellia_setkey_enc( camellia_context *ctx, const unsigned char *key,
79  unsigned int keysize );
80 
90 int camellia_setkey_dec( camellia_context *ctx, const unsigned char *key,
91  unsigned int keysize );
92 
104  int mode,
105  const unsigned char input[16],
106  unsigned char output[16] );
107 
108 #if defined(POLARSSL_CIPHER_MODE_CBC)
109 
125  int mode,
126  size_t length,
127  unsigned char iv[16],
128  const unsigned char *input,
129  unsigned char *output );
130 #endif /* POLARSSL_CIPHER_MODE_CBC */
131 
132 #if defined(POLARSSL_CIPHER_MODE_CFB)
133 
152  int mode,
153  size_t length,
154  size_t *iv_off,
155  unsigned char iv[16],
156  const unsigned char *input,
157  unsigned char *output );
158 #endif /* POLARSSL_CIPHER_MODE_CFB */
159 
160 #if defined(POLARSSL_CIPHER_MODE_CTR)
161 
184  size_t length,
185  size_t *nc_off,
186  unsigned char nonce_counter[16],
187  unsigned char stream_block[16],
188  const unsigned char *input,
189  unsigned char *output );
190 #endif /* POLARSSL_CIPHER_MODE_CTR */
191 
192 #ifdef __cplusplus
193 }
194 #endif
195 
196 #else /* POLARSSL_CAMELLIA_ALT */
197 #include "camellia_alt.h"
198 #endif /* POLARSSL_CAMELLIA_ALT */
199 
200 #ifdef __cplusplus
201 extern "C" {
202 #endif
203 
209 int camellia_self_test( int verbose );
210 
211 #ifdef __cplusplus
212 }
213 #endif
214 
215 #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:62
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)