Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 1 | /** |
| 2 | * \file aes.h |
Paul Bakker | e0ccd0a | 2009-01-04 16:27:10 +0000 | [diff] [blame] | 3 | * |
Rose Zadik | 5ad7aea | 2018-03-26 12:00:09 +0100 | [diff] [blame] | 4 | * \brief This file contains AES definitions and functions. |
| 5 | * |
| 6 | * The Advanced Encryption Standard (AES) specifies a FIPS-approved |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 7 | * cryptographic algorithm that can be used to protect electronic |
| 8 | * data. |
| 9 | * |
| 10 | * The AES algorithm is a symmetric block cipher that can |
| 11 | * encrypt and decrypt information. For more information, see |
| 12 | * <em>FIPS Publication 197: Advanced Encryption Standard</em> and |
| 13 | * <em>ISO/IEC 18033-2:2006: Information technology -- Security |
| 14 | * techniques -- Encryption algorithms -- Part 2: Asymmetric |
| 15 | * ciphers</em>. |
Darryl Green | a40a101 | 2018-01-05 15:33:17 +0000 | [diff] [blame] | 16 | */ |
Rose Zadik | 5ad7aea | 2018-03-26 12:00:09 +0100 | [diff] [blame] | 17 | |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 18 | /* Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved. |
Manuel Pégourié-Gonnard | 37ff140 | 2015-09-04 14:21:07 +0200 | [diff] [blame] | 19 | * SPDX-License-Identifier: Apache-2.0 |
| 20 | * |
| 21 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 22 | * not use this file except in compliance with the License. |
| 23 | * You may obtain a copy of the License at |
| 24 | * |
| 25 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 26 | * |
| 27 | * Unless required by applicable law or agreed to in writing, software |
| 28 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 29 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 30 | * See the License for the specific language governing permissions and |
| 31 | * limitations under the License. |
Paul Bakker | b96f154 | 2010-07-18 20:36:00 +0000 | [diff] [blame] | 32 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 33 | * This file is part of Mbed TLS (https://tls.mbed.org) |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 34 | */ |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 35 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 36 | #ifndef MBEDTLS_AES_H |
| 37 | #define MBEDTLS_AES_H |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 38 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 39 | #if !defined(MBEDTLS_CONFIG_FILE) |
Paul Bakker | 90995b5 | 2013-06-24 19:20:35 +0200 | [diff] [blame] | 40 | #include "config.h" |
Manuel Pégourié-Gonnard | cef4ad2 | 2014-04-29 12:39:06 +0200 | [diff] [blame] | 41 | #else |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 42 | #include MBEDTLS_CONFIG_FILE |
Manuel Pégourié-Gonnard | cef4ad2 | 2014-04-29 12:39:06 +0200 | [diff] [blame] | 43 | #endif |
Paul Bakker | 90995b5 | 2013-06-24 19:20:35 +0200 | [diff] [blame] | 44 | |
Rich Evans | 00ab470 | 2015-02-06 13:43:58 +0000 | [diff] [blame] | 45 | #include <stddef.h> |
Manuel Pégourié-Gonnard | ab22910 | 2015-04-15 11:53:16 +0200 | [diff] [blame] | 46 | #include <stdint.h> |
Paul Bakker | 5c2364c | 2012-10-01 14:41:15 +0000 | [diff] [blame] | 47 | |
Manuel Pégourié-Gonnard | 5b68565 | 2013-12-18 11:45:21 +0100 | [diff] [blame] | 48 | /* padlock.c and aesni.c rely on these values! */ |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 49 | #define MBEDTLS_AES_ENCRYPT 1 /**< AES encryption. */ |
| 50 | #define MBEDTLS_AES_DECRYPT 0 /**< AES decryption. */ |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 51 | |
Andres Amaya Garcia | c538064 | 2017-11-28 19:57:51 +0000 | [diff] [blame] | 52 | /* Error codes in range 0x0020-0x0022 */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 53 | #define MBEDTLS_ERR_AES_INVALID_KEY_LENGTH -0x0020 /**< Invalid key length. */ |
| 54 | #define MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH -0x0022 /**< Invalid data input length. */ |
Paul Bakker | 2b222c8 | 2009-07-27 21:03:45 +0000 | [diff] [blame] | 55 | |
Gilles Peskine | 7ecab3d | 2018-01-26 17:56:38 +0100 | [diff] [blame] | 56 | /* Error codes in range 0x0023-0x0025 */ |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 57 | #define MBEDTLS_ERR_AES_FEATURE_UNAVAILABLE -0x0023 /**< Feature not available. For example, an unsupported AES key size. */ |
Gilles Peskine | 7ecab3d | 2018-01-26 17:56:38 +0100 | [diff] [blame] | 58 | #define MBEDTLS_ERR_AES_HW_ACCEL_FAILED -0x0025 /**< AES hardware accelerator failed. */ |
Simon Butcher | 1a925bc | 2018-05-14 13:58:22 +0100 | [diff] [blame] | 59 | #define MBEDTLS_ERR_AES_BAD_INPUT_DATA -0x0027 /**< Invalid |
| 60 | input data. */ |
| 61 | |
| 62 | #if defined( MBEDTLS_CHECK_PARAMS ) |
| 63 | #define MBEDTLS_AES_VALIDATE( cond ) do{ if( !(cond) ) \ |
| 64 | return MBEDTLS_ERR_AES_BAD_INPUT_DATA; \ |
| 65 | } while(0); |
| 66 | #else |
| 67 | /* No validation of parameters will be performed */ |
| 68 | #define MBEDTLS_AES_VALIDATE( cond) |
| 69 | #endif |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 70 | |
Andres AG | f5bf718 | 2017-03-03 14:09:56 +0000 | [diff] [blame] | 71 | #if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \ |
| 72 | !defined(inline) && !defined(__cplusplus) |
| 73 | #define inline __inline |
| 74 | #endif |
| 75 | |
Paul Bakker | 407a0da | 2013-06-27 14:29:21 +0200 | [diff] [blame] | 76 | #ifdef __cplusplus |
| 77 | extern "C" { |
| 78 | #endif |
| 79 | |
Ron Eldor | b2aacec | 2017-05-18 16:53:08 +0300 | [diff] [blame] | 80 | #if !defined(MBEDTLS_AES_ALT) |
| 81 | // Regular implementation |
| 82 | // |
| 83 | |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 84 | /** |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 85 | * \brief The AES context-type definition. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 86 | */ |
| 87 | typedef struct |
| 88 | { |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 89 | int nr; /*!< The number of rounds. */ |
| 90 | uint32_t *rk; /*!< AES round keys. */ |
| 91 | uint32_t buf[68]; /*!< Unaligned data buffer. This buffer can |
| 92 | hold 32 extra Bytes, which can be used for |
| 93 | one of the following purposes: |
| 94 | <ul><li>Alignment if VIA padlock is |
| 95 | used.</li> |
| 96 | <li>Simplifying key expansion in the 256-bit |
| 97 | case by generating an extra round key. |
| 98 | </li></ul> */ |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 99 | } |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 100 | mbedtls_aes_context; |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 101 | |
Jaeden Amero | 9d3eba4 | 2018-04-28 15:02:45 +0100 | [diff] [blame] | 102 | #if defined(MBEDTLS_CIPHER_MODE_XTS) |
| 103 | /** |
| 104 | * \brief The AES XTS context-type definition. |
| 105 | */ |
| 106 | typedef struct |
| 107 | { |
| 108 | mbedtls_aes_context crypt; /*!< The AES context to use for AES block |
| 109 | encryption or decryption. */ |
| 110 | mbedtls_aes_context tweak; /*!< The AES context used for tweak computation. */ |
| 111 | } mbedtls_aes_xts_context; |
| 112 | #endif /* MBEDTLS_CIPHER_MODE_XTS */ |
| 113 | |
Ron Eldor | b2aacec | 2017-05-18 16:53:08 +0300 | [diff] [blame] | 114 | #else /* MBEDTLS_AES_ALT */ |
| 115 | #include "aes_alt.h" |
| 116 | #endif /* MBEDTLS_AES_ALT */ |
| 117 | |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 118 | /** |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 119 | * \brief This function initializes the specified AES context. |
Paul Bakker | c7ea99a | 2014-06-18 11:12:03 +0200 | [diff] [blame] | 120 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 121 | * It must be the first API called before using |
| 122 | * the context. |
| 123 | * |
| 124 | * \param ctx The AES context to initialize. |
Paul Bakker | c7ea99a | 2014-06-18 11:12:03 +0200 | [diff] [blame] | 125 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 126 | void mbedtls_aes_init( mbedtls_aes_context *ctx ); |
Paul Bakker | c7ea99a | 2014-06-18 11:12:03 +0200 | [diff] [blame] | 127 | |
| 128 | /** |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 129 | * \brief This function releases and clears the specified AES context. |
Paul Bakker | c7ea99a | 2014-06-18 11:12:03 +0200 | [diff] [blame] | 130 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 131 | * \param ctx The AES context to clear. |
Paul Bakker | c7ea99a | 2014-06-18 11:12:03 +0200 | [diff] [blame] | 132 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 133 | void mbedtls_aes_free( mbedtls_aes_context *ctx ); |
Paul Bakker | c7ea99a | 2014-06-18 11:12:03 +0200 | [diff] [blame] | 134 | |
Jaeden Amero | 9d3eba4 | 2018-04-28 15:02:45 +0100 | [diff] [blame] | 135 | #if defined(MBEDTLS_CIPHER_MODE_XTS) |
| 136 | /** |
| 137 | * \brief This function initializes the specified AES XTS context. |
| 138 | * |
| 139 | * It must be the first API called before using |
| 140 | * the context. |
| 141 | * |
| 142 | * \param ctx The AES XTS context to initialize. |
| 143 | */ |
| 144 | void mbedtls_aes_xts_init( mbedtls_aes_xts_context *ctx ); |
| 145 | |
| 146 | /** |
| 147 | * \brief This function releases and clears the specified AES XTS context. |
| 148 | * |
| 149 | * \param ctx The AES XTS context to clear. |
| 150 | */ |
| 151 | void mbedtls_aes_xts_free( mbedtls_aes_xts_context *ctx ); |
| 152 | #endif /* MBEDTLS_CIPHER_MODE_XTS */ |
| 153 | |
Paul Bakker | c7ea99a | 2014-06-18 11:12:03 +0200 | [diff] [blame] | 154 | /** |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 155 | * \brief This function sets the encryption key. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 156 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 157 | * \param ctx The AES context to which the key should be bound. |
| 158 | * \param key The encryption key. |
| 159 | * \param keybits The size of data passed in bits. Valid options are: |
| 160 | * <ul><li>128 bits</li> |
| 161 | * <li>192 bits</li> |
| 162 | * <li>256 bits</li></ul> |
Paul Bakker | 2b222c8 | 2009-07-27 21:03:45 +0000 | [diff] [blame] | 163 | * |
Rose Zadik | 5ad7aea | 2018-03-26 12:00:09 +0100 | [diff] [blame] | 164 | * \return \c 0 on success. |
Rose Zadik | 819d13d | 2018-04-16 09:35:15 +0100 | [diff] [blame] | 165 | * \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 166 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 167 | int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned char *key, |
Manuel Pégourié-Gonnard | b8186a5 | 2015-06-18 14:58:58 +0200 | [diff] [blame] | 168 | unsigned int keybits ); |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 169 | |
| 170 | /** |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 171 | * \brief This function sets the decryption key. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 172 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 173 | * \param ctx The AES context to which the key should be bound. |
| 174 | * \param key The decryption key. |
| 175 | * \param keybits The size of data passed. Valid options are: |
| 176 | * <ul><li>128 bits</li> |
| 177 | * <li>192 bits</li> |
| 178 | * <li>256 bits</li></ul> |
Paul Bakker | 2b222c8 | 2009-07-27 21:03:45 +0000 | [diff] [blame] | 179 | * |
Rose Zadik | 5ad7aea | 2018-03-26 12:00:09 +0100 | [diff] [blame] | 180 | * \return \c 0 on success. |
| 181 | * \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 182 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 183 | int mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned char *key, |
Manuel Pégourié-Gonnard | b8186a5 | 2015-06-18 14:58:58 +0200 | [diff] [blame] | 184 | unsigned int keybits ); |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 185 | |
Jaeden Amero | 9d3eba4 | 2018-04-28 15:02:45 +0100 | [diff] [blame] | 186 | #if defined(MBEDTLS_CIPHER_MODE_XTS) |
| 187 | /** |
| 188 | * \brief This function sets the encryption key. |
| 189 | * |
| 190 | * \param ctx The AES XTS context to which the key should be bound. |
| 191 | * \param key The encryption key. This is comprised of the XTS key1 |
| 192 | * concatenated with the XTS key2. |
| 193 | * \param keybits The size of data passed in bits. Valid options are: |
| 194 | * <ul><li>256 bits</li> |
| 195 | * <li>384 bits</li> |
| 196 | * <li>512 bits</li></ul> |
| 197 | * |
| 198 | * \return \c 0 on success. |
| 199 | * \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure. |
| 200 | */ |
| 201 | int mbedtls_aes_xts_setkey_enc( mbedtls_aes_xts_context *ctx, |
| 202 | const unsigned char *key, |
| 203 | unsigned int keybits ); |
| 204 | |
| 205 | /** |
| 206 | * \brief This function sets the decryption key. |
| 207 | * |
| 208 | * \param ctx The AES XTS context to which the key should be bound. |
| 209 | * \param key The decryption key. This is comprised of the XTS key1 |
| 210 | * concatenated with the XTS key2. |
| 211 | * \param keybits The size of data passed. Valid options are: |
| 212 | * <ul><li>256 bits</li> |
| 213 | * <li>384 bits</li> |
| 214 | * <li>512 bits</li></ul> |
| 215 | * |
| 216 | * \return \c 0 on success. |
| 217 | * \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure. |
| 218 | */ |
| 219 | int mbedtls_aes_xts_setkey_dec( mbedtls_aes_xts_context *ctx, |
| 220 | const unsigned char *key, |
| 221 | unsigned int keybits ); |
| 222 | #endif /* MBEDTLS_CIPHER_MODE_XTS */ |
| 223 | |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 224 | /** |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 225 | * \brief This function performs an AES single-block encryption or |
| 226 | * decryption operation. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 227 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 228 | * It performs the operation defined in the \p mode parameter |
| 229 | * (encrypt or decrypt), on the input data buffer defined in |
| 230 | * the \p input parameter. |
Paul Bakker | f3ccc68 | 2010-03-18 21:21:02 +0000 | [diff] [blame] | 231 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 232 | * mbedtls_aes_init(), and either mbedtls_aes_setkey_enc() or |
| 233 | * mbedtls_aes_setkey_dec() must be called before the first |
| 234 | * call to this API with the same context. |
| 235 | * |
| 236 | * \param ctx The AES context to use for encryption or decryption. |
| 237 | * \param mode The AES operation: #MBEDTLS_AES_ENCRYPT or |
| 238 | * #MBEDTLS_AES_DECRYPT. |
| 239 | * \param input The 16-Byte buffer holding the input data. |
| 240 | * \param output The 16-Byte buffer holding the output data. |
| 241 | |
| 242 | * \return \c 0 on success. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 243 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 244 | int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx, |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 245 | int mode, |
Paul Bakker | ff60ee6 | 2010-03-16 21:09:09 +0000 | [diff] [blame] | 246 | const unsigned char input[16], |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 247 | unsigned char output[16] ); |
| 248 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 249 | #if defined(MBEDTLS_CIPHER_MODE_CBC) |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 250 | /** |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 251 | * \brief This function performs an AES-CBC encryption or decryption operation |
| 252 | * on full blocks. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 253 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 254 | * It performs the operation defined in the \p mode |
| 255 | * parameter (encrypt/decrypt), on the input data buffer defined in |
| 256 | * the \p input parameter. |
Manuel Pégourié-Gonnard | 2be147a | 2015-01-23 16:19:47 +0000 | [diff] [blame] | 257 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 258 | * It can be called as many times as needed, until all the input |
| 259 | * data is processed. mbedtls_aes_init(), and either |
| 260 | * mbedtls_aes_setkey_enc() or mbedtls_aes_setkey_dec() must be called |
| 261 | * before the first call to this API with the same context. |
Paul Bakker | f3ccc68 | 2010-03-18 21:21:02 +0000 | [diff] [blame] | 262 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 263 | * \note This function operates on aligned blocks, that is, the input size |
| 264 | * must be a multiple of the AES block size of 16 Bytes. |
| 265 | * |
| 266 | * \note Upon exit, the content of the IV is updated so that you can |
| 267 | * call the same function again on the next |
| 268 | * block(s) of data and get the same result as if it was |
| 269 | * encrypted in one call. This allows a "streaming" usage. |
| 270 | * If you need to retain the contents of the IV, you should |
| 271 | * either save it manually or use the cipher module instead. |
| 272 | * |
| 273 | * |
| 274 | * \param ctx The AES context to use for encryption or decryption. |
| 275 | * \param mode The AES operation: #MBEDTLS_AES_ENCRYPT or |
| 276 | * #MBEDTLS_AES_DECRYPT. |
| 277 | * \param length The length of the input data in Bytes. This must be a |
| 278 | * multiple of the block size (16 Bytes). |
| 279 | * \param iv Initialization vector (updated after use). |
| 280 | * \param input The buffer holding the input data. |
| 281 | * \param output The buffer holding the output data. |
| 282 | * |
Rose Zadik | 5ad7aea | 2018-03-26 12:00:09 +0100 | [diff] [blame] | 283 | * \return \c 0 on success. |
| 284 | * \return #MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 285 | * on failure. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 286 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 287 | int mbedtls_aes_crypt_cbc( mbedtls_aes_context *ctx, |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 288 | int mode, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 289 | size_t length, |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 290 | unsigned char iv[16], |
Paul Bakker | ff60ee6 | 2010-03-16 21:09:09 +0000 | [diff] [blame] | 291 | const unsigned char *input, |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 292 | unsigned char *output ); |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 293 | #endif /* MBEDTLS_CIPHER_MODE_CBC */ |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 294 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 295 | #if defined(MBEDTLS_CIPHER_MODE_CFB) |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 296 | /** |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 297 | * \brief This function performs an AES-CFB128 encryption or decryption |
| 298 | * operation. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 299 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 300 | * It performs the operation defined in the \p mode |
| 301 | * parameter (encrypt or decrypt), on the input data buffer |
| 302 | * defined in the \p input parameter. |
Paul Bakker | ca6f3e2 | 2011-10-06 13:11:08 +0000 | [diff] [blame] | 303 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 304 | * For CFB, you must set up the context with mbedtls_aes_setkey_enc(), |
| 305 | * regardless of whether you are performing an encryption or decryption |
| 306 | * operation, that is, regardless of the \p mode parameter. This is |
| 307 | * because CFB mode uses the same key schedule for encryption and |
| 308 | * decryption. |
Manuel Pégourié-Gonnard | 2be147a | 2015-01-23 16:19:47 +0000 | [diff] [blame] | 309 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 310 | * \note Upon exit, the content of the IV is updated so that you can |
| 311 | * call the same function again on the next |
| 312 | * block(s) of data and get the same result as if it was |
| 313 | * encrypted in one call. This allows a "streaming" usage. |
| 314 | * If you need to retain the contents of the |
| 315 | * IV, you must either save it manually or use the cipher |
| 316 | * module instead. |
Paul Bakker | f3ccc68 | 2010-03-18 21:21:02 +0000 | [diff] [blame] | 317 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 318 | * |
| 319 | * \param ctx The AES context to use for encryption or decryption. |
| 320 | * \param mode The AES operation: #MBEDTLS_AES_ENCRYPT or |
| 321 | * #MBEDTLS_AES_DECRYPT. |
| 322 | * \param length The length of the input data. |
| 323 | * \param iv_off The offset in IV (updated after use). |
| 324 | * \param iv The initialization vector (updated after use). |
| 325 | * \param input The buffer holding the input data. |
| 326 | * \param output The buffer holding the output data. |
| 327 | * |
| 328 | * \return \c 0 on success. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 329 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 330 | int mbedtls_aes_crypt_cfb128( mbedtls_aes_context *ctx, |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 331 | int mode, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 332 | size_t length, |
Paul Bakker | 1ef71df | 2011-06-09 14:14:58 +0000 | [diff] [blame] | 333 | size_t *iv_off, |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 334 | unsigned char iv[16], |
Paul Bakker | ff60ee6 | 2010-03-16 21:09:09 +0000 | [diff] [blame] | 335 | const unsigned char *input, |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 336 | unsigned char *output ); |
| 337 | |
Paul Bakker | 9a73632 | 2012-11-14 12:39:52 +0000 | [diff] [blame] | 338 | /** |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 339 | * \brief This function performs an AES-CFB8 encryption or decryption |
| 340 | * operation. |
Paul Bakker | 556efba | 2014-01-24 15:38:12 +0100 | [diff] [blame] | 341 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 342 | * It performs the operation defined in the \p mode |
| 343 | * parameter (encrypt/decrypt), on the input data buffer defined |
| 344 | * in the \p input parameter. |
Paul Bakker | 556efba | 2014-01-24 15:38:12 +0100 | [diff] [blame] | 345 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 346 | * Due to the nature of CFB, you must use the same key schedule for |
| 347 | * both encryption and decryption operations. Therefore, you must |
| 348 | * use the context initialized with mbedtls_aes_setkey_enc() for |
| 349 | * both #MBEDTLS_AES_ENCRYPT and #MBEDTLS_AES_DECRYPT. |
Manuel Pégourié-Gonnard | 2be147a | 2015-01-23 16:19:47 +0000 | [diff] [blame] | 350 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 351 | * \note Upon exit, the content of the IV is updated so that you can |
| 352 | * call the same function again on the next |
| 353 | * block(s) of data and get the same result as if it was |
| 354 | * encrypted in one call. This allows a "streaming" usage. |
| 355 | * If you need to retain the contents of the |
| 356 | * IV, you should either save it manually or use the cipher |
| 357 | * module instead. |
Paul Bakker | 556efba | 2014-01-24 15:38:12 +0100 | [diff] [blame] | 358 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 359 | * |
| 360 | * \param ctx The AES context to use for encryption or decryption. |
| 361 | * \param mode The AES operation: #MBEDTLS_AES_ENCRYPT or |
| 362 | * #MBEDTLS_AES_DECRYPT |
| 363 | * \param length The length of the input data. |
| 364 | * \param iv The initialization vector (updated after use). |
| 365 | * \param input The buffer holding the input data. |
| 366 | * \param output The buffer holding the output data. |
| 367 | * |
| 368 | * \return \c 0 on success. |
Paul Bakker | 556efba | 2014-01-24 15:38:12 +0100 | [diff] [blame] | 369 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 370 | int mbedtls_aes_crypt_cfb8( mbedtls_aes_context *ctx, |
Paul Bakker | 556efba | 2014-01-24 15:38:12 +0100 | [diff] [blame] | 371 | int mode, |
| 372 | size_t length, |
| 373 | unsigned char iv[16], |
| 374 | const unsigned char *input, |
| 375 | unsigned char *output ); |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 376 | #endif /*MBEDTLS_CIPHER_MODE_CFB */ |
Paul Bakker | 556efba | 2014-01-24 15:38:12 +0100 | [diff] [blame] | 377 | |
Simon Butcher | fb9f661 | 2018-04-22 22:57:27 +0100 | [diff] [blame] | 378 | #if defined(MBEDTLS_CIPHER_MODE_OFB) |
| 379 | /** |
| 380 | * \brief This function performs an AES-OFB (Output Feedback Mode) encryption |
| 381 | * or decryption operation. |
| 382 | * |
| 383 | * For OFB, you must set up the context with mbedtls_aes_setkey_enc(), |
| 384 | * regardless of whether you are performing an encryption or decryption |
| 385 | * operation. This is because OFB mode uses the same key schedule for |
| 386 | * encryption and decryption. |
| 387 | * |
| 388 | * The OFB operation is identical for encryption or decryption, therefore |
| 389 | * no operation mode needs to be specified. |
| 390 | * |
| 391 | * \note Upon exit, the content of the IV is updated so that you can |
| 392 | * call the same function again on the next |
| 393 | * block(s) of data and get the same result as if it was |
| 394 | * encrypted in one call. This allows a "streaming" usage. |
| 395 | * If you need to retain the contents of the |
| 396 | * IV, you must either save it manually or use the cipher |
| 397 | * module instead. |
| 398 | * |
| 399 | * |
| 400 | * \param ctx The AES context to use for encryption or decryption. |
| 401 | * \param length The length of the input data. |
| 402 | * \param iv_off The offset in IV (updated after use). |
| 403 | * \param iv The initialization vector (updated after use). |
| 404 | * \param input The buffer holding the input data. |
| 405 | * \param output The buffer holding the output data. |
| 406 | * |
| 407 | * \return \c 0 on success. |
| 408 | */ |
| 409 | int mbedtls_aes_crypt_ofb( mbedtls_aes_context *ctx, |
| 410 | size_t length, |
| 411 | size_t *iv_off, |
| 412 | unsigned char iv[16], |
| 413 | const unsigned char *input, |
| 414 | unsigned char *output ); |
| 415 | |
| 416 | #endif /* MBEDTLS_CIPHER_MODE_OFB */ |
| 417 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 418 | #if defined(MBEDTLS_CIPHER_MODE_CTR) |
Paul Bakker | 556efba | 2014-01-24 15:38:12 +0100 | [diff] [blame] | 419 | /** |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 420 | * \brief This function performs an AES-CTR encryption or decryption |
| 421 | * operation. |
Paul Bakker | b6ecaf5 | 2011-04-19 14:29:23 +0000 | [diff] [blame] | 422 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 423 | * This function performs the operation defined in the \p mode |
| 424 | * parameter (encrypt/decrypt), on the input data buffer |
| 425 | * defined in the \p input parameter. |
Paul Bakker | b6ecaf5 | 2011-04-19 14:29:23 +0000 | [diff] [blame] | 426 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 427 | * Due to the nature of CTR, you must use the same key schedule |
| 428 | * for both encryption and decryption operations. Therefore, you |
| 429 | * must use the context initialized with mbedtls_aes_setkey_enc() |
| 430 | * for both #MBEDTLS_AES_ENCRYPT and #MBEDTLS_AES_DECRYPT. |
Paul Bakker | ca6f3e2 | 2011-10-06 13:11:08 +0000 | [diff] [blame] | 431 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 432 | * \warning You must keep the maximum use of your counter in mind. |
Paul Bakker | b6ecaf5 | 2011-04-19 14:29:23 +0000 | [diff] [blame] | 433 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 434 | * \param ctx The AES context to use for encryption or decryption. |
| 435 | * \param length The length of the input data. |
| 436 | * \param nc_off The offset in the current \p stream_block, for |
| 437 | * resuming within the current cipher stream. The |
| 438 | * offset pointer should be 0 at the start of a stream. |
| 439 | * \param nonce_counter The 128-bit nonce and counter. |
| 440 | * \param stream_block The saved stream block for resuming. This is |
| 441 | * overwritten by the function. |
| 442 | * \param input The buffer holding the input data. |
| 443 | * \param output The buffer holding the output data. |
| 444 | * |
Rose Zadik | 5ad7aea | 2018-03-26 12:00:09 +0100 | [diff] [blame] | 445 | * \return \c 0 on success. |
Paul Bakker | b6ecaf5 | 2011-04-19 14:29:23 +0000 | [diff] [blame] | 446 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 447 | int mbedtls_aes_crypt_ctr( mbedtls_aes_context *ctx, |
Paul Bakker | 1ef71df | 2011-06-09 14:14:58 +0000 | [diff] [blame] | 448 | size_t length, |
| 449 | size_t *nc_off, |
Paul Bakker | b6ecaf5 | 2011-04-19 14:29:23 +0000 | [diff] [blame] | 450 | unsigned char nonce_counter[16], |
| 451 | unsigned char stream_block[16], |
| 452 | const unsigned char *input, |
| 453 | unsigned char *output ); |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 454 | #endif /* MBEDTLS_CIPHER_MODE_CTR */ |
Paul Bakker | 90995b5 | 2013-06-24 19:20:35 +0200 | [diff] [blame] | 455 | |
Jaeden Amero | 9d3eba4 | 2018-04-28 15:02:45 +0100 | [diff] [blame] | 456 | #if defined(MBEDTLS_CIPHER_MODE_XTS) |
| 457 | /** |
| 458 | * \brief This function performs an AES-XTS encryption or decryption |
| 459 | * operation for an entire XTS sector. |
| 460 | * |
| 461 | * AES-XTS encrypts or decrypts blocks based on their location as |
| 462 | * defined by a sector number. These must be provided by \p sector. |
| 463 | * |
| 464 | * NIST SP 800-38E limits the maximum size of a data unit to 2**20 |
| 465 | * AES blocks. If the data unit is larger than this, this function |
| 466 | * returns #MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH. |
| 467 | * |
| 468 | * \param ctx The AES XTS context to use for AES XTS operations. |
| 469 | * \param mode The AES operation: #MBEDTLS_AES_ENCRYPT or |
| 470 | * #MBEDTLS_AES_DECRYPT. |
| 471 | * \param length The length of both an entire sector and the input data |
| 472 | * in bytes. The length must be at least 16 bytes. The |
| 473 | * length does not need to be a multiple of 16 bytes. |
| 474 | * \param data_unit The data unit (commonly a block device sector) address |
| 475 | * in byte array form. The least significant byte must be |
| 476 | * at sector[0]. The most significant byte must be at |
| 477 | * sector[15]. Array must be 16 bytes in length. |
| 478 | * \param input The buffer holding the input data. |
| 479 | * \param output The buffer holding the output data. |
| 480 | * |
| 481 | * \return \c 0 on success. |
| 482 | * \return #MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH if length smaller |
| 483 | * than an AES block in size (16 bytes) or if the length is |
| 484 | * larger than 2**20 blocks. |
| 485 | */ |
| 486 | int mbedtls_aes_crypt_xts( mbedtls_aes_xts_context *ctx, |
| 487 | int mode, |
| 488 | size_t length, |
| 489 | const unsigned char data_unit[16], |
| 490 | const unsigned char *input, |
| 491 | unsigned char *output ); |
| 492 | #endif /* MBEDTLS_CIPHER_MODE_XTS */ |
| 493 | |
Manuel Pégourié-Gonnard | 31993f2 | 2015-05-12 15:41:08 +0200 | [diff] [blame] | 494 | /** |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 495 | * \brief Internal AES block encryption function. This is only |
| 496 | * exposed to allow overriding it using |
| 497 | * \c MBEDTLS_AES_ENCRYPT_ALT. |
Manuel Pégourié-Gonnard | 31993f2 | 2015-05-12 15:41:08 +0200 | [diff] [blame] | 498 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 499 | * \param ctx The AES context to use for encryption. |
| 500 | * \param input The plaintext block. |
| 501 | * \param output The output (ciphertext) block. |
Andres AG | f5bf718 | 2017-03-03 14:09:56 +0000 | [diff] [blame] | 502 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 503 | * \return \c 0 on success. |
Manuel Pégourié-Gonnard | 31993f2 | 2015-05-12 15:41:08 +0200 | [diff] [blame] | 504 | */ |
Andres AG | f5bf718 | 2017-03-03 14:09:56 +0000 | [diff] [blame] | 505 | int mbedtls_internal_aes_encrypt( mbedtls_aes_context *ctx, |
| 506 | const unsigned char input[16], |
| 507 | unsigned char output[16] ); |
Manuel Pégourié-Gonnard | 31993f2 | 2015-05-12 15:41:08 +0200 | [diff] [blame] | 508 | |
| 509 | /** |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 510 | * \brief Internal AES block decryption function. This is only |
| 511 | * exposed to allow overriding it using see |
| 512 | * \c MBEDTLS_AES_DECRYPT_ALT. |
Manuel Pégourié-Gonnard | 31993f2 | 2015-05-12 15:41:08 +0200 | [diff] [blame] | 513 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 514 | * \param ctx The AES context to use for decryption. |
| 515 | * \param input The ciphertext block. |
| 516 | * \param output The output (plaintext) block. |
Andres AG | f5bf718 | 2017-03-03 14:09:56 +0000 | [diff] [blame] | 517 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 518 | * \return \c 0 on success. |
Manuel Pégourié-Gonnard | 31993f2 | 2015-05-12 15:41:08 +0200 | [diff] [blame] | 519 | */ |
Andres AG | f5bf718 | 2017-03-03 14:09:56 +0000 | [diff] [blame] | 520 | int mbedtls_internal_aes_decrypt( mbedtls_aes_context *ctx, |
| 521 | const unsigned char input[16], |
| 522 | unsigned char output[16] ); |
| 523 | |
| 524 | #if !defined(MBEDTLS_DEPRECATED_REMOVED) |
| 525 | #if defined(MBEDTLS_DEPRECATED_WARNING) |
| 526 | #define MBEDTLS_DEPRECATED __attribute__((deprecated)) |
| 527 | #else |
| 528 | #define MBEDTLS_DEPRECATED |
| 529 | #endif |
| 530 | /** |
Hanno Becker | ca1cdb2 | 2017-07-20 09:50:59 +0100 | [diff] [blame] | 531 | * \brief Deprecated internal AES block encryption function |
| 532 | * without return value. |
Andres AG | f5bf718 | 2017-03-03 14:09:56 +0000 | [diff] [blame] | 533 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 534 | * \deprecated Superseded by mbedtls_aes_encrypt_ext() in 2.5.0. |
Andres AG | f5bf718 | 2017-03-03 14:09:56 +0000 | [diff] [blame] | 535 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 536 | * \param ctx The AES context to use for encryption. |
| 537 | * \param input Plaintext block. |
| 538 | * \param output Output (ciphertext) block. |
Andres AG | f5bf718 | 2017-03-03 14:09:56 +0000 | [diff] [blame] | 539 | */ |
Hanno Becker | bedc205 | 2017-06-26 12:46:56 +0100 | [diff] [blame] | 540 | MBEDTLS_DEPRECATED void mbedtls_aes_encrypt( mbedtls_aes_context *ctx, |
| 541 | const unsigned char input[16], |
| 542 | unsigned char output[16] ); |
Andres AG | f5bf718 | 2017-03-03 14:09:56 +0000 | [diff] [blame] | 543 | |
| 544 | /** |
Hanno Becker | ca1cdb2 | 2017-07-20 09:50:59 +0100 | [diff] [blame] | 545 | * \brief Deprecated internal AES block decryption function |
| 546 | * without return value. |
Andres AG | f5bf718 | 2017-03-03 14:09:56 +0000 | [diff] [blame] | 547 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 548 | * \deprecated Superseded by mbedtls_aes_decrypt_ext() in 2.5.0. |
Andres AG | f5bf718 | 2017-03-03 14:09:56 +0000 | [diff] [blame] | 549 | * |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 550 | * \param ctx The AES context to use for decryption. |
| 551 | * \param input Ciphertext block. |
| 552 | * \param output Output (plaintext) block. |
Andres AG | f5bf718 | 2017-03-03 14:09:56 +0000 | [diff] [blame] | 553 | */ |
Hanno Becker | bedc205 | 2017-06-26 12:46:56 +0100 | [diff] [blame] | 554 | MBEDTLS_DEPRECATED void mbedtls_aes_decrypt( mbedtls_aes_context *ctx, |
| 555 | const unsigned char input[16], |
| 556 | unsigned char output[16] ); |
Andres AG | f5bf718 | 2017-03-03 14:09:56 +0000 | [diff] [blame] | 557 | |
| 558 | #undef MBEDTLS_DEPRECATED |
| 559 | #endif /* !MBEDTLS_DEPRECATED_REMOVED */ |
Manuel Pégourié-Gonnard | 31993f2 | 2015-05-12 15:41:08 +0200 | [diff] [blame] | 560 | |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 561 | /** |
Rose Zadik | 7f44127 | 2018-01-22 11:48:23 +0000 | [diff] [blame] | 562 | * \brief Checkup routine. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 563 | * |
Rose Zadik | 5ad7aea | 2018-03-26 12:00:09 +0100 | [diff] [blame] | 564 | * \return \c 0 on success. |
| 565 | * \return \c 1 on failure. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 566 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 567 | int mbedtls_aes_self_test( int verbose ); |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 568 | |
| 569 | #ifdef __cplusplus |
| 570 | } |
| 571 | #endif |
| 572 | |
| 573 | #endif /* aes.h */ |