Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 1 | /** |
| 2 | * \file aria.h |
| 3 | * |
| 4 | * \brief ARIA block cipher |
| 5 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 6 | * 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 | */ |
| 12 | /* Copyright (C) 2006-2018, ARM Limited, All Rights Reserved |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 13 | * SPDX-License-Identifier: Apache-2.0 |
| 14 | * |
| 15 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 16 | * not use this file except in compliance with the License. |
| 17 | * You may obtain a copy of the License at |
| 18 | * |
| 19 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 20 | * |
| 21 | * Unless required by applicable law or agreed to in writing, software |
| 22 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 23 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 24 | * See the License for the specific language governing permissions and |
| 25 | * limitations under the License. |
| 26 | * |
| 27 | * This file is part of mbed TLS (https://tls.mbed.org) |
| 28 | */ |
| 29 | |
| 30 | #ifndef MBEDTLS_ARIA_H |
| 31 | #define MBEDTLS_ARIA_H |
| 32 | |
| 33 | #if !defined(MBEDTLS_CONFIG_FILE) |
| 34 | #include "config.h" |
| 35 | #else |
| 36 | #include MBEDTLS_CONFIG_FILE |
| 37 | #endif |
| 38 | |
| 39 | #include <stddef.h> |
| 40 | #include <stdint.h> |
| 41 | |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 42 | #define MBEDTLS_ARIA_ENCRYPT 1 /**< ARIA encryption. */ |
| 43 | #define MBEDTLS_ARIA_DECRYPT 0 /**< ARIA decryption. */ |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 44 | |
Manuel Pégourié-Gonnard | 5ad88b6 | 2018-03-01 09:20:47 +0100 | [diff] [blame^] | 45 | #define MBEDTLS_ARIA_BLOCKSIZE 16 /**< ARIA block size in bytes. */ |
| 46 | #define MBEDTLS_ARIA_MAX_ROUNDS 16 /**< Maxiumum number of rounds in ARIA. */ |
| 47 | |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 48 | #define MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH -0x005C /**< Invalid key length. */ |
| 49 | #define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E /**< Invalid data input length. */ |
Manuel Pégourié-Gonnard | 3c80009 | 2018-03-01 09:02:16 +0100 | [diff] [blame] | 50 | #define MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE -0x005A /**< Feature not available. For example, an unsupported ARIA key size. */ |
| 51 | #define MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED -0x0058 /**< ARIA hardware accelerator failed. */ |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 52 | |
| 53 | #if !defined(MBEDTLS_ARIA_ALT) |
| 54 | // Regular implementation |
| 55 | // |
| 56 | |
| 57 | #ifdef __cplusplus |
| 58 | extern "C" { |
| 59 | #endif |
| 60 | |
| 61 | /** |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 62 | * \brief The ARIA context-type definition. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 63 | */ |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 64 | typedef struct |
| 65 | { |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 66 | int nr; /*!< The number of rounds (12, 14 or 16) */ |
Manuel Pégourié-Gonnard | 5ad88b6 | 2018-03-01 09:20:47 +0100 | [diff] [blame^] | 67 | /*! The ARIA round keys. */ |
| 68 | uint32_t rk[MBEDTLS_ARIA_MAX_ROUNDS + 1][MBEDTLS_ARIA_BLOCKSIZE / 4]; |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 69 | } |
| 70 | mbedtls_aria_context; |
| 71 | |
| 72 | /** |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 73 | * \brief This function initializes the specified ARIA context. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 74 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 75 | * It must be the first API called before using |
| 76 | * the context. |
| 77 | * |
| 78 | * \param ctx The ARIA context to initialize. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 79 | */ |
| 80 | void mbedtls_aria_init( mbedtls_aria_context *ctx ); |
| 81 | |
| 82 | /** |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 83 | * \brief This function releases and clears the specified ARIA context. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 84 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 85 | * \param ctx The ARIA context to clear. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 86 | */ |
| 87 | void mbedtls_aria_free( mbedtls_aria_context *ctx ); |
| 88 | |
| 89 | /** |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 90 | * \brief This function sets the encryption key. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 91 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 92 | * \param ctx The ARIA context to which the key should be bound. |
| 93 | * \param key The encryption key. |
| 94 | * \param keybits The size of data passed in bits. Valid options are: |
| 95 | * <ul><li>128 bits</li> |
| 96 | * <li>192 bits</li> |
| 97 | * <li>256 bits</li></ul> |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 98 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 99 | * \return \c 0 on success or #MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH |
| 100 | * on failure. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 101 | */ |
Manuel Pégourié-Gonnard | 4231e7f | 2018-02-28 10:54:31 +0100 | [diff] [blame] | 102 | int mbedtls_aria_setkey_enc( mbedtls_aria_context *ctx, |
| 103 | const unsigned char *key, |
| 104 | unsigned int keybits ); |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 105 | |
| 106 | /** |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 107 | * \brief This function sets the decryption key. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 108 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 109 | * \param ctx The ARIA context to which the key should be bound. |
| 110 | * \param key The decryption key. |
| 111 | * \param keybits The size of data passed. Valid options are: |
| 112 | * <ul><li>128 bits</li> |
| 113 | * <li>192 bits</li> |
| 114 | * <li>256 bits</li></ul> |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 115 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 116 | * \return \c 0 on success, or #MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH on failure. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 117 | */ |
Manuel Pégourié-Gonnard | 4231e7f | 2018-02-28 10:54:31 +0100 | [diff] [blame] | 118 | int mbedtls_aria_setkey_dec( mbedtls_aria_context *ctx, |
| 119 | const unsigned char *key, |
| 120 | unsigned int keybits ); |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 121 | |
| 122 | /** |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 123 | * \brief This function performs an ARIA single-block encryption or |
| 124 | * decryption operation. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 125 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 126 | * It performs the operation defined in the \p mode parameter |
| 127 | * (encrypt or decrypt), on the input data buffer defined in |
| 128 | * the \p input parameter. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 129 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 130 | * mbedtls_aes_init(), and either mbedtls_aes_setkey_enc() or |
| 131 | * mbedtls_aes_setkey_dec() must be called before the first |
| 132 | * call to this API with the same context. |
| 133 | * |
| 134 | * \param ctx The ARIA context to use for encryption or decryption. |
| 135 | * \param mode The ARIA operation: #MBEDTLS_ARIA_ENCRYPT or |
| 136 | * #MBEDTLS_ARIA_DECRYPT. |
| 137 | * \param input The 16-Byte buffer holding the input data. |
| 138 | * \param output The 16-Byte buffer holding the output data. |
| 139 | |
| 140 | * \return \c 0 on success. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 141 | */ |
| 142 | int mbedtls_aria_crypt_ecb( mbedtls_aria_context *ctx, |
Manuel Pégourié-Gonnard | 4231e7f | 2018-02-28 10:54:31 +0100 | [diff] [blame] | 143 | int mode, |
Manuel Pégourié-Gonnard | 5ad88b6 | 2018-03-01 09:20:47 +0100 | [diff] [blame^] | 144 | const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE], |
| 145 | unsigned char output[MBEDTLS_ARIA_BLOCKSIZE] ); |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 146 | |
| 147 | #if defined(MBEDTLS_CIPHER_MODE_CBC) |
| 148 | /** |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 149 | * \brief This function performs an ARIA-CBC encryption or decryption operation |
| 150 | * on full blocks. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 151 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 152 | * It performs the operation defined in the \p mode |
| 153 | * parameter (encrypt/decrypt), on the input data buffer defined in |
| 154 | * the \p input parameter. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 155 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 156 | * It can be called as many times as needed, until all the input |
| 157 | * data is processed. mbedtls_aes_init(), and either |
| 158 | * mbedtls_aes_setkey_enc() or mbedtls_aes_setkey_dec() must be called |
| 159 | * before the first call to this API with the same context. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 160 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 161 | * \note This function operates on aligned blocks, that is, the input size |
| 162 | * must be a multiple of the ARIA block size of 16 Bytes. |
| 163 | * |
| 164 | * \note Upon exit, the content of the IV is updated so that you can |
| 165 | * call the same function again on the next |
| 166 | * block(s) of data and get the same result as if it was |
| 167 | * encrypted in one call. This allows a "streaming" usage. |
| 168 | * If you need to retain the contents of the IV, you should |
| 169 | * either save it manually or use the cipher module instead. |
| 170 | * |
| 171 | * |
| 172 | * \param ctx The ARIA context to use for encryption or decryption. |
| 173 | * \param mode The ARIA operation: #MBEDTLS_ARIA_ENCRYPT or |
| 174 | * #MBEDTLS_ARIA_DECRYPT. |
| 175 | * \param length The length of the input data in Bytes. This must be a |
| 176 | * multiple of the block size (16 Bytes). |
| 177 | * \param iv Initialization vector (updated after use). |
| 178 | * \param input The buffer holding the input data. |
| 179 | * \param output The buffer holding the output data. |
| 180 | * |
| 181 | * \return \c 0 on success, or #MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH |
| 182 | * on failure. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 183 | */ |
| 184 | int mbedtls_aria_crypt_cbc( mbedtls_aria_context *ctx, |
Manuel Pégourié-Gonnard | 4231e7f | 2018-02-28 10:54:31 +0100 | [diff] [blame] | 185 | int mode, |
| 186 | size_t length, |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 187 | unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE], |
Manuel Pégourié-Gonnard | 4231e7f | 2018-02-28 10:54:31 +0100 | [diff] [blame] | 188 | const unsigned char *input, |
| 189 | unsigned char *output ); |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 190 | #endif /* MBEDTLS_CIPHER_MODE_CBC */ |
| 191 | |
| 192 | #if defined(MBEDTLS_CIPHER_MODE_CFB) |
| 193 | /** |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 194 | * \brief This function performs an ARIA-CFB128 encryption or decryption |
| 195 | * operation. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 196 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 197 | * It performs the operation defined in the \p mode |
| 198 | * parameter (encrypt or decrypt), on the input data buffer |
| 199 | * defined in the \p input parameter. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 200 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 201 | * For CFB, you must set up the context with mbedtls_aes_setkey_enc(), |
| 202 | * regardless of whether you are performing an encryption or decryption |
| 203 | * operation, that is, regardless of the \p mode parameter. This is |
| 204 | * because CFB mode uses the same key schedule for encryption and |
| 205 | * decryption. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 206 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 207 | * \note Upon exit, the content of the IV is updated so that you can |
| 208 | * call the same function again on the next |
| 209 | * block(s) of data and get the same result as if it was |
| 210 | * encrypted in one call. This allows a "streaming" usage. |
| 211 | * If you need to retain the contents of the |
| 212 | * IV, you must either save it manually or use the cipher |
| 213 | * module instead. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 214 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 215 | * |
| 216 | * \param ctx The ARIA context to use for encryption or decryption. |
| 217 | * \param mode The ARIA operation: #MBEDTLS_ARIA_ENCRYPT or |
| 218 | * #MBEDTLS_ARIA_DECRYPT. |
| 219 | * \param length The length of the input data. |
| 220 | * \param iv_off The offset in IV (updated after use). |
| 221 | * \param iv The initialization vector (updated after use). |
| 222 | * \param input The buffer holding the input data. |
| 223 | * \param output The buffer holding the output data. |
| 224 | * |
| 225 | * \return \c 0 on success. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 226 | */ |
| 227 | int mbedtls_aria_crypt_cfb128( mbedtls_aria_context *ctx, |
Manuel Pégourié-Gonnard | 4231e7f | 2018-02-28 10:54:31 +0100 | [diff] [blame] | 228 | int mode, |
| 229 | size_t length, |
| 230 | size_t *iv_off, |
Manuel Pégourié-Gonnard | 5ad88b6 | 2018-03-01 09:20:47 +0100 | [diff] [blame^] | 231 | unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE], |
Manuel Pégourié-Gonnard | 4231e7f | 2018-02-28 10:54:31 +0100 | [diff] [blame] | 232 | const unsigned char *input, |
| 233 | unsigned char *output ); |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 234 | #endif /* MBEDTLS_CIPHER_MODE_CFB */ |
| 235 | |
| 236 | #if defined(MBEDTLS_CIPHER_MODE_CTR) |
| 237 | /** |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 238 | * \brief This function performs an ARIA-CTR encryption or decryption |
| 239 | * operation. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 240 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 241 | * This function performs the operation defined in the \p mode |
| 242 | * parameter (encrypt/decrypt), on the input data buffer |
| 243 | * defined in the \p input parameter. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 244 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 245 | * Due to the nature of CTR, you must use the same key schedule |
| 246 | * for both encryption and decryption operations. Therefore, you |
| 247 | * must use the context initialized with mbedtls_aes_setkey_enc() |
| 248 | * for both #MBEDTLS_ARIA_ENCRYPT and #MBEDTLS_ARIA_DECRYPT. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 249 | * |
Manuel Pégourié-Gonnard | 22997b7 | 2018-02-28 12:29:41 +0100 | [diff] [blame] | 250 | * \warning You must never reuse a nonce value with the same key. Doing so |
| 251 | * would void the encryption for the two messages encrypted with |
| 252 | * the same nonce and key. |
| 253 | * |
| 254 | * There are two common strategies for managing nonces with CTR: |
| 255 | * |
| 256 | * 1. Use a counter starting at 0 or a random value. With this |
| 257 | * strategy, this function will increment the counter for you, so |
| 258 | * you only need to preserve the \p nonce_counter buffer between |
| 259 | * calls. With this strategy, you must not encrypt more than |
| 260 | * 2**128 blocks of data. |
| 261 | * 2. Use a randomly-generated \p nonce_counter for each call. |
| 262 | * With this strategy, you need to ensure the nonce is generated |
| 263 | * in an unbiased way and you must not encrypt more than 2**64 |
| 264 | * block of data. |
| 265 | * |
| 266 | * Note that for both stategies, the limit is in number of blocks |
| 267 | * and that an ARIA block is 16 bytes. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 268 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 269 | * \param ctx The ARIA context to use for encryption or decryption. |
| 270 | * \param length The length of the input data. |
| 271 | * \param nc_off The offset in the current \p stream_block, for |
| 272 | * resuming within the current cipher stream. The |
| 273 | * offset pointer should be 0 at the start of a stream. |
| 274 | * \param nonce_counter The 128-bit nonce and counter. |
| 275 | * \param stream_block The saved stream block for resuming. This is |
| 276 | * overwritten by the function. |
| 277 | * \param input The buffer holding the input data. |
| 278 | * \param output The buffer holding the output data. |
| 279 | * |
| 280 | * \return \c 0 on success. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 281 | */ |
| 282 | int mbedtls_aria_crypt_ctr( mbedtls_aria_context *ctx, |
Manuel Pégourié-Gonnard | 4231e7f | 2018-02-28 10:54:31 +0100 | [diff] [blame] | 283 | size_t length, |
| 284 | size_t *nc_off, |
Manuel Pégourié-Gonnard | 5ad88b6 | 2018-03-01 09:20:47 +0100 | [diff] [blame^] | 285 | unsigned char nonce_counter[MBEDTLS_ARIA_BLOCKSIZE], |
| 286 | unsigned char stream_block[MBEDTLS_ARIA_BLOCKSIZE], |
Manuel Pégourié-Gonnard | 4231e7f | 2018-02-28 10:54:31 +0100 | [diff] [blame] | 287 | const unsigned char *input, |
| 288 | unsigned char *output ); |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 289 | #endif /* MBEDTLS_CIPHER_MODE_CTR */ |
| 290 | |
| 291 | #ifdef __cplusplus |
| 292 | } |
| 293 | #endif |
| 294 | |
| 295 | #else /* MBEDTLS_ARIA_ALT */ |
| 296 | #include "aria_alt.h" |
| 297 | #endif /* MBEDTLS_ARIA_ALT */ |
| 298 | |
| 299 | #ifdef __cplusplus |
| 300 | extern "C" { |
| 301 | #endif |
| 302 | |
| 303 | /** |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 304 | * \brief Checkup routine. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 305 | * |
Manuel Pégourié-Gonnard | 5aa4e3b | 2018-02-28 11:55:49 +0100 | [diff] [blame] | 306 | * \return \c 0 on success, or \c 1 on failure. |
Markku-Juhani O. Saarinen | 41efbaa | 2017-11-30 11:37:55 +0000 | [diff] [blame] | 307 | */ |
| 308 | int mbedtls_aria_self_test( int verbose ); |
| 309 | |
| 310 | #ifdef __cplusplus |
| 311 | } |
| 312 | #endif |
| 313 | |
| 314 | #endif /* aria.h */ |