OPTIGA Trust M  1.1.0
C++ library for Optiga Trust M Chip Security Controller
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 #include "platform_util.h"
37 
38 #define MBEDTLS_CAMELLIA_ENCRYPT 1
39 #define MBEDTLS_CAMELLIA_DECRYPT 0
40 
41 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
42 #define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x0024 )
43 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
44 #define MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA -0x0024
46 #define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
48 /* MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED is deprecated and should not be used.
49  */
50 #define MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED -0x0027
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 #if !defined(MBEDTLS_CAMELLIA_ALT)
57 // Regular implementation
58 //
59 
64 {
65  int nr;
66  uint32_t rk[68];
67 }
69 
70 #else /* MBEDTLS_CAMELLIA_ALT */
71 #include "camellia_alt.h"
72 #endif /* MBEDTLS_CAMELLIA_ALT */
73 
81 
90 
104  const unsigned char *key,
105  unsigned int keybits );
106 
120  const unsigned char *key,
121  unsigned int keybits );
122 
139  int mode,
140  const unsigned char input[16],
141  unsigned char output[16] );
142 
143 #if defined(MBEDTLS_CIPHER_MODE_CBC)
144 
172 int mbedtls_camellia_crypt_cbc( mbedtls_camellia_context *ctx,
173  int mode,
174  size_t length,
175  unsigned char iv[16],
176  const unsigned char *input,
177  unsigned char *output );
178 #endif /* MBEDTLS_CIPHER_MODE_CBC */
179 
180 #if defined(MBEDTLS_CIPHER_MODE_CFB)
181 
218 int mbedtls_camellia_crypt_cfb128( mbedtls_camellia_context *ctx,
219  int mode,
220  size_t length,
221  size_t *iv_off,
222  unsigned char iv[16],
223  const unsigned char *input,
224  unsigned char *output );
225 #endif /* MBEDTLS_CIPHER_MODE_CFB */
226 
227 #if defined(MBEDTLS_CIPHER_MODE_CTR)
228 
302 int mbedtls_camellia_crypt_ctr( mbedtls_camellia_context *ctx,
303  size_t length,
304  size_t *nc_off,
305  unsigned char nonce_counter[16],
306  unsigned char stream_block[16],
307  const unsigned char *input,
308  unsigned char *output );
309 #endif /* MBEDTLS_CIPHER_MODE_CTR */
310 
316 int mbedtls_camellia_self_test( int verbose );
317 
318 #ifdef __cplusplus
319 }
320 #endif
321 
322 #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_setkey_enc(mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
Perform a CAMELLIA key schedule operation for encryption.
int nr
Definition: camellia.h:65
int mbedtls_camellia_setkey_dec(mbedtls_camellia_context *ctx, const unsigned char *key, unsigned int keybits)
Perform a CAMELLIA key schedule operation for decryption.
void mbedtls_camellia_init(mbedtls_camellia_context *ctx)
Initialize a CAMELLIA context.
uint32_t rk[68]
Definition: camellia.h:66
CAMELLIA context structure.
Definition: camellia.h:63
struct mbedtls_camellia_context mbedtls_camellia_context
CAMELLIA context structure.