mbed TLS v2.16.7
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 #include "platform_util.h"
64 
65 #define MBEDTLS_CAMELLIA_ENCRYPT 1
66 #define MBEDTLS_CAMELLIA_DECRYPT 0
67 
68 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
69 #define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x0024 )
70 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
71 #define MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA -0x0024
73 #define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
75 /* MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED is deprecated and should not be used.
76  */
77 #define MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED -0x0027
79 #ifdef __cplusplus
80 extern "C" {
81 #endif
82 
83 #if !defined(MBEDTLS_CAMELLIA_ALT)
84 // Regular implementation
85 //
86 
91 {
92  int nr;
93  uint32_t rk[68];
94 }
96 
97 #else /* MBEDTLS_CAMELLIA_ALT */
98 #include "camellia_alt.h"
99 #endif /* MBEDTLS_CAMELLIA_ALT */
100 
108 
117 
131  const unsigned char *key,
132  unsigned int keybits );
133 
147  const unsigned char *key,
148  unsigned int keybits );
149 
166  int mode,
167  const unsigned char input[16],
168  unsigned char output[16] );
169 
170 #if defined(MBEDTLS_CIPHER_MODE_CBC)
171 
200  int mode,
201  size_t length,
202  unsigned char iv[16],
203  const unsigned char *input,
204  unsigned char *output );
205 #endif /* MBEDTLS_CIPHER_MODE_CBC */
206 
207 #if defined(MBEDTLS_CIPHER_MODE_CFB)
208 
246  int mode,
247  size_t length,
248  size_t *iv_off,
249  unsigned char iv[16],
250  const unsigned char *input,
251  unsigned char *output );
252 #endif /* MBEDTLS_CIPHER_MODE_CFB */
253 
254 #if defined(MBEDTLS_CIPHER_MODE_CTR)
255 
330  size_t length,
331  size_t *nc_off,
332  unsigned char nonce_counter[16],
333  unsigned char stream_block[16],
334  const unsigned char *input,
335  unsigned char *output );
336 #endif /* MBEDTLS_CIPHER_MODE_CTR */
337 
338 #if defined(MBEDTLS_SELF_TEST)
339 
345 int mbedtls_camellia_self_test( int verbose );
346 
347 #endif /* MBEDTLS_SELF_TEST */
348 
349 #ifdef __cplusplus
350 }
351 #endif
352 
353 #endif /* camellia.h */
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_self_test(int verbose)
Checkup routine.
void mbedtls_camellia_free(mbedtls_camellia_context *ctx)
Clear a CAMELLIA context.
Configuration options (set of defines)
Common and shared functions used by multiple modules in the Mbed TLS library.
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.
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_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_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.
void mbedtls_camellia_init(mbedtls_camellia_context *ctx)
Initialize a 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)
Perform a CAMELLIA-CBC buffer encryption/decryption operation.
CAMELLIA context structure.
Definition: camellia.h:90
struct mbedtls_camellia_context mbedtls_camellia_context
CAMELLIA context structure.