mbed TLS v3.4.0
camellia.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright The Mbed TLS Contributors
8  * SPDX-License-Identifier: Apache-2.0
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License"); you may
11  * not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 #ifndef MBEDTLS_CAMELLIA_H
23 #define MBEDTLS_CAMELLIA_H
24 #include "mbedtls/private_access.h"
25 
26 #include "mbedtls/build_info.h"
27 
28 #include <stddef.h>
29 #include <stdint.h>
30 
31 #include "mbedtls/platform_util.h"
32 
33 #define MBEDTLS_CAMELLIA_ENCRYPT 1
34 #define MBEDTLS_CAMELLIA_DECRYPT 0
35 
37 #define MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA -0x0024
38 
40 #define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 #if !defined(MBEDTLS_CAMELLIA_ALT)
47 // Regular implementation
48 //
49 
53 typedef struct mbedtls_camellia_context {
54  int MBEDTLS_PRIVATE(nr);
55  uint32_t MBEDTLS_PRIVATE(rk)[68];
56 }
58 
59 #else /* MBEDTLS_CAMELLIA_ALT */
60 #include "camellia_alt.h"
61 #endif /* MBEDTLS_CAMELLIA_ALT */
62 
70 
79 
93  const unsigned char *key,
94  unsigned int keybits);
95 
109  const unsigned char *key,
110  unsigned int keybits);
111 
128  int mode,
129  const unsigned char input[16],
130  unsigned char output[16]);
131 
132 #if defined(MBEDTLS_CIPHER_MODE_CBC)
133 
162  int mode,
163  size_t length,
164  unsigned char iv[16],
165  const unsigned char *input,
166  unsigned char *output);
167 #endif /* MBEDTLS_CIPHER_MODE_CBC */
168 
169 #if defined(MBEDTLS_CIPHER_MODE_CFB)
170 
208  int mode,
209  size_t length,
210  size_t *iv_off,
211  unsigned char iv[16],
212  const unsigned char *input,
213  unsigned char *output);
214 #endif /* MBEDTLS_CIPHER_MODE_CFB */
215 
216 #if defined(MBEDTLS_CIPHER_MODE_CTR)
217 
292  size_t length,
293  size_t *nc_off,
294  unsigned char nonce_counter[16],
295  unsigned char stream_block[16],
296  const unsigned char *input,
297  unsigned char *output);
298 #endif /* MBEDTLS_CIPHER_MODE_CTR */
299 
300 #if defined(MBEDTLS_SELF_TEST)
301 
307 int mbedtls_camellia_self_test(int verbose);
308 
309 #endif /* MBEDTLS_SELF_TEST */
310 
311 #ifdef __cplusplus
312 }
313 #endif
314 
315 #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:53
struct mbedtls_camellia_context mbedtls_camellia_context
CAMELLIA context structure.