blob: b42155ccf8ba99441c6a570892583237395046b2 [file] [log] [blame]
Paul Bakker38119b12009-01-10 23:31:23 +00001/**
2 * \file camellia.h
3 *
Paul Bakker37ca75d2011-01-06 12:28:03 +00004 * \brief Camellia block cipher
Darryl Greena40a1012018-01-05 15:33:17 +00005 */
6/*
Manuel Pégourié-Gonnard6fb81872015-07-27 11:11:48 +02007 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
Manuel Pégourié-Gonnard37ff1402015-09-04 14:21:07 +02008 * 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.
Paul Bakkerb96f1542010-07-18 20:36:00 +000021 *
Manuel Pégourié-Gonnardfe446432015-03-06 13:17:10 +000022 * This file is part of mbed TLS (https://tls.mbed.org)
Paul Bakker38119b12009-01-10 23:31:23 +000023 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020024#ifndef MBEDTLS_CAMELLIA_H
25#define MBEDTLS_CAMELLIA_H
Paul Bakker477fd322009-10-04 13:22:13 +000026
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020027#if !defined(MBEDTLS_CONFIG_FILE)
Paul Bakker90995b52013-06-24 19:20:35 +020028#include "config.h"
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020029#else
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020030#include MBEDTLS_CONFIG_FILE
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020031#endif
Paul Bakker90995b52013-06-24 19:20:35 +020032
Rich Evans00ab4702015-02-06 13:43:58 +000033#include <stddef.h>
Manuel Pégourié-Gonnardab229102015-04-15 11:53:16 +020034#include <stdint.h>
Paul Bakkerc81f6c32009-05-03 13:09:15 +000035
Hanno Becker4c029d02018-12-17 13:20:05 +000036#include "platform_util.h"
37
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020038#define MBEDTLS_CAMELLIA_ENCRYPT 1
39#define MBEDTLS_CAMELLIA_DECRYPT 0
Paul Bakker38119b12009-01-10 23:31:23 +000040
Hanno Becker4c029d02018-12-17 13:20:05 +000041#if !defined(MBEDTLS_DEPRECATED_REMOVED)
42#define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x0024 )
Hanno Becker4c029d02018-12-17 13:20:05 +000043#endif /* !MBEDTLS_DEPRECATED_REMOVED */
44#define MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA -0x0024 /**< Bad input data. */
Ron Eldor9924bdc2018-10-04 10:59:13 +030045
Hanno Becker938f9e92018-12-18 09:40:25 +000046#define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026 /**< Invalid data input length. */
47
Hanno Beckerb4b7fb72018-12-12 18:02:06 +000048/** TEMPORARY -- THIS IS IN CONFLICT WITH EXISTING ERROR CODES AND NEEDS CHANGE. */
49#define MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA -0x0024 /**< Invalid data input length. */
50
Ron Eldor9924bdc2018-10-04 10:59:13 +030051/* MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED is deprecated and should not be used.
52 */
Gilles Peskine7ecab3d2018-01-26 17:56:38 +010053#define MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED -0x0027 /**< Camellia hardware accelerator failed. */
Paul Bakker2b222c82009-07-27 21:03:45 +000054
Paul Bakker407a0da2013-06-27 14:29:21 +020055#ifdef __cplusplus
56extern "C" {
57#endif
58
Ron Eldorb2aacec2017-05-18 16:53:08 +030059#if !defined(MBEDTLS_CAMELLIA_ALT)
60// Regular implementation
61//
62
Paul Bakker38119b12009-01-10 23:31:23 +000063/**
64 * \brief CAMELLIA context structure
65 */
Dawid Drozd428cc522018-07-24 10:02:47 +020066typedef struct mbedtls_camellia_context
Paul Bakker38119b12009-01-10 23:31:23 +000067{
68 int nr; /*!< number of rounds */
Paul Bakkerc81f6c32009-05-03 13:09:15 +000069 uint32_t rk[68]; /*!< CAMELLIA round keys */
Paul Bakker38119b12009-01-10 23:31:23 +000070}
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020071mbedtls_camellia_context;
Paul Bakker38119b12009-01-10 23:31:23 +000072
Ron Eldorb2aacec2017-05-18 16:53:08 +030073#else /* MBEDTLS_CAMELLIA_ALT */
74#include "camellia_alt.h"
75#endif /* MBEDTLS_CAMELLIA_ALT */
76
Paul Bakker38119b12009-01-10 23:31:23 +000077/**
Hanno Becker7a16aad2018-12-12 14:54:16 +000078 * \brief Initialize a CAMELLIA context.
Paul Bakkerc7ea99a2014-06-18 11:12:03 +020079 *
Hanno Becker7a16aad2018-12-12 14:54:16 +000080 * \param ctx The CAMELLIA context to be initialized.
81 * This must not be \c NULL.
Paul Bakkerc7ea99a2014-06-18 11:12:03 +020082 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020083void mbedtls_camellia_init( mbedtls_camellia_context *ctx );
Paul Bakkerc7ea99a2014-06-18 11:12:03 +020084
85/**
Hanno Becker7a16aad2018-12-12 14:54:16 +000086 * \brief Clear a CAMELLIA context.
Paul Bakkerc7ea99a2014-06-18 11:12:03 +020087 *
Hanno Beckerf10905a2018-12-13 15:15:36 +000088 * \param ctx The CAMELLIA context to be cleared. This may be \c NULL,
Hanno Becker7a16aad2018-12-12 14:54:16 +000089 * in which case this function is a no-op. If it is not
90 * \c NULL, it must be initialized.
Paul Bakkerc7ea99a2014-06-18 11:12:03 +020091 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020092void mbedtls_camellia_free( mbedtls_camellia_context *ctx );
Paul Bakkerc7ea99a2014-06-18 11:12:03 +020093
94/**
Hanno Becker7a16aad2018-12-12 14:54:16 +000095 * \brief Perform a CAMELLIA key schedule (encryption).
Paul Bakker38119b12009-01-10 23:31:23 +000096 *
Hanno Becker7a16aad2018-12-12 14:54:16 +000097 * \param ctx The CAMELLIA context to use. This must be initialized.
Hanno Beckerf10905a2018-12-13 15:15:36 +000098 * \param key The encryption key to use. This must be a readable buffer
Hanno Becker7a16aad2018-12-12 14:54:16 +000099 * of size \p keybits bits.
Hanno Beckerf10905a2018-12-13 15:15:36 +0000100 * \param keybits The length of \p key in Bits. This must be either \c 128,
Hanno Becker7a16aad2018-12-12 14:54:16 +0000101 * \c 192 or \c 256.
Paul Bakker9af723c2014-05-01 13:03:14 +0200102 *
Hanno Becker7a16aad2018-12-12 14:54:16 +0000103 * \return \c 0 if successful.
104 * \return A negative error code on failure.
Paul Bakker38119b12009-01-10 23:31:23 +0000105 */
Hanno Becker7a16aad2018-12-12 14:54:16 +0000106int mbedtls_camellia_setkey_enc( mbedtls_camellia_context *ctx,
107 const unsigned char *key,
108 unsigned int keybits );
Paul Bakker38119b12009-01-10 23:31:23 +0000109
110/**
Hanno Becker7a16aad2018-12-12 14:54:16 +0000111 * \brief Perform a CAMELLIA key schedule (decryption).
Paul Bakker38119b12009-01-10 23:31:23 +0000112 *
Hanno Becker7a16aad2018-12-12 14:54:16 +0000113 * \param ctx The CAMELLIA context to use. This must be initialized.
Hanno Beckerf10905a2018-12-13 15:15:36 +0000114 * \param key The decryption key. This must be a readable buffer
Hanno Becker7a16aad2018-12-12 14:54:16 +0000115 * of size \p keybits bits.
Hanno Beckerf10905a2018-12-13 15:15:36 +0000116 * \param keybits The length of \p key in Bits. This must be either \c 128,
Hanno Becker7a16aad2018-12-12 14:54:16 +0000117 * \c 192 or \c 256.
Paul Bakker9af723c2014-05-01 13:03:14 +0200118 *
Hanno Becker7a16aad2018-12-12 14:54:16 +0000119 * \return \c 0 if successful.
120 * \return A negative error code on failure.
Paul Bakker38119b12009-01-10 23:31:23 +0000121 */
Hanno Becker7a16aad2018-12-12 14:54:16 +0000122int mbedtls_camellia_setkey_dec( mbedtls_camellia_context *ctx,
123 const unsigned char *key,
124 unsigned int keybits );
Paul Bakker38119b12009-01-10 23:31:23 +0000125
126/**
Hanno Becker7a16aad2018-12-12 14:54:16 +0000127 * \brief Perform a CAMELLIA-ECB block encryption/decryption.
Paul Bakker38119b12009-01-10 23:31:23 +0000128 *
Hanno Beckerf10905a2018-12-13 15:15:36 +0000129 * \param ctx The CAMELLIA context to use. This must be initialized
Hanno Becker7a16aad2018-12-12 14:54:16 +0000130 * and bound to a key.
Hanno Beckerf10905a2018-12-13 15:15:36 +0000131 * \param mode The mode of operation. This must be either
Hanno Becker7a16aad2018-12-12 14:54:16 +0000132 * #MBEDTLS_CAMELLIA_ENCRYPT or #MBEDTLS_CAMELLIA_DECRYPT.
Hanno Beckerf10905a2018-12-13 15:15:36 +0000133 * \param input The input block. This must be a readable buffer
Hanno Becker7a16aad2018-12-12 14:54:16 +0000134 * of size \c 16 Bytes.
Hanno Beckerf10905a2018-12-13 15:15:36 +0000135 * \param output The output block. This must be a writable buffer
Hanno Becker7a16aad2018-12-12 14:54:16 +0000136 * of size \c 16 Bytes.
Paul Bakker9af723c2014-05-01 13:03:14 +0200137 *
Hanno Becker7a16aad2018-12-12 14:54:16 +0000138 * \return \c 0 if successful.
139 * \return A negative error code on failure.
Paul Bakker38119b12009-01-10 23:31:23 +0000140 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200141int mbedtls_camellia_crypt_ecb( mbedtls_camellia_context *ctx,
Paul Bakker38119b12009-01-10 23:31:23 +0000142 int mode,
Paul Bakkerff60ee62010-03-16 21:09:09 +0000143 const unsigned char input[16],
Paul Bakker38119b12009-01-10 23:31:23 +0000144 unsigned char output[16] );
145
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200146#if defined(MBEDTLS_CIPHER_MODE_CBC)
Paul Bakker38119b12009-01-10 23:31:23 +0000147/**
Hanno Becker7a16aad2018-12-12 14:54:16 +0000148 * \brief Perform a CAMELLIA-CBC buffer encryption/decryption.
Paul Bakker38119b12009-01-10 23:31:23 +0000149 *
Manuel Pégourié-Gonnard2be147a2015-01-23 16:19:47 +0000150 * \note Upon exit, the content of the IV is updated so that you can
151 * call the function same function again on the following
152 * block(s) of data and get the same result as if it was
153 * encrypted in one call. This allows a "streaming" usage.
154 * If on the other hand you need to retain the contents of the
155 * IV, you should either save it manually or use the cipher
156 * module instead.
157 *
Hanno Beckerf10905a2018-12-13 15:15:36 +0000158 * \param ctx The CAMELLIA context to use. This must be initialized
Hanno Becker7a16aad2018-12-12 14:54:16 +0000159 * and bound to a key.
160 * \param mode The mode of operation. Possible values are
161 * #MBEDTLS_CAMELLIA_ENCRYPT or #MBEDTLS_CAMELLIA_DECRYPT.
162 * \param length The length in Bytes of the input data.
163 * Must be a multiple of \c 16.
164 * \param iv The initialization vector. This must be RW buffer
165 * of length \c 16 Bytes. It is updated to allow streaming
166 * use as explained above.
Hanno Beckerf10905a2018-12-13 15:15:36 +0000167 * \param input The buffer holding the input data. This must point to a
168 * readable buffer of length \p length Bytes. This may be
169 * \c NULL if `length == 0`.
170 * \param input The buffer holding the output data. This must point to a
171 * writable buffer of length \p length Bytes. This may be
172 * \c NULL if `length == 0`.
Paul Bakker9af723c2014-05-01 13:03:14 +0200173 *
Hanno Becker7a16aad2018-12-12 14:54:16 +0000174 * \return \c 0 if successful.
175 * \return A negative error code on failure.
Paul Bakker38119b12009-01-10 23:31:23 +0000176 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200177int mbedtls_camellia_crypt_cbc( mbedtls_camellia_context *ctx,
Paul Bakker38119b12009-01-10 23:31:23 +0000178 int mode,
Paul Bakker23986e52011-04-24 08:57:21 +0000179 size_t length,
Paul Bakker38119b12009-01-10 23:31:23 +0000180 unsigned char iv[16],
Paul Bakkerff60ee62010-03-16 21:09:09 +0000181 const unsigned char *input,
Paul Bakker38119b12009-01-10 23:31:23 +0000182 unsigned char *output );
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200183#endif /* MBEDTLS_CIPHER_MODE_CBC */
Paul Bakker38119b12009-01-10 23:31:23 +0000184
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200185#if defined(MBEDTLS_CIPHER_MODE_CFB)
Paul Bakker38119b12009-01-10 23:31:23 +0000186/**
Hanno Becker7a16aad2018-12-12 14:54:16 +0000187 * \brief Perform a CAMELLIA-CFB128 buffer encryption/decryption.
Paul Bakker38119b12009-01-10 23:31:23 +0000188 *
Hanno Becker7a16aad2018-12-12 14:54:16 +0000189 * \note Due to the nature of CFB you should use the same key
190 * schedule for both encryption and decryption. So a
191 * context initialized with mbedtls_camellia_setkey_enc()
192 * for both #MBEDTLS_CAMELLIA_ENCRYPT and
193 * #MBEDTLS_CAMELLIA_DECRYPT.
Paul Bakkerca6f3e22011-10-06 13:11:08 +0000194 *
Manuel Pégourié-Gonnard2be147a2015-01-23 16:19:47 +0000195 * \note Upon exit, the content of the IV is updated so that you can
196 * call the function same function again on the following
197 * block(s) of data and get the same result as if it was
198 * encrypted in one call. This allows a "streaming" usage.
199 * If on the other hand you need to retain the contents of the
200 * IV, you should either save it manually or use the cipher
201 * module instead.
202 *
Hanno Beckerf10905a2018-12-13 15:15:36 +0000203 * \param ctx The CAMELLIA context to use. This must be initialized
Hanno Becker7a16aad2018-12-12 14:54:16 +0000204 * and bound to a key.
205 * \param mode The mode of operation. Possible values are
206 * #MBEDTLS_CAMELLIA_ENCRYPT or #MBEDTLS_CAMELLIA_DECRYPT.
207 * \param length The length of the input data. Any value is allowed.
208 * \param iv_off The current offset in the IV. This must be smaller
209 * than \c 16. It is updated after this call to allow
210 * the aforementioned streaming usage.
Hanno Beckerf10905a2018-12-13 15:15:36 +0000211 * \param iv The initialization vector. This must be an RW buffer of
Hanno Becker7a16aad2018-12-12 14:54:16 +0000212 * length \c 16 Bytes. It is updated after this call to
213 * allow the aforementioned streaming usage.
Hanno Beckerf10905a2018-12-13 15:15:36 +0000214 * \param input The buffer holding the input data. This must be a readable
215 * buffer of size \p length Bytes. This may be \c NULL if
Hanno Becker7a16aad2018-12-12 14:54:16 +0000216 * \p length is \c 0.
Hanno Beckerf10905a2018-12-13 15:15:36 +0000217 * \param output The buffer to hold the output data. This must be a writable
218 * buffer of length \p length Bytes. This may be \c NULL if
Hanno Becker7a16aad2018-12-12 14:54:16 +0000219 * \p length is \c 0.
Paul Bakkerdcbfdcc2013-09-10 16:16:50 +0200220 *
Hanno Becker7a16aad2018-12-12 14:54:16 +0000221 * \return \c 0 if successful.
222 * \return A negative error code on failure.
Paul Bakker38119b12009-01-10 23:31:23 +0000223 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200224int mbedtls_camellia_crypt_cfb128( mbedtls_camellia_context *ctx,
Paul Bakker38119b12009-01-10 23:31:23 +0000225 int mode,
Paul Bakker23986e52011-04-24 08:57:21 +0000226 size_t length,
Paul Bakker1ef71df2011-06-09 14:14:58 +0000227 size_t *iv_off,
Paul Bakker38119b12009-01-10 23:31:23 +0000228 unsigned char iv[16],
Paul Bakkerff60ee62010-03-16 21:09:09 +0000229 const unsigned char *input,
Paul Bakker38119b12009-01-10 23:31:23 +0000230 unsigned char *output );
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200231#endif /* MBEDTLS_CIPHER_MODE_CFB */
Paul Bakker38119b12009-01-10 23:31:23 +0000232
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200233#if defined(MBEDTLS_CIPHER_MODE_CTR)
Paul Bakker9a736322012-11-14 12:39:52 +0000234/**
Hanno Becker7a16aad2018-12-12 14:54:16 +0000235 * \brief CAMELLIA-CTR buffer encryption/decryption
Paul Bakker1ef71df2011-06-09 14:14:58 +0000236 *
Hanno Becker7a16aad2018-12-12 14:54:16 +0000237 * \note Due to the nature of CTR you should use the same key
238 * schedule for both encryption and decryption. So a
239 * context initialized with mbedtls_camellia_setkey_enc()
240 * for both #MBEDTLS_CAMELLIA_ENCRYPT and
241 * #MBEDTLS_CAMELLIA_DECRYPT.
Paul Bakkerca6f3e22011-10-06 13:11:08 +0000242 *
Manuel Pégourié-Gonnard22997b72018-02-28 12:29:41 +0100243 * \warning You must never reuse a nonce value with the same key. Doing so
244 * would void the encryption for the two messages encrypted with
245 * the same nonce and key.
246 *
247 * There are two common strategies for managing nonces with CTR:
248 *
Manuel Pégourié-Gonnard4f24e952018-05-24 11:59:30 +0200249 * 1. You can handle everything as a single message processed over
250 * successive calls to this function. In that case, you want to
251 * set \p nonce_counter and \p nc_off to 0 for the first call, and
252 * then preserve the values of \p nonce_counter, \p nc_off and \p
253 * stream_block across calls to this function as they will be
254 * updated by this function.
Manuel Pégourié-Gonnard22997b72018-02-28 12:29:41 +0100255 *
Manuel Pégourié-Gonnard4f24e952018-05-24 11:59:30 +0200256 * With this strategy, you must not encrypt more than 2**128
257 * blocks of data with the same key.
258 *
259 * 2. You can encrypt separate messages by dividing the \p
260 * nonce_counter buffer in two areas: the first one used for a
261 * per-message nonce, handled by yourself, and the second one
262 * updated by this function internally.
263 *
264 * For example, you might reserve the first 12 bytes for the
265 * per-message nonce, and the last 4 bytes for internal use. In that
266 * case, before calling this function on a new message you need to
267 * set the first 12 bytes of \p nonce_counter to your chosen nonce
268 * value, the last 4 to 0, and \p nc_off to 0 (which will cause \p
269 * stream_block to be ignored). That way, you can encrypt at most
270 * 2**96 messages of up to 2**32 blocks each with the same key.
271 *
272 * The per-message nonce (or information sufficient to reconstruct
273 * it) needs to be communicated with the ciphertext and must be unique.
Hanno Beckerf10905a2018-12-13 15:15:36 +0000274 * unique. The recommended way to ensure uniqueness is to use a message
Manuel Pégourié-Gonnard4f24e952018-05-24 11:59:30 +0200275 * counter. An alternative is to generate random nonces, but this
276 * limits the number of messages that can be securely encrypted:
277 * for example, with 96-bit random nonces, you should not encrypt
278 * more than 2**32 messages with the same key.
279 *
280 * Note that for both stategies, sizes are measured in blocks and
Hanno Becker7a16aad2018-12-12 14:54:16 +0000281 * that a CAMELLIA block is \c 16 bytes.
Manuel Pégourié-Gonnard22997b72018-02-28 12:29:41 +0100282 *
Manuel Pégourié-Gonnardfa0c47d2018-05-24 19:02:06 +0200283 * \warning Upon return, \p stream_block contains sensitive data. Its
284 * content must not be written to insecure storage and should be
285 * securely discarded as soon as it's no longer needed.
286 *
Hanno Becker7a16aad2018-12-12 14:54:16 +0000287 * \param ctx The CAMELLIA context to use.
288 * \param length The length of the input data. Any value is allowed.
289 * \param nc_off The offset in the current \p stream_block (for resuming
Paul Bakker1ef71df2011-06-09 14:14:58 +0000290 * within current cipher stream). The offset pointer to
Hanno Becker7a16aad2018-12-12 14:54:16 +0000291 * should be \c 0 at the start of a stream. It is updated
292 * at the end of this call.
Hanno Beckerf10905a2018-12-13 15:15:36 +0000293 * \param nonce_counter The 128-bit nonce and counter. This must be an RW buffer
294 * of length \c 16 Bytes.
295 * \param stream_block The saved stream-block for resuming. This must be an
Hanno Becker7a16aad2018-12-12 14:54:16 +0000296 * RW buffer of length \c 16 Bytes.
Hanno Beckerf10905a2018-12-13 15:15:36 +0000297 * \param input The input data stream. This must be a readable buffer of
Hanno Becker7a16aad2018-12-12 14:54:16 +0000298 * size \p length Bytes. This may be \c NULL if \p length
299 * is \c 0.
Hanno Beckerf10905a2018-12-13 15:15:36 +0000300 * \param output The output data stream. This must be a writable buffer
301 * of size \p length Bytes. This may be \c NULL if
302 * \p length is \c 0.
Paul Bakker1ef71df2011-06-09 14:14:58 +0000303 *
Hanno Becker7a16aad2018-12-12 14:54:16 +0000304 * \return \c 0 if successful.
305 * \return A negative error code on failure.
Paul Bakker1ef71df2011-06-09 14:14:58 +0000306 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200307int mbedtls_camellia_crypt_ctr( mbedtls_camellia_context *ctx,
Paul Bakker1ef71df2011-06-09 14:14:58 +0000308 size_t length,
309 size_t *nc_off,
310 unsigned char nonce_counter[16],
311 unsigned char stream_block[16],
312 const unsigned char *input,
313 unsigned char *output );
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200314#endif /* MBEDTLS_CIPHER_MODE_CTR */
Paul Bakker1ef71df2011-06-09 14:14:58 +0000315
Paul Bakker38119b12009-01-10 23:31:23 +0000316/**
317 * \brief Checkup routine
318 *
319 * \return 0 if successful, or 1 if the test failed
320 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200321int mbedtls_camellia_self_test( int verbose );
Paul Bakker38119b12009-01-10 23:31:23 +0000322
323#ifdef __cplusplus
324}
325#endif
326
327#endif /* camellia.h */