mbed TLS v2.14.1

camellia.h
Go to the documentation of this file.
1
6 /*
7 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
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 * This file is part of mbed TLS (https://tls.mbed.org)
23 */
24 #ifndef MBEDTLS_CAMELLIA_H
25 #define MBEDTLS_CAMELLIA_H
26
27 #if !defined(MBEDTLS_CONFIG_FILE)
28 #include "config.h"
29 #else
30 #include MBEDTLS_CONFIG_FILE
31 #endif
32
33 #include <stddef.h>
34 #include <stdint.h>
35
36 #define MBEDTLS_CAMELLIA_ENCRYPT 1
37 #define MBEDTLS_CAMELLIA_DECRYPT 0
38
39 #define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0024
40 #define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
42 /* MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED is deprecated and should not be used.
43 */
44 #define MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED -0x0027
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49
50 #if !defined(MBEDTLS_CAMELLIA_ALT)
51 // Regular implementation
52 //
53
57 typedef struct mbedtls_camellia_context
58 {
59 int nr;
60 uint32_t rk[68];
61 }
62 mbedtls_camellia_context;
63
64 #else /* MBEDTLS_CAMELLIA_ALT */
65 #include "camellia_alt.h"
66 #endif /* MBEDTLS_CAMELLIA_ALT */
67
73 void mbedtls_camellia_init( mbedtls_camellia_context *ctx );
74
80 void mbedtls_camellia_free( mbedtls_camellia_context *ctx );
81
91 int mbedtls_camellia_setkey_enc( mbedtls_camellia_context *ctx, const unsigned char *key,
92 unsigned int keybits );
93
103 int mbedtls_camellia_setkey_dec( mbedtls_camellia_context *ctx, const unsigned char *key,
104 unsigned int keybits );
105
116 int mbedtls_camellia_crypt_ecb( mbedtls_camellia_context *ctx,
117 int mode,
118 const unsigned char input[16],
119 unsigned char output[16] );
120
121 #if defined(MBEDTLS_CIPHER_MODE_CBC)
122
145 int mbedtls_camellia_crypt_cbc( mbedtls_camellia_context *ctx,
146 int mode,
147 size_t length,
148 unsigned char iv[16],
149 const unsigned char *input,
150 unsigned char *output );
151 #endif /* MBEDTLS_CIPHER_MODE_CBC */
152
153 #if defined(MBEDTLS_CIPHER_MODE_CFB)
154
180 int mbedtls_camellia_crypt_cfb128( mbedtls_camellia_context *ctx,
181 int mode,
182 size_t length,
183 size_t *iv_off,
184 unsigned char iv[16],
185 const unsigned char *input,
186 unsigned char *output );
187 #endif /* MBEDTLS_CIPHER_MODE_CFB */
188
189 #if defined(MBEDTLS_CIPHER_MODE_CTR)
190
254 int mbedtls_camellia_crypt_ctr( mbedtls_camellia_context *ctx,
255 size_t length,
256 size_t *nc_off,
257 unsigned char nonce_counter[16],
258 unsigned char stream_block[16],
259 const unsigned char *input,
260 unsigned char *output );
261 #endif /* MBEDTLS_CIPHER_MODE_CTR */
262
268 int mbedtls_camellia_self_test( int verbose );
269
270 #ifdef __cplusplus
271 }
272 #endif
273
274 #endif /* camellia.h */
mbedtls_camellia_crypt_ecb
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.
mbedtls_camellia_self_test
int mbedtls_camellia_self_test(int verbose)
Checkup routine.
mbedtls_camellia_free
void mbedtls_camellia_free(mbedtls_camellia_context *ctx)
Clear CAMELLIA context.
config.h
Configuration options (set of defines)
mbedtls_camellia_crypt_cfb128
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.
mbedtls_camellia_setkey_enc
int mbedtls_camellia_setkey_enc(mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
CAMELLIA key schedule (encryption)
mbedtls_camellia_context::nr
int nr
Definition: camellia.h:59
mbedtls_camellia_setkey_dec
int mbedtls_camellia_setkey_dec(mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
CAMELLIA key schedule (decryption)
mbedtls_camellia_crypt_ctr
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.
mbedtls_camellia_init
void mbedtls_camellia_init(mbedtls_camellia_context *ctx)
Initialize CAMELLIA context.
mbedtls_camellia_crypt_cbc
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) ...
mbedtls_camellia_context::rk
uint32_t rk[68]
Definition: camellia.h:60
mbedtls_camellia_context
CAMELLIA context structure.
Definition: camellia.h:57
mbedtls_camellia_context
struct mbedtls_camellia_context mbedtls_camellia_context
CAMELLIA context structure.