mbed TLS v2.3.0
camellia.h
Go to the documentation of this file.
1 
25 #ifndef MBEDTLS_CAMELLIA_H
26 #define MBEDTLS_CAMELLIA_H
27 
28 #if !defined(MBEDTLS_CONFIG_FILE)
29 #include "config.h"
30 #else
31 #include MBEDTLS_CONFIG_FILE
32 #endif
33 
34 #include <stddef.h>
35 #include <stdint.h>
36 
37 #define MBEDTLS_CAMELLIA_ENCRYPT 1
38 #define MBEDTLS_CAMELLIA_DECRYPT 0
39 
40 #define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0024
41 #define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
43 #if !defined(MBEDTLS_CAMELLIA_ALT)
44 // Regular implementation
45 //
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
54 typedef struct
55 {
56  int nr;
57  uint32_t rk[68];
58 }
60 
67 
74 
84 int mbedtls_camellia_setkey_enc( mbedtls_camellia_context *ctx, const unsigned char *key,
85  unsigned int keybits );
86 
96 int mbedtls_camellia_setkey_dec( mbedtls_camellia_context *ctx, const unsigned char *key,
97  unsigned int keybits );
98 
110  int mode,
111  const unsigned char input[16],
112  unsigned char output[16] );
113 
114 #if defined(MBEDTLS_CIPHER_MODE_CBC)
115 
139  int mode,
140  size_t length,
141  unsigned char iv[16],
142  const unsigned char *input,
143  unsigned char *output );
144 #endif /* MBEDTLS_CIPHER_MODE_CBC */
145 
146 #if defined(MBEDTLS_CIPHER_MODE_CFB)
147 
174  int mode,
175  size_t length,
176  size_t *iv_off,
177  unsigned char iv[16],
178  const unsigned char *input,
179  unsigned char *output );
180 #endif /* MBEDTLS_CIPHER_MODE_CFB */
181 
182 #if defined(MBEDTLS_CIPHER_MODE_CTR)
183 
206  size_t length,
207  size_t *nc_off,
208  unsigned char nonce_counter[16],
209  unsigned char stream_block[16],
210  const unsigned char *input,
211  unsigned char *output );
212 #endif /* MBEDTLS_CIPHER_MODE_CTR */
213 
214 #ifdef __cplusplus
215 }
216 #endif
217 
218 #else /* MBEDTLS_CAMELLIA_ALT */
219 #include "camellia_alt.h"
220 #endif /* MBEDTLS_CAMELLIA_ALT */
221 
222 #ifdef __cplusplus
223 extern "C" {
224 #endif
225 
231 int mbedtls_camellia_self_test( int verbose );
232 
233 #ifdef __cplusplus
234 }
235 #endif
236 
237 #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.
Configuration options (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:54