mbed TLS v2.28.3
Loading...
Searching...
No Matches
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
25#if !defined(MBEDTLS_CONFIG_FILE)
26#include "mbedtls/config.h"
27#else
28#include MBEDTLS_CONFIG_FILE
29#endif
30
31#include <stddef.h>
32#include <stdint.h>
33
35
36#define MBEDTLS_CAMELLIA_ENCRYPT 1
37#define MBEDTLS_CAMELLIA_DECRYPT 0
38
39#if !defined(MBEDTLS_DEPRECATED_REMOVED)
40#define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT(-0x0024)
41#endif /* !MBEDTLS_DEPRECATED_REMOVED */
43#define MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA -0x0024
44
46#define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
47
48/* MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED is deprecated and should not be used.
49 */
51#define MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED -0x0027
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57#if !defined(MBEDTLS_CAMELLIA_ALT)
58// Regular implementation
59//
60
65 int nr;
66 uint32_t rk[68];
67}
69
70#else /* MBEDTLS_CAMELLIA_ALT */
71#include "camellia_alt.h"
72#endif /* MBEDTLS_CAMELLIA_ALT */
73
81
90
104 const unsigned char *key,
105 unsigned int keybits);
106
120 const unsigned char *key,
121 unsigned int keybits);
122
139 int mode,
140 const unsigned char input[16],
141 unsigned char output[16]);
142
143#if defined(MBEDTLS_CIPHER_MODE_CBC)
173 int mode,
174 size_t length,
175 unsigned char iv[16],
176 const unsigned char *input,
177 unsigned char *output);
178#endif /* MBEDTLS_CIPHER_MODE_CBC */
179
180#if defined(MBEDTLS_CIPHER_MODE_CFB)
219 int mode,
220 size_t length,
221 size_t *iv_off,
222 unsigned char iv[16],
223 const unsigned char *input,
224 unsigned char *output);
225#endif /* MBEDTLS_CIPHER_MODE_CFB */
226
227#if defined(MBEDTLS_CIPHER_MODE_CTR)
303 size_t length,
304 size_t *nc_off,
305 unsigned char nonce_counter[16],
306 unsigned char stream_block[16],
307 const unsigned char *input,
308 unsigned char *output);
309#endif /* MBEDTLS_CIPHER_MODE_CTR */
310
311#if defined(MBEDTLS_SELF_TEST)
312
319
320#endif /* MBEDTLS_SELF_TEST */
321
322#ifdef __cplusplus
323}
324#endif
325
326#endif /* camellia.h */
int mbedtls_camellia_self_test(int verbose)
Checkup routine.
int mbedtls_camellia_setkey_enc(mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
Perform a CAMELLIA key schedule operation for encryption.
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_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_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.
void mbedtls_camellia_init(mbedtls_camellia_context *ctx)
Initialize a CAMELLIA context.
void mbedtls_camellia_free(mbedtls_camellia_context *ctx)
Clear a CAMELLIA context.
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.
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.
Configuration options (set of defines)
Common and shared functions used by multiple modules in the Mbed TLS library.
CAMELLIA context structure.
Definition: camellia.h:64