blob: abb8a3d7642ba541aa0df3b28568fa6dca19be24 [file] [log] [blame]
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +00001/**
2 * \file aria.h
3 *
4 * \brief ARIA block cipher
5 *
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +01006 * The ARIA algorithm is a symmetric block cipher that can encrypt and
7 * decrypt information. It is defined by the Korean Agency for
8 * Technology and Standards (KATS) in <em>KS X 1213:2004</em> (in
9 * Korean, but see http://210.104.33.10/ARIA/index-e.html in English)
10 * and also described by the IETF in <em>RFC 5794</em>.
11 */
Bence Szépkúti86974652020-06-15 11:59:37 +020012/*
Bence Szépkúti1e148272020-08-07 13:07:28 +020013 * Copyright The Mbed TLS Contributors
Dave Rodgman16799db2023-11-02 19:47:20 +000014 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000015 */
16
17#ifndef MBEDTLS_ARIA_H
18#define MBEDTLS_ARIA_H
Mateusz Starzyk846f0212021-05-19 19:44:07 +020019#include "mbedtls/private_access.h"
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000020
Bence Szépkútic662b362021-05-27 11:25:03 +020021#include "mbedtls/build_info.h"
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000022
23#include <stddef.h>
24#include <stdint.h>
25
Jaeden Ameroc49fbbf2019-07-04 20:01:14 +010026#include "mbedtls/platform_util.h"
Andrzej Kurekc470b6b2019-01-31 08:20:20 -050027
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +010028#define MBEDTLS_ARIA_ENCRYPT 1 /**< ARIA encryption. */
29#define MBEDTLS_ARIA_DECRYPT 0 /**< ARIA decryption. */
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000030
Manuel Pégourié-Gonnard8abc3492018-03-01 10:02:47 +010031#define MBEDTLS_ARIA_BLOCKSIZE 16 /**< ARIA block size in bytes. */
Shaun Case8b0ecbc2021-12-20 21:14:10 -080032#define MBEDTLS_ARIA_MAX_ROUNDS 16 /**< Maximum number of rounds in ARIA. */
Manuel Pégourié-Gonnard8abc3492018-03-01 10:02:47 +010033#define MBEDTLS_ARIA_MAX_KEYSIZE 32 /**< Maximum size of an ARIA key in bytes. */
Manuel Pégourié-Gonnard5ad88b62018-03-01 09:20:47 +010034
Gilles Peskined2971572021-07-26 18:48:10 +020035/** Bad input data. */
36#define MBEDTLS_ERR_ARIA_BAD_INPUT_DATA -0x005C
Andrzej Kurekc470b6b2019-01-31 08:20:20 -050037
Gilles Peskined2971572021-07-26 18:48:10 +020038/** Invalid data input length. */
39#define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E
Ron Eldor9924bdc2018-10-04 10:59:13 +030040
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000041#ifdef __cplusplus
42extern "C" {
43#endif
44
Gilles Peskine59392b02021-05-24 22:58:37 +020045#if !defined(MBEDTLS_ARIA_ALT)
46// Regular implementation
47//
48
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000049/**
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +010050 * \brief The ARIA context-type definition.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000051 */
Gilles Peskine449bd832023-01-11 14:50:10 +010052typedef struct mbedtls_aria_context {
Mateusz Starzyk846f0212021-05-19 19:44:07 +020053 unsigned char MBEDTLS_PRIVATE(nr); /*!< The number of rounds (12, 14 or 16) */
Manuel Pégourié-Gonnard5ad88b62018-03-01 09:20:47 +010054 /*! The ARIA round keys. */
Mateusz Starzyk846f0212021-05-19 19:44:07 +020055 uint32_t MBEDTLS_PRIVATE(rk)[MBEDTLS_ARIA_MAX_ROUNDS + 1][MBEDTLS_ARIA_BLOCKSIZE / 4];
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000056}
57mbedtls_aria_context;
58
Manuel Pégourié-Gonnard0960b802018-05-22 15:22:07 +020059#else /* MBEDTLS_ARIA_ALT */
60#include "aria_alt.h"
61#endif /* MBEDTLS_ARIA_ALT */
62
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000063/**
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +010064 * \brief This function initializes the specified ARIA context.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000065 *
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +010066 * It must be the first API called before using
67 * the context.
68 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -050069 * \param ctx The ARIA context to initialize. This must not be \c NULL.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000070 */
Gilles Peskine449bd832023-01-11 14:50:10 +010071void mbedtls_aria_init(mbedtls_aria_context *ctx);
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000072
73/**
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +010074 * \brief This function releases and clears the specified ARIA context.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000075 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -050076 * \param ctx The ARIA context to clear. This may be \c NULL, in which
77 * case this function returns immediately. If it is not \c NULL,
78 * it must point to an initialized ARIA context.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000079 */
Gilles Peskine449bd832023-01-11 14:50:10 +010080void mbedtls_aria_free(mbedtls_aria_context *ctx);
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000081
82/**
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +010083 * \brief This function sets the encryption key.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000084 *
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +010085 * \param ctx The ARIA context to which the key should be bound.
Andrzej Kurekc470b6b2019-01-31 08:20:20 -050086 * This must be initialized.
87 * \param key The encryption key. This must be a readable buffer
88 * of size \p keybits Bits.
89 * \param keybits The size of \p key in Bits. Valid options are:
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +010090 * <ul><li>128 bits</li>
91 * <li>192 bits</li>
92 * <li>256 bits</li></ul>
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000093 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -050094 * \return \c 0 on success.
95 * \return A negative error code on failure.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +000096 */
Gilles Peskine449bd832023-01-11 14:50:10 +010097int mbedtls_aria_setkey_enc(mbedtls_aria_context *ctx,
98 const unsigned char *key,
99 unsigned int keybits);
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000100
101/**
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100102 * \brief This function sets the decryption key.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000103 *
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100104 * \param ctx The ARIA context to which the key should be bound.
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500105 * This must be initialized.
106 * \param key The decryption key. This must be a readable buffer
107 * of size \p keybits Bits.
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100108 * \param keybits The size of data passed. Valid options are:
109 * <ul><li>128 bits</li>
110 * <li>192 bits</li>
111 * <li>256 bits</li></ul>
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000112 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500113 * \return \c 0 on success.
114 * \return A negative error code on failure.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000115 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100116int mbedtls_aria_setkey_dec(mbedtls_aria_context *ctx,
117 const unsigned char *key,
118 unsigned int keybits);
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000119
120/**
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100121 * \brief This function performs an ARIA single-block encryption or
122 * decryption operation.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000123 *
Manuel Pégourié-Gonnard08c337d2018-05-22 13:18:01 +0200124 * It performs encryption or decryption (depending on whether
125 * the key was set for encryption on decryption) on the input
126 * data buffer defined in the \p input parameter.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000127 *
Manuel Pégourié-Gonnard9d410732018-05-22 12:49:22 +0200128 * mbedtls_aria_init(), and either mbedtls_aria_setkey_enc() or
129 * mbedtls_aria_setkey_dec() must be called before the first
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100130 * call to this API with the same context.
131 *
132 * \param ctx The ARIA context to use for encryption or decryption.
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500133 * This must be initialized and bound to a key.
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100134 * \param input The 16-Byte buffer holding the input data.
135 * \param output The 16-Byte buffer holding the output data.
136
137 * \return \c 0 on success.
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500138 * \return A negative error code on failure.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000139 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100140int mbedtls_aria_crypt_ecb(mbedtls_aria_context *ctx,
141 const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE],
142 unsigned char output[MBEDTLS_ARIA_BLOCKSIZE]);
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000143
144#if defined(MBEDTLS_CIPHER_MODE_CBC)
145/**
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100146 * \brief This function performs an ARIA-CBC encryption or decryption operation
147 * on full blocks.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000148 *
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100149 * It performs the operation defined in the \p mode
150 * parameter (encrypt/decrypt), on the input data buffer defined in
151 * the \p input parameter.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000152 *
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100153 * It can be called as many times as needed, until all the input
Manuel Pégourié-Gonnard9d410732018-05-22 12:49:22 +0200154 * data is processed. mbedtls_aria_init(), and either
155 * mbedtls_aria_setkey_enc() or mbedtls_aria_setkey_dec() must be called
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100156 * before the first call to this API with the same context.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000157 *
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100158 * \note This function operates on aligned blocks, that is, the input size
159 * must be a multiple of the ARIA block size of 16 Bytes.
160 *
161 * \note Upon exit, the content of the IV is updated so that you can
162 * call the same function again on the next
163 * block(s) of data and get the same result as if it was
164 * encrypted in one call. This allows a "streaming" usage.
165 * If you need to retain the contents of the IV, you should
166 * either save it manually or use the cipher module instead.
167 *
168 *
169 * \param ctx The ARIA context to use for encryption or decryption.
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500170 * This must be initialized and bound to a key.
171 * \param mode The mode of operation. This must be either
172 * #MBEDTLS_ARIA_ENCRYPT for encryption, or
173 * #MBEDTLS_ARIA_DECRYPT for decryption.
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100174 * \param length The length of the input data in Bytes. This must be a
175 * multiple of the block size (16 Bytes).
176 * \param iv Initialization vector (updated after use).
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500177 * This must be a readable buffer of size 16 Bytes.
178 * \param input The buffer holding the input data. This must
179 * be a readable buffer of length \p length Bytes.
180 * \param output The buffer holding the output data. This must
181 * be a writable buffer of length \p length Bytes.
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100182 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500183 * \return \c 0 on success.
184 * \return A negative error code on failure.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000185 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100186int mbedtls_aria_crypt_cbc(mbedtls_aria_context *ctx,
187 int mode,
188 size_t length,
189 unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
190 const unsigned char *input,
191 unsigned char *output);
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000192#endif /* MBEDTLS_CIPHER_MODE_CBC */
193
194#if defined(MBEDTLS_CIPHER_MODE_CFB)
195/**
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100196 * \brief This function performs an ARIA-CFB128 encryption or decryption
197 * operation.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000198 *
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100199 * It performs the operation defined in the \p mode
200 * parameter (encrypt or decrypt), on the input data buffer
201 * defined in the \p input parameter.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000202 *
Manuel Pégourié-Gonnard9d410732018-05-22 12:49:22 +0200203 * For CFB, you must set up the context with mbedtls_aria_setkey_enc(),
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100204 * regardless of whether you are performing an encryption or decryption
205 * operation, that is, regardless of the \p mode parameter. This is
206 * because CFB mode uses the same key schedule for encryption and
207 * decryption.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000208 *
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100209 * \note Upon exit, the content of the IV is updated so that you can
210 * call the same function again on the next
211 * block(s) of data and get the same result as if it was
212 * encrypted in one call. This allows a "streaming" usage.
213 * If you need to retain the contents of the
214 * IV, you must either save it manually or use the cipher
215 * module instead.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000216 *
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100217 *
218 * \param ctx The ARIA context to use for encryption or decryption.
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500219 * This must be initialized and bound to a key.
220 * \param mode The mode of operation. This must be either
221 * #MBEDTLS_ARIA_ENCRYPT for encryption, or
222 * #MBEDTLS_ARIA_DECRYPT for decryption.
223 * \param length The length of the input data \p input in Bytes.
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100224 * \param iv_off The offset in IV (updated after use).
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500225 * This must not be larger than 15.
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100226 * \param iv The initialization vector (updated after use).
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500227 * This must be a readable buffer of size 16 Bytes.
228 * \param input The buffer holding the input data. This must
229 * be a readable buffer of length \p length Bytes.
230 * \param output The buffer holding the output data. This must
231 * be a writable buffer of length \p length Bytes.
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100232 *
233 * \return \c 0 on success.
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500234 * \return A negative error code on failure.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000235 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100236int mbedtls_aria_crypt_cfb128(mbedtls_aria_context *ctx,
237 int mode,
238 size_t length,
239 size_t *iv_off,
240 unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
241 const unsigned char *input,
242 unsigned char *output);
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000243#endif /* MBEDTLS_CIPHER_MODE_CFB */
244
245#if defined(MBEDTLS_CIPHER_MODE_CTR)
246/**
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100247 * \brief This function performs an ARIA-CTR encryption or decryption
248 * operation.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000249 *
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100250 * Due to the nature of CTR, you must use the same key schedule
251 * for both encryption and decryption operations. Therefore, you
Manuel Pégourié-Gonnard9d410732018-05-22 12:49:22 +0200252 * must use the context initialized with mbedtls_aria_setkey_enc()
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100253 * for both #MBEDTLS_ARIA_ENCRYPT and #MBEDTLS_ARIA_DECRYPT.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000254 *
Manuel Pégourié-Gonnard22997b72018-02-28 12:29:41 +0100255 * \warning You must never reuse a nonce value with the same key. Doing so
256 * would void the encryption for the two messages encrypted with
257 * the same nonce and key.
258 *
259 * There are two common strategies for managing nonces with CTR:
260 *
Manuel Pégourié-Gonnard8a1b2c82018-05-23 13:26:22 +0200261 * 1. You can handle everything as a single message processed over
262 * successive calls to this function. In that case, you want to
263 * set \p nonce_counter and \p nc_off to 0 for the first call, and
264 * then preserve the values of \p nonce_counter, \p nc_off and \p
265 * stream_block across calls to this function as they will be
266 * updated by this function.
267 *
268 * With this strategy, you must not encrypt more than 2**128
Manuel Pégourié-Gonnardf5842862018-05-24 11:51:58 +0200269 * blocks of data with the same key.
Manuel Pégourié-Gonnard22997b72018-02-28 12:29:41 +0100270 *
Manuel Pégourié-Gonnard8a1b2c82018-05-23 13:26:22 +0200271 * 2. You can encrypt separate messages by dividing the \p
272 * nonce_counter buffer in two areas: the first one used for a
273 * per-message nonce, handled by yourself, and the second one
274 * updated by this function internally.
275 *
276 * For example, you might reserve the first 12 bytes for the
277 * per-message nonce, and the last 4 bytes for internal use. In that
278 * case, before calling this function on a new message you need to
279 * set the first 12 bytes of \p nonce_counter to your chosen nonce
280 * value, the last 4 to 0, and \p nc_off to 0 (which will cause \p
281 * stream_block to be ignored). That way, you can encrypt at most
Manuel Pégourié-Gonnardf5842862018-05-24 11:51:58 +0200282 * 2**96 messages of up to 2**32 blocks each with the same key.
Manuel Pégourié-Gonnard8a1b2c82018-05-23 13:26:22 +0200283 *
284 * The per-message nonce (or information sufficient to reconstruct
285 * it) needs to be communicated with the ciphertext and must be unique.
286 * The recommended way to ensure uniqueness is to use a message
287 * counter. An alternative is to generate random nonces, but this
288 * limits the number of messages that can be securely encrypted:
289 * for example, with 96-bit random nonces, you should not encrypt
290 * more than 2**32 messages with the same key.
291 *
Tom Cosgrove1e211442022-05-26 11:51:00 +0100292 * Note that for both strategies, sizes are measured in blocks and
Manuel Pégourié-Gonnardf5842862018-05-24 11:51:58 +0200293 * that an ARIA block is 16 bytes.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000294 *
Manuel Pégourié-Gonnardfa0c47d2018-05-24 19:02:06 +0200295 * \warning Upon return, \p stream_block contains sensitive data. Its
Manuel Pégourié-Gonnard8a1b2c82018-05-23 13:26:22 +0200296 * content must not be written to insecure storage and should be
297 * securely discarded as soon as it's no longer needed.
298 *
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100299 * \param ctx The ARIA context to use for encryption or decryption.
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500300 * This must be initialized and bound to a key.
301 * \param length The length of the input data \p input in Bytes.
302 * \param nc_off The offset in Bytes in the current \p stream_block,
303 * for resuming within the current cipher stream. The
304 * offset pointer should be \c 0 at the start of a
305 * stream. This must not be larger than \c 15 Bytes.
306 * \param nonce_counter The 128-bit nonce and counter. This must point to
307 * a read/write buffer of length \c 16 bytes.
308 * \param stream_block The saved stream block for resuming. This must
309 * point to a read/write buffer of length \c 16 bytes.
310 * This is overwritten by the function.
311 * \param input The buffer holding the input data. This must
312 * be a readable buffer of length \p length Bytes.
313 * \param output The buffer holding the output data. This must
314 * be a writable buffer of length \p length Bytes.
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100315 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500316 * \return \c 0 on success.
317 * \return A negative error code on failure.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000318 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100319int mbedtls_aria_crypt_ctr(mbedtls_aria_context *ctx,
320 size_t length,
321 size_t *nc_off,
322 unsigned char nonce_counter[MBEDTLS_ARIA_BLOCKSIZE],
323 unsigned char stream_block[MBEDTLS_ARIA_BLOCKSIZE],
324 const unsigned char *input,
325 unsigned char *output);
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000326#endif /* MBEDTLS_CIPHER_MODE_CTR */
327
Manuel Pégourié-Gonnardc0893122018-05-22 15:17:20 +0200328#if defined(MBEDTLS_SELF_TEST)
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000329/**
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100330 * \brief Checkup routine.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000331 *
Manuel Pégourié-Gonnard5aa4e3b2018-02-28 11:55:49 +0100332 * \return \c 0 on success, or \c 1 on failure.
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000333 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100334int mbedtls_aria_self_test(int verbose);
Manuel Pégourié-Gonnardc0893122018-05-22 15:17:20 +0200335#endif /* MBEDTLS_SELF_TEST */
Markku-Juhani O. Saarinen41efbaa2017-11-30 11:37:55 +0000336
337#ifdef __cplusplus
338}
339#endif
340
341#endif /* aria.h */