Mbed TLS v3.6.4
camellia.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright The Mbed TLS Contributors
8  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9  */
10 #ifndef MBEDTLS_CAMELLIA_H
11 #define MBEDTLS_CAMELLIA_H
12 #include "mbedtls/private_access.h"
13 
14 #include "mbedtls/build_info.h"
15 
16 #include <stddef.h>
17 #include <stdint.h>
18 
19 #include "mbedtls/platform_util.h"
20 
21 #define MBEDTLS_CAMELLIA_ENCRYPT 1
22 #define MBEDTLS_CAMELLIA_DECRYPT 0
23 
25 #define MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA -0x0024
26 
28 #define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #if !defined(MBEDTLS_CAMELLIA_ALT)
35 // Regular implementation
36 //
37 
41 typedef struct mbedtls_camellia_context {
42  int MBEDTLS_PRIVATE(nr);
43  uint32_t MBEDTLS_PRIVATE(rk)[68];
44 }
46 
47 #else /* MBEDTLS_CAMELLIA_ALT */
48 #include "camellia_alt.h"
49 #endif /* MBEDTLS_CAMELLIA_ALT */
50 
58 
67 
81  const unsigned char *key,
82  unsigned int keybits);
83 
84 #if !defined(MBEDTLS_BLOCK_CIPHER_NO_DECRYPT)
85 
98  const unsigned char *key,
99  unsigned int keybits);
100 #endif /* !MBEDTLS_BLOCK_CIPHER_NO_DECRYPT */
101 
118  int mode,
119  const unsigned char input[16],
120  unsigned char output[16]);
121 
122 #if defined(MBEDTLS_CIPHER_MODE_CBC)
123 
152  int mode,
153  size_t length,
154  unsigned char iv[16],
155  const unsigned char *input,
156  unsigned char *output);
157 #endif /* MBEDTLS_CIPHER_MODE_CBC */
158 
159 #if defined(MBEDTLS_CIPHER_MODE_CFB)
160 
198  int mode,
199  size_t length,
200  size_t *iv_off,
201  unsigned char iv[16],
202  const unsigned char *input,
203  unsigned char *output);
204 #endif /* MBEDTLS_CIPHER_MODE_CFB */
205 
206 #if defined(MBEDTLS_CIPHER_MODE_CTR)
207 
282  size_t length,
283  size_t *nc_off,
284  unsigned char nonce_counter[16],
285  unsigned char stream_block[16],
286  const unsigned char *input,
287  unsigned char *output);
288 #endif /* MBEDTLS_CIPHER_MODE_CTR */
289 
290 #if defined(MBEDTLS_SELF_TEST)
291 
297 int mbedtls_camellia_self_test(int verbose);
298 
299 #endif /* MBEDTLS_SELF_TEST */
300 
301 #ifdef __cplusplus
302 }
303 #endif
304 
305 #endif /* camellia.h */
int mbedtls_camellia_crypt_ecb(mbedtls_camellia_context *ctx, int mode, const unsigned char input[16], unsigned char output[16])
Perform a CAMELLIA-ECB block encryption/decryption operation.
int mbedtls_camellia_self_test(int verbose)
Checkup routine.
void mbedtls_camellia_free(mbedtls_camellia_context *ctx)
Clear a CAMELLIA context.
#define MBEDTLS_PRIVATE(member)
Common and shared functions used by multiple modules in the Mbed TLS library.
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)
Perform a CAMELLIA-CFB128 buffer encryption/decryption operation.
int mbedtls_camellia_setkey_enc(mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
Perform a CAMELLIA key schedule operation for encryption.
Macro wrapper for struct's members.
int mbedtls_camellia_setkey_dec(mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
Perform a CAMELLIA key schedule operation for 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)
Perform a CAMELLIA-CTR buffer encryption/decryption operation.
void mbedtls_camellia_init(mbedtls_camellia_context *ctx)
Initialize a CAMELLIA context.
Build-time configuration info.
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)
Perform a CAMELLIA-CBC buffer encryption/decryption operation.
CAMELLIA context structure.
Definition: camellia.h:41
struct mbedtls_camellia_context mbedtls_camellia_context
CAMELLIA context structure.