22
22
23
23
/*
24
24
* Copyright The Mbed TLS Contributors
25
- * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
26
- *
27
- * This file is provided under the Apache License 2.0, or the
28
- * GNU General Public License v2.0 or later.
29
- *
30
- * **********
31
- * Apache License 2.0:
25
+ * SPDX-License-Identifier: Apache-2.0
32
26
*
33
27
* Licensed under the Apache License, Version 2.0 (the "License"); you may
34
28
* not use this file except in compliance with the License.
41
35
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42
36
* See the License for the specific language governing permissions and
43
37
* limitations under the License.
44
- *
45
- * **********
46
- *
47
- * **********
48
- * GNU General Public License v2.0 or later:
49
- *
50
- * This program is free software; you can redistribute it and/or modify
51
- * it under the terms of the GNU General Public License as published by
52
- * the Free Software Foundation; either version 2 of the License, or
53
- * (at your option) any later version.
54
- *
55
- * This program is distributed in the hope that it will be useful,
56
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
57
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58
- * GNU General Public License for more details.
59
- *
60
- * You should have received a copy of the GNU General Public License along
61
- * with this program; if not, write to the Free Software Foundation, Inc.,
62
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
63
- *
64
- * **********
65
38
*/
66
39
67
40
#ifndef MBEDTLS_AES_H
68
41
#define MBEDTLS_AES_H
69
42
70
43
#if !defined(MBEDTLS_CONFIG_FILE )
71
- #include "config.h"
44
+ #include "mbedtls/ config.h"
72
45
#else
73
46
#include MBEDTLS_CONFIG_FILE
74
47
#endif
48
+ #include "mbedtls/platform_util.h"
75
49
76
50
#include <stddef.h>
77
51
#include <stdint.h>
@@ -201,6 +175,7 @@ void mbedtls_aes_xts_free( mbedtls_aes_xts_context *ctx );
201
175
* \return \c 0 on success.
202
176
* \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure.
203
177
*/
178
+ MBEDTLS_CHECK_RETURN_TYPICAL
204
179
int mbedtls_aes_setkey_enc ( mbedtls_aes_context * ctx , const unsigned char * key ,
205
180
unsigned int keybits );
206
181
@@ -219,6 +194,7 @@ int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned char *key,
219
194
* \return \c 0 on success.
220
195
* \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure.
221
196
*/
197
+ MBEDTLS_CHECK_RETURN_TYPICAL
222
198
int mbedtls_aes_setkey_dec ( mbedtls_aes_context * ctx , const unsigned char * key ,
223
199
unsigned int keybits );
224
200
@@ -239,6 +215,7 @@ int mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned char *key,
239
215
* \return \c 0 on success.
240
216
* \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure.
241
217
*/
218
+ MBEDTLS_CHECK_RETURN_TYPICAL
242
219
int mbedtls_aes_xts_setkey_enc ( mbedtls_aes_xts_context * ctx ,
243
220
const unsigned char * key ,
244
221
unsigned int keybits );
@@ -259,6 +236,7 @@ int mbedtls_aes_xts_setkey_enc( mbedtls_aes_xts_context *ctx,
259
236
* \return \c 0 on success.
260
237
* \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure.
261
238
*/
239
+ MBEDTLS_CHECK_RETURN_TYPICAL
262
240
int mbedtls_aes_xts_setkey_dec ( mbedtls_aes_xts_context * ctx ,
263
241
const unsigned char * key ,
264
242
unsigned int keybits );
@@ -287,6 +265,7 @@ int mbedtls_aes_xts_setkey_dec( mbedtls_aes_xts_context *ctx,
287
265
288
266
* \return \c 0 on success.
289
267
*/
268
+ MBEDTLS_CHECK_RETURN_TYPICAL
290
269
int mbedtls_aes_crypt_ecb ( mbedtls_aes_context * ctx ,
291
270
int mode ,
292
271
const unsigned char input [16 ],
@@ -334,6 +313,7 @@ int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx,
334
313
* \return #MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH
335
314
* on failure.
336
315
*/
316
+ MBEDTLS_CHECK_RETURN_TYPICAL
337
317
int mbedtls_aes_crypt_cbc ( mbedtls_aes_context * ctx ,
338
318
int mode ,
339
319
size_t length ,
@@ -378,6 +358,7 @@ int mbedtls_aes_crypt_cbc( mbedtls_aes_context *ctx,
378
358
* smaller than an AES block in size (16 Bytes) or if \p
379
359
* length is larger than 2^20 blocks (16 MiB).
380
360
*/
361
+ MBEDTLS_CHECK_RETURN_TYPICAL
381
362
int mbedtls_aes_crypt_xts ( mbedtls_aes_xts_context * ctx ,
382
363
int mode ,
383
364
size_t length ,
@@ -426,6 +407,7 @@ int mbedtls_aes_crypt_xts( mbedtls_aes_xts_context *ctx,
426
407
*
427
408
* \return \c 0 on success.
428
409
*/
410
+ MBEDTLS_CHECK_RETURN_TYPICAL
429
411
int mbedtls_aes_crypt_cfb128 ( mbedtls_aes_context * ctx ,
430
412
int mode ,
431
413
size_t length ,
@@ -470,6 +452,7 @@ int mbedtls_aes_crypt_cfb128( mbedtls_aes_context *ctx,
470
452
*
471
453
* \return \c 0 on success.
472
454
*/
455
+ MBEDTLS_CHECK_RETURN_TYPICAL
473
456
int mbedtls_aes_crypt_cfb8 ( mbedtls_aes_context * ctx ,
474
457
int mode ,
475
458
size_t length ,
@@ -524,6 +507,7 @@ int mbedtls_aes_crypt_cfb8( mbedtls_aes_context *ctx,
524
507
*
525
508
* \return \c 0 on success.
526
509
*/
510
+ MBEDTLS_CHECK_RETURN_TYPICAL
527
511
int mbedtls_aes_crypt_ofb ( mbedtls_aes_context * ctx ,
528
512
size_t length ,
529
513
size_t * iv_off ,
@@ -606,6 +590,7 @@ int mbedtls_aes_crypt_ofb( mbedtls_aes_context *ctx,
606
590
*
607
591
* \return \c 0 on success.
608
592
*/
593
+ MBEDTLS_CHECK_RETURN_TYPICAL
609
594
int mbedtls_aes_crypt_ctr ( mbedtls_aes_context * ctx ,
610
595
size_t length ,
611
596
size_t * nc_off ,
@@ -626,6 +611,7 @@ int mbedtls_aes_crypt_ctr( mbedtls_aes_context *ctx,
626
611
*
627
612
* \return \c 0 on success.
628
613
*/
614
+ MBEDTLS_CHECK_RETURN_TYPICAL
629
615
int mbedtls_internal_aes_encrypt ( mbedtls_aes_context * ctx ,
630
616
const unsigned char input [16 ],
631
617
unsigned char output [16 ] );
@@ -641,6 +627,7 @@ int mbedtls_internal_aes_encrypt( mbedtls_aes_context *ctx,
641
627
*
642
628
* \return \c 0 on success.
643
629
*/
630
+ MBEDTLS_CHECK_RETURN_TYPICAL
644
631
int mbedtls_internal_aes_decrypt ( mbedtls_aes_context * ctx ,
645
632
const unsigned char input [16 ],
646
633
unsigned char output [16 ] );
@@ -690,6 +677,7 @@ MBEDTLS_DEPRECATED void mbedtls_aes_decrypt( mbedtls_aes_context *ctx,
690
677
* \return \c 0 on success.
691
678
* \return \c 1 on failure.
692
679
*/
680
+ MBEDTLS_CHECK_RETURN_CRITICAL
693
681
int mbedtls_aes_self_test ( int verbose );
694
682
695
683
#endif /* MBEDTLS_SELF_TEST */
0 commit comments