mbed TLS v2.9.0
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
41 #define MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED -0x0027
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 #if !defined(MBEDTLS_CAMELLIA_ALT)
48 // Regular implementation
49 //
50 
54 typedef struct
55 {
56  int nr;
57  uint32_t rk[68];
58 }
60 
61 #else /* MBEDTLS_CAMELLIA_ALT */
62 #include "camellia_alt.h"
63 #endif /* MBEDTLS_CAMELLIA_ALT */
64 
71 
78 
88 int mbedtls_camellia_setkey_enc( mbedtls_camellia_context *ctx, const unsigned char *key,
89  unsigned int keybits );
90 
100 int mbedtls_camellia_setkey_dec( mbedtls_camellia_context *ctx, const unsigned char *key,
101  unsigned int keybits );
102 
114  int mode,
115  const unsigned char input[16],
116  unsigned char output[16] );
117 
118 #if defined(MBEDTLS_CIPHER_MODE_CBC)
119 
143  int mode,
144  size_t length,
145  unsigned char iv[16],
146  const unsigned char *input,
147  unsigned char *output );
148 #endif /* MBEDTLS_CIPHER_MODE_CBC */
149 
150 #if defined(MBEDTLS_CIPHER_MODE_CFB)
151 
178  int mode,
179  size_t length,
180  size_t *iv_off,
181  unsigned char iv[16],
182  const unsigned char *input,
183  unsigned char *output );
184 #endif /* MBEDTLS_CIPHER_MODE_CFB */
185 
186 #if defined(MBEDTLS_CIPHER_MODE_CTR)
187 
210  size_t length,
211  size_t *nc_off,
212  unsigned char nonce_counter[16],
213  unsigned char stream_block[16],
214  const unsigned char *input,
215  unsigned char *output );
216 #endif /* MBEDTLS_CIPHER_MODE_CTR */
217 
223 int mbedtls_camellia_self_test( int verbose );
224 
225 #ifdef __cplusplus
226 }
227 #endif
228 
229 #endif /* camellia.h */
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.
int mbedtls_camellia_self_test(int verbose)
Checkup routine.
void mbedtls_camellia_free(mbedtls_camellia_context *ctx)
Clear CAMELLIA context.
Configuration options (set of defines)
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.
int mbedtls_camellia_setkey_enc(mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
CAMELLIA key schedule (encryption)
int mbedtls_camellia_setkey_dec(mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
CAMELLIA key schedule (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)
CAMELLIA-CTR buffer encryption/decryption.
void mbedtls_camellia_init(mbedtls_camellia_context *ctx)
Initialize CAMELLIA context.
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) ...
CAMELLIA context structure.
Definition: camellia.h:54