mbed TLS v2.2.0
camellia.h
Go to the documentation of this file.
1 
23 #ifndef MBEDTLS_CAMELLIA_H
24 #define MBEDTLS_CAMELLIA_H
25 
26 #if !defined(MBEDTLS_CONFIG_FILE)
27 #include "config.h"
28 #else
29 #include MBEDTLS_CONFIG_FILE
30 #endif
31 
32 #include <stddef.h>
33 #include <stdint.h>
34 
35 #define MBEDTLS_CAMELLIA_ENCRYPT 1
36 #define MBEDTLS_CAMELLIA_DECRYPT 0
37 
38 #define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0024
39 #define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
41 #if !defined(MBEDTLS_CAMELLIA_ALT)
42 // Regular implementation
43 //
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
52 typedef struct
53 {
54  int nr;
55  uint32_t rk[68];
56 }
58 
65 
72 
82 int mbedtls_camellia_setkey_enc( mbedtls_camellia_context *ctx, const unsigned char *key,
83  unsigned int keybits );
84 
94 int mbedtls_camellia_setkey_dec( mbedtls_camellia_context *ctx, const unsigned char *key,
95  unsigned int keybits );
96 
108  int mode,
109  const unsigned char input[16],
110  unsigned char output[16] );
111 
112 #if defined(MBEDTLS_CIPHER_MODE_CBC)
113 
136 int mbedtls_camellia_crypt_cbc( mbedtls_camellia_context *ctx,
137  int mode,
138  size_t length,
139  unsigned char iv[16],
140  const unsigned char *input,
141  unsigned char *output );
142 #endif /* MBEDTLS_CIPHER_MODE_CBC */
143 
144 #if defined(MBEDTLS_CIPHER_MODE_CFB)
145 
171 int mbedtls_camellia_crypt_cfb128( mbedtls_camellia_context *ctx,
172  int mode,
173  size_t length,
174  size_t *iv_off,
175  unsigned char iv[16],
176  const unsigned char *input,
177  unsigned char *output );
178 #endif /* MBEDTLS_CIPHER_MODE_CFB */
179 
180 #if defined(MBEDTLS_CIPHER_MODE_CTR)
181 
203 int mbedtls_camellia_crypt_ctr( mbedtls_camellia_context *ctx,
204  size_t length,
205  size_t *nc_off,
206  unsigned char nonce_counter[16],
207  unsigned char stream_block[16],
208  const unsigned char *input,
209  unsigned char *output );
210 #endif /* MBEDTLS_CIPHER_MODE_CTR */
211 
212 #ifdef __cplusplus
213 }
214 #endif
215 
216 #else /* MBEDTLS_CAMELLIA_ALT */
217 #include "camellia_alt.h"
218 #endif /* MBEDTLS_CAMELLIA_ALT */
219 
220 #ifdef __cplusplus
221 extern "C" {
222 #endif
223 
229 int mbedtls_camellia_self_test( int verbose );
230 
231 #ifdef __cplusplus
232 }
233 #endif
234 
235 #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_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)
void mbedtls_camellia_init(mbedtls_camellia_context *ctx)
Initialize CAMELLIA context.
CAMELLIA context structure.
Definition: camellia.h:52