mbed TLS v2.16.3: camellia.h Source File

mbed TLS v2.16.3

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 #include "platform_util.h"
37
38 #define MBEDTLS_CAMELLIA_ENCRYPT 1
39 #define MBEDTLS_CAMELLIA_DECRYPT 0
40
41 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
42 #define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x0024 )
43 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
44 #define MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA -0x0024
46 #define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
48 /* MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED is deprecated and should not be used.
49 */
50 #define MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED -0x0027
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55
56 #if !defined(MBEDTLS_CAMELLIA_ALT)
57 // Regular implementation
58 //
59
63 typedef struct mbedtls_camellia_context
64 {
65 int nr;
66 uint32_t rk[68];
67 }
68 mbedtls_camellia_context;
69
70 #else /* MBEDTLS_CAMELLIA_ALT */
71 #include "camellia_alt.h"
72 #endif /* MBEDTLS_CAMELLIA_ALT */
73
80 void mbedtls_camellia_init( mbedtls_camellia_context *ctx );
81
89 void mbedtls_camellia_free( mbedtls_camellia_context *ctx );
90
103 int mbedtls_camellia_setkey_enc( mbedtls_camellia_context *ctx,
104 const unsigned char *key,
105 unsigned int keybits );
106
119 int mbedtls_camellia_setkey_dec( mbedtls_camellia_context *ctx,
120 const unsigned char *key,
121 unsigned int keybits );
122
138 int mbedtls_camellia_crypt_ecb( mbedtls_camellia_context *ctx,
139 int mode,
140 const unsigned char input[16],
141 unsigned char output[16] );
142
143 #if defined(MBEDTLS_CIPHER_MODE_CBC)
144
172 int mbedtls_camellia_crypt_cbc( mbedtls_camellia_context *ctx,
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)
181
218 int mbedtls_camellia_crypt_cfb128( mbedtls_camellia_context *ctx,
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)
228
302 int mbedtls_camellia_crypt_ctr( mbedtls_camellia_context *ctx,
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
318 int mbedtls_camellia_self_test( int verbose );
319
320 #endif /* MBEDTLS_SELF_TEST */
321
322 #ifdef __cplusplus
323 }
324 #endif
325
326 #endif /* camellia.h */
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)
Perform a CAMELLIA-CTR buffer encryption/decryption operation.
mbedtls_camellia_setkey_dec
int mbedtls_camellia_setkey_dec(mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
Perform a CAMELLIA key schedule operation for decryption.
mbedtls_camellia_setkey_enc
int mbedtls_camellia_setkey_enc(mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
Perform a CAMELLIA key schedule operation for encryption.
mbedtls_camellia_context
struct mbedtls_camellia_context mbedtls_camellia_context
CAMELLIA context structure.
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)
Perform a CAMELLIA-CBC buffer encryption/decryption operation.
mbedtls_camellia_self_test
int mbedtls_camellia_self_test(int verbose)
Checkup routine.
mbedtls_camellia_crypt_ecb
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.
mbedtls_camellia_free
void mbedtls_camellia_free(mbedtls_camellia_context *ctx)
Clear a CAMELLIA context.
mbedtls_camellia_init
void mbedtls_camellia_init(mbedtls_camellia_context *ctx)
Initialize a CAMELLIA context.
config.h
Configuration options (set of defines)
platform_util.h
Common and shared functions used by multiple modules in the Mbed TLS library.
mbedtls_camellia_context::nr
int nr
Definition: camellia.h:65
mbedtls_camellia_context::rk
uint32_t rk[68]
Definition: camellia.h:66
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)
Perform a CAMELLIA-CFB128 buffer encryption/decryption operation.
mbedtls_camellia_context
CAMELLIA context structure.
Definition: camellia.h:63