mbed TLS v2.16.6
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: GPL-2.0
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License along
21  * with this program; if not, write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  *
24  * This file is part of mbed TLS (https://tls.mbed.org)
25  */
26 #ifndef MBEDTLS_CAMELLIA_H
27 #define MBEDTLS_CAMELLIA_H
28 
29 #if !defined(MBEDTLS_CONFIG_FILE)
30 #include "config.h"
31 #else
32 #include MBEDTLS_CONFIG_FILE
33 #endif
34 
35 #include <stddef.h>
36 #include <stdint.h>
37 
38 #include "platform_util.h"
39 
40 #define MBEDTLS_CAMELLIA_ENCRYPT 1
41 #define MBEDTLS_CAMELLIA_DECRYPT 0
42 
43 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
44 #define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x0024 )
45 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
46 #define MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA -0x0024
48 #define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
50 /* MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED is deprecated and should not be used.
51  */
52 #define MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED -0x0027
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58 #if !defined(MBEDTLS_CAMELLIA_ALT)
59 // Regular implementation
60 //
61 
66 {
67  int nr;
68  uint32_t rk[68];
69 }
71 
72 #else /* MBEDTLS_CAMELLIA_ALT */
73 #include "camellia_alt.h"
74 #endif /* MBEDTLS_CAMELLIA_ALT */
75 
83 
92 
106  const unsigned char *key,
107  unsigned int keybits );
108 
122  const unsigned char *key,
123  unsigned int keybits );
124 
141  int mode,
142  const unsigned char input[16],
143  unsigned char output[16] );
144 
145 #if defined(MBEDTLS_CIPHER_MODE_CBC)
146 
175  int mode,
176  size_t length,
177  unsigned char iv[16],
178  const unsigned char *input,
179  unsigned char *output );
180 #endif /* MBEDTLS_CIPHER_MODE_CBC */
181 
182 #if defined(MBEDTLS_CIPHER_MODE_CFB)
183 
221  int mode,
222  size_t length,
223  size_t *iv_off,
224  unsigned char iv[16],
225  const unsigned char *input,
226  unsigned char *output );
227 #endif /* MBEDTLS_CIPHER_MODE_CFB */
228 
229 #if defined(MBEDTLS_CIPHER_MODE_CTR)
230 
305  size_t length,
306  size_t *nc_off,
307  unsigned char nonce_counter[16],
308  unsigned char stream_block[16],
309  const unsigned char *input,
310  unsigned char *output );
311 #endif /* MBEDTLS_CIPHER_MODE_CTR */
312 
313 #if defined(MBEDTLS_SELF_TEST)
314 
320 int mbedtls_camellia_self_test( int verbose );
321 
322 #endif /* MBEDTLS_SELF_TEST */
323 
324 #ifdef __cplusplus
325 }
326 #endif
327 
328 #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:65
struct mbedtls_camellia_context mbedtls_camellia_context
CAMELLIA context structure.