mbed TLS v2.7.16
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 OR GPL-2.0-or-later
9  *
10  * This file is provided under the Apache License 2.0, or the
11  * GNU General Public License v2.0 or later.
12  *
13  * **********
14  * Apache License 2.0:
15  *
16  * Licensed under the Apache License, Version 2.0 (the "License"); you may
17  * not use this file except in compliance with the License.
18  * You may obtain a copy of the License at
19  *
20  * http://www.apache.org/licenses/LICENSE-2.0
21  *
22  * Unless required by applicable law or agreed to in writing, software
23  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
24  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25  * See the License for the specific language governing permissions and
26  * limitations under the License.
27  *
28  * **********
29  *
30  * **********
31  * GNU General Public License v2.0 or later:
32  *
33  * This program is free software; you can redistribute it and/or modify
34  * it under the terms of the GNU General Public License as published by
35  * the Free Software Foundation; either version 2 of the License, or
36  * (at your option) any later version.
37  *
38  * This program is distributed in the hope that it will be useful,
39  * but WITHOUT ANY WARRANTY; without even the implied warranty of
40  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41  * GNU General Public License for more details.
42  *
43  * You should have received a copy of the GNU General Public License along
44  * with this program; if not, write to the Free Software Foundation, Inc.,
45  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
46  *
47  * **********
48  *
49  * This file is part of mbed TLS (https://tls.mbed.org)
50  */
51 #ifndef MBEDTLS_CAMELLIA_H
52 #define MBEDTLS_CAMELLIA_H
53 
54 #if !defined(MBEDTLS_CONFIG_FILE)
55 #include "config.h"
56 #else
57 #include MBEDTLS_CONFIG_FILE
58 #endif
59 
60 #include <stddef.h>
61 #include <stdint.h>
62 
63 #define MBEDTLS_CAMELLIA_ENCRYPT 1
64 #define MBEDTLS_CAMELLIA_DECRYPT 0
65 
66 #define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0024
67 #define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
68 #define MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED -0x0027
70 #if !defined(MBEDTLS_CAMELLIA_ALT)
71 // Regular implementation
72 //
73 
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77 
81 typedef struct
82 {
83  int nr;
84  uint32_t rk[68];
85 }
87 
94 
101 
111 int mbedtls_camellia_setkey_enc( mbedtls_camellia_context *ctx, const unsigned char *key,
112  unsigned int keybits );
113 
123 int mbedtls_camellia_setkey_dec( mbedtls_camellia_context *ctx, const unsigned char *key,
124  unsigned int keybits );
125 
137  int mode,
138  const unsigned char input[16],
139  unsigned char output[16] );
140 
141 #if defined(MBEDTLS_CIPHER_MODE_CBC)
142 
166  int mode,
167  size_t length,
168  unsigned char iv[16],
169  const unsigned char *input,
170  unsigned char *output );
171 #endif /* MBEDTLS_CIPHER_MODE_CBC */
172 
173 #if defined(MBEDTLS_CIPHER_MODE_CFB)
174 
201  int mode,
202  size_t length,
203  size_t *iv_off,
204  unsigned char iv[16],
205  const unsigned char *input,
206  unsigned char *output );
207 #endif /* MBEDTLS_CIPHER_MODE_CFB */
208 
209 #if defined(MBEDTLS_CIPHER_MODE_CTR)
210 
233  size_t length,
234  size_t *nc_off,
235  unsigned char nonce_counter[16],
236  unsigned char stream_block[16],
237  const unsigned char *input,
238  unsigned char *output );
239 #endif /* MBEDTLS_CIPHER_MODE_CTR */
240 
241 #ifdef __cplusplus
242 }
243 #endif
244 
245 #else /* MBEDTLS_CAMELLIA_ALT */
246 #include "camellia_alt.h"
247 #endif /* MBEDTLS_CAMELLIA_ALT */
248 
249 #ifdef __cplusplus
250 extern "C" {
251 #endif
252 
258 int mbedtls_camellia_self_test( int verbose );
259 
260 #ifdef __cplusplus
261 }
262 #endif
263 
264 #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:81