mbed TLS v2.28.2
camellia.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright The Mbed TLS Contributors
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 #ifndef MBEDTLS_CAMELLIA_H
23 #define MBEDTLS_CAMELLIA_H
24 
25 #if !defined(MBEDTLS_CONFIG_FILE)
26 #include "mbedtls/config.h"
27 #else
28 #include MBEDTLS_CONFIG_FILE
29 #endif
30 
31 #include <stddef.h>
32 #include <stdint.h>
33 
34 #include "mbedtls/platform_util.h"
35 
36 #define MBEDTLS_CAMELLIA_ENCRYPT 1
37 #define MBEDTLS_CAMELLIA_DECRYPT 0
38 
39 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
40 #define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x0024 )
41 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
43 #define MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA -0x0024
44 
46 #define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
47 
48 /* MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED is deprecated and should not be used.
49  */
51 #define MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED -0x0027
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 #if !defined(MBEDTLS_CAMELLIA_ALT)
58 // Regular implementation
59 //
60 
65 {
66  int nr;
67  uint32_t rk[68];
68 }
70 
71 #else /* MBEDTLS_CAMELLIA_ALT */
72 #include "camellia_alt.h"
73 #endif /* MBEDTLS_CAMELLIA_ALT */
74 
82 
91 
105  const unsigned char *key,
106  unsigned int keybits );
107 
121  const unsigned char *key,
122  unsigned int keybits );
123 
140  int mode,
141  const unsigned char input[16],
142  unsigned char output[16] );
143 
144 #if defined(MBEDTLS_CIPHER_MODE_CBC)
174  int mode,
175  size_t length,
176  unsigned char iv[16],
177  const unsigned char *input,
178  unsigned char *output );
179 #endif /* MBEDTLS_CIPHER_MODE_CBC */
180 
181 #if defined(MBEDTLS_CIPHER_MODE_CFB)
220  int mode,
221  size_t length,
222  size_t *iv_off,
223  unsigned char iv[16],
224  const unsigned char *input,
225  unsigned char *output );
226 #endif /* MBEDTLS_CIPHER_MODE_CFB */
227 
228 #if defined(MBEDTLS_CIPHER_MODE_CTR)
304  size_t length,
305  size_t *nc_off,
306  unsigned char nonce_counter[16],
307  unsigned char stream_block[16],
308  const unsigned char *input,
309  unsigned char *output );
310 #endif /* MBEDTLS_CIPHER_MODE_CTR */
311 
312 #if defined(MBEDTLS_SELF_TEST)
313 
319 int mbedtls_camellia_self_test( int verbose );
320 
321 #endif /* MBEDTLS_SELF_TEST */
322 
323 #ifdef __cplusplus
324 }
325 #endif
326 
327 #endif /* camellia.h */
int mbedtls_camellia_self_test(int verbose)
Checkup routine.
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_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_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_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.
void mbedtls_camellia_init(mbedtls_camellia_context *ctx)
Initialize a CAMELLIA context.
struct mbedtls_camellia_context mbedtls_camellia_context
CAMELLIA context structure.
void mbedtls_camellia_free(mbedtls_camellia_context *ctx)
Clear a CAMELLIA context.
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.
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.
Configuration options (set of defines)
Common and shared functions used by multiple modules in the Mbed TLS library.
CAMELLIA context structure.
Definition: camellia.h:65