mbed TLS v1.3.14
camellia.h
Go to the documentation of this file.
1 
24 #ifndef POLARSSL_CAMELLIA_H
25 #define POLARSSL_CAMELLIA_H
26 
27 #if !defined(POLARSSL_CONFIG_FILE)
28 #include "config.h"
29 #else
30 #include POLARSSL_CONFIG_FILE
31 #endif
32 
33 #include <stddef.h>
34 
35 #if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
36 #include <basetsd.h>
37 typedef UINT32 uint32_t;
38 #else
39 #include <inttypes.h>
40 #endif
41 
42 #define CAMELLIA_ENCRYPT 1
43 #define CAMELLIA_DECRYPT 0
44 
45 #define POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0024
46 #define POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
48 #if !defined(POLARSSL_CAMELLIA_ALT)
49 // Regular implementation
50 //
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
59 typedef struct
60 {
61  int nr;
62  uint32_t rk[68];
63 }
65 
71 void camellia_init( camellia_context *ctx );
72 
78 void camellia_free( camellia_context *ctx );
79 
89 int camellia_setkey_enc( camellia_context *ctx, const unsigned char *key,
90  unsigned int keysize );
91 
101 int camellia_setkey_dec( camellia_context *ctx, const unsigned char *key,
102  unsigned int keysize );
103 
115  int mode,
116  const unsigned char input[16],
117  unsigned char output[16] );
118 
119 #if defined(POLARSSL_CIPHER_MODE_CBC)
120 
144  int mode,
145  size_t length,
146  unsigned char iv[16],
147  const unsigned char *input,
148  unsigned char *output );
149 #endif /* POLARSSL_CIPHER_MODE_CBC */
150 
151 #if defined(POLARSSL_CIPHER_MODE_CFB)
152 
179  int mode,
180  size_t length,
181  size_t *iv_off,
182  unsigned char iv[16],
183  const unsigned char *input,
184  unsigned char *output );
185 #endif /* POLARSSL_CIPHER_MODE_CFB */
186 
187 #if defined(POLARSSL_CIPHER_MODE_CTR)
188 
211  size_t length,
212  size_t *nc_off,
213  unsigned char nonce_counter[16],
214  unsigned char stream_block[16],
215  const unsigned char *input,
216  unsigned char *output );
217 #endif /* POLARSSL_CIPHER_MODE_CTR */
218 
219 #ifdef __cplusplus
220 }
221 #endif
222 
223 #else /* POLARSSL_CAMELLIA_ALT */
224 #include "camellia_alt.h"
225 #endif /* POLARSSL_CAMELLIA_ALT */
226 
227 #ifdef __cplusplus
228 extern "C" {
229 #endif
230 
236 int camellia_self_test( int verbose );
237 
238 #ifdef __cplusplus
239 }
240 #endif
241 
242 #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.
void camellia_init(camellia_context *ctx)
Initialize CAMELLIA context.
CAMELLIA context structure.
Definition: camellia.h:59
void camellia_free(camellia_context *ctx)
Clear CAMELLIA context.
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)