mbed TLS v2.0.0
camellia.h
Go to the documentation of this file.
1 
24 #ifndef MBEDTLS_CAMELLIA_H
25 #define MBEDTLS_CAMELLIA_H
26 
27 #if !defined(MBEDTLS_CONFIG_FILE)
28 #include "config.h"
29 #else
30 #include MBEDTLS_CONFIG_FILE
31 #endif
32 
33 #include <stddef.h>
34 #include <stdint.h>
35 
36 #define MBEDTLS_CAMELLIA_ENCRYPT 1
37 #define MBEDTLS_CAMELLIA_DECRYPT 0
38 
39 #define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0024
40 #define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
42 #if !defined(MBEDTLS_CAMELLIA_ALT)
43 // Regular implementation
44 //
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
53 typedef struct
54 {
55  int nr;
56  uint32_t rk[68];
57 }
59 
66 
73 
83 int mbedtls_camellia_setkey_enc( mbedtls_camellia_context *ctx, const unsigned char *key,
84  unsigned int keybits );
85 
95 int mbedtls_camellia_setkey_dec( mbedtls_camellia_context *ctx, const unsigned char *key,
96  unsigned int keybits );
97 
109  int mode,
110  const unsigned char input[16],
111  unsigned char output[16] );
112 
113 #if defined(MBEDTLS_CIPHER_MODE_CBC)
114 
138  int mode,
139  size_t length,
140  unsigned char iv[16],
141  const unsigned char *input,
142  unsigned char *output );
143 #endif /* MBEDTLS_CIPHER_MODE_CBC */
144 
145 #if defined(MBEDTLS_CIPHER_MODE_CFB)
146 
173  int mode,
174  size_t length,
175  size_t *iv_off,
176  unsigned char iv[16],
177  const unsigned char *input,
178  unsigned char *output );
179 #endif /* MBEDTLS_CIPHER_MODE_CFB */
180 
181 #if defined(MBEDTLS_CIPHER_MODE_CTR)
182 
205  size_t length,
206  size_t *nc_off,
207  unsigned char nonce_counter[16],
208  unsigned char stream_block[16],
209  const unsigned char *input,
210  unsigned char *output );
211 #endif /* MBEDTLS_CIPHER_MODE_CTR */
212 
213 #ifdef __cplusplus
214 }
215 #endif
216 
217 #else /* MBEDTLS_CAMELLIA_ALT */
218 #include "camellia_alt.h"
219 #endif /* MBEDTLS_CAMELLIA_ALT */
220 
221 #ifdef __cplusplus
222 extern "C" {
223 #endif
224 
230 int mbedtls_camellia_self_test( int verbose );
231 
232 #ifdef __cplusplus
233 }
234 #endif
235 
236 #endif /* camellia.h */
int mbedtls_camellia_crypt_ecb(mbedtls_camellia_context *ctx, int mode, const unsigned char input[16], unsigned char output[16])
CAMELLIA-ECB block encryption/decryption.
int mbedtls_camellia_self_test(int verbose)
Checkup routine.
void mbedtls_camellia_free(mbedtls_camellia_context *ctx)
Clear CAMELLIA context.
Compatibility names (set of defines)
int mbedtls_camellia_crypt_cfb128(mbedtls_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.
int mbedtls_camellia_setkey_enc(mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
CAMELLIA key schedule (encryption)
int mbedtls_camellia_setkey_dec(mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
CAMELLIA key schedule (decryption)
int mbedtls_camellia_crypt_ctr(mbedtls_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.
void mbedtls_camellia_init(mbedtls_camellia_context *ctx)
Initialize CAMELLIA context.
int mbedtls_camellia_crypt_cbc(mbedtls_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) ...
CAMELLIA context structure.
Definition: camellia.h:53