72
72
/** AES hardware accelerator failed. */
73
73
#define MBEDTLS_ERR_AES_HW_ACCEL_FAILED -0x0025
74
74
75
- #if ( defined(__ARMCC_VERSION ) || defined(_MSC_VER ) ) && \
75
+ #if (defined(__ARMCC_VERSION ) || defined(_MSC_VER )) && \
76
76
!defined(inline ) && !defined(__cplusplus )
77
77
#define inline __inline
78
78
#endif
@@ -88,8 +88,7 @@ extern "C" {
88
88
/**
89
89
* \brief The AES context-type definition.
90
90
*/
91
- typedef struct mbedtls_aes_context
92
- {
91
+ typedef struct mbedtls_aes_context {
93
92
int nr ; /*!< The number of rounds. */
94
93
uint32_t * rk ; /*!< AES round keys. */
95
94
uint32_t buf [68 ]; /*!< Unaligned data buffer. This buffer can
@@ -107,8 +106,7 @@ mbedtls_aes_context;
107
106
/**
108
107
* \brief The AES XTS context-type definition.
109
108
*/
110
- typedef struct mbedtls_aes_xts_context
111
- {
109
+ typedef struct mbedtls_aes_xts_context {
112
110
mbedtls_aes_context crypt ; /*!< The AES context to use for AES block
113
111
encryption or decryption. */
114
112
mbedtls_aes_context tweak ; /*!< The AES context used for tweak
@@ -128,7 +126,7 @@ typedef struct mbedtls_aes_xts_context
128
126
*
129
127
* \param ctx The AES context to initialize. This must not be \c NULL.
130
128
*/
131
- void mbedtls_aes_init ( mbedtls_aes_context * ctx );
129
+ void mbedtls_aes_init (mbedtls_aes_context * ctx );
132
130
133
131
/**
134
132
* \brief This function releases and clears the specified AES context.
@@ -137,7 +135,7 @@ void mbedtls_aes_init( mbedtls_aes_context *ctx );
137
135
* If this is \c NULL, this function does nothing.
138
136
* Otherwise, the context must have been at least initialized.
139
137
*/
140
- void mbedtls_aes_free ( mbedtls_aes_context * ctx );
138
+ void mbedtls_aes_free (mbedtls_aes_context * ctx );
141
139
142
140
#if defined(MBEDTLS_CIPHER_MODE_XTS )
143
141
/**
@@ -148,7 +146,7 @@ void mbedtls_aes_free( mbedtls_aes_context *ctx );
148
146
*
149
147
* \param ctx The AES XTS context to initialize. This must not be \c NULL.
150
148
*/
151
- void mbedtls_aes_xts_init ( mbedtls_aes_xts_context * ctx );
149
+ void mbedtls_aes_xts_init (mbedtls_aes_xts_context * ctx );
152
150
153
151
/**
154
152
* \brief This function releases and clears the specified AES XTS context.
@@ -157,7 +155,7 @@ void mbedtls_aes_xts_init( mbedtls_aes_xts_context *ctx );
157
155
* If this is \c NULL, this function does nothing.
158
156
* Otherwise, the context must have been at least initialized.
159
157
*/
160
- void mbedtls_aes_xts_free ( mbedtls_aes_xts_context * ctx );
158
+ void mbedtls_aes_xts_free (mbedtls_aes_xts_context * ctx );
161
159
#endif /* MBEDTLS_CIPHER_MODE_XTS */
162
160
163
161
/**
@@ -176,8 +174,8 @@ void mbedtls_aes_xts_free( mbedtls_aes_xts_context *ctx );
176
174
* \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure.
177
175
*/
178
176
MBEDTLS_CHECK_RETURN_TYPICAL
179
- int mbedtls_aes_setkey_enc ( mbedtls_aes_context * ctx , const unsigned char * key ,
180
- unsigned int keybits );
177
+ int mbedtls_aes_setkey_enc (mbedtls_aes_context * ctx , const unsigned char * key ,
178
+ unsigned int keybits );
181
179
182
180
/**
183
181
* \brief This function sets the decryption key.
@@ -195,8 +193,8 @@ int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned char *key,
195
193
* \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure.
196
194
*/
197
195
MBEDTLS_CHECK_RETURN_TYPICAL
198
- int mbedtls_aes_setkey_dec ( mbedtls_aes_context * ctx , const unsigned char * key ,
199
- unsigned int keybits );
196
+ int mbedtls_aes_setkey_dec (mbedtls_aes_context * ctx , const unsigned char * key ,
197
+ unsigned int keybits );
200
198
201
199
#if defined(MBEDTLS_CIPHER_MODE_XTS )
202
200
/**
@@ -216,9 +214,9 @@ int mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned char *key,
216
214
* \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure.
217
215
*/
218
216
MBEDTLS_CHECK_RETURN_TYPICAL
219
- int mbedtls_aes_xts_setkey_enc ( mbedtls_aes_xts_context * ctx ,
220
- const unsigned char * key ,
221
- unsigned int keybits );
217
+ int mbedtls_aes_xts_setkey_enc (mbedtls_aes_xts_context * ctx ,
218
+ const unsigned char * key ,
219
+ unsigned int keybits );
222
220
223
221
/**
224
222
* \brief This function prepares an XTS context for decryption and
@@ -237,9 +235,9 @@ int mbedtls_aes_xts_setkey_enc( mbedtls_aes_xts_context *ctx,
237
235
* \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure.
238
236
*/
239
237
MBEDTLS_CHECK_RETURN_TYPICAL
240
- int mbedtls_aes_xts_setkey_dec ( mbedtls_aes_xts_context * ctx ,
241
- const unsigned char * key ,
242
- unsigned int keybits );
238
+ int mbedtls_aes_xts_setkey_dec (mbedtls_aes_xts_context * ctx ,
239
+ const unsigned char * key ,
240
+ unsigned int keybits );
243
241
#endif /* MBEDTLS_CIPHER_MODE_XTS */
244
242
245
243
/**
@@ -266,10 +264,10 @@ int mbedtls_aes_xts_setkey_dec( mbedtls_aes_xts_context *ctx,
266
264
* \return \c 0 on success.
267
265
*/
268
266
MBEDTLS_CHECK_RETURN_TYPICAL
269
- int mbedtls_aes_crypt_ecb ( mbedtls_aes_context * ctx ,
270
- int mode ,
271
- const unsigned char input [16 ],
272
- unsigned char output [16 ] );
267
+ int mbedtls_aes_crypt_ecb (mbedtls_aes_context * ctx ,
268
+ int mode ,
269
+ const unsigned char input [16 ],
270
+ unsigned char output [16 ]);
273
271
274
272
#if defined(MBEDTLS_CIPHER_MODE_CBC )
275
273
/**
@@ -314,12 +312,12 @@ int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx,
314
312
* on failure.
315
313
*/
316
314
MBEDTLS_CHECK_RETURN_TYPICAL
317
- int mbedtls_aes_crypt_cbc ( mbedtls_aes_context * ctx ,
318
- int mode ,
319
- size_t length ,
320
- unsigned char iv [16 ],
321
- const unsigned char * input ,
322
- unsigned char * output );
315
+ int mbedtls_aes_crypt_cbc (mbedtls_aes_context * ctx ,
316
+ int mode ,
317
+ size_t length ,
318
+ unsigned char iv [16 ],
319
+ const unsigned char * input ,
320
+ unsigned char * output );
323
321
#endif /* MBEDTLS_CIPHER_MODE_CBC */
324
322
325
323
#if defined(MBEDTLS_CIPHER_MODE_XTS )
@@ -359,12 +357,12 @@ int mbedtls_aes_crypt_cbc( mbedtls_aes_context *ctx,
359
357
* length is larger than 2^20 blocks (16 MiB).
360
358
*/
361
359
MBEDTLS_CHECK_RETURN_TYPICAL
362
- int mbedtls_aes_crypt_xts ( mbedtls_aes_xts_context * ctx ,
363
- int mode ,
364
- size_t length ,
365
- const unsigned char data_unit [16 ],
366
- const unsigned char * input ,
367
- unsigned char * output );
360
+ int mbedtls_aes_crypt_xts (mbedtls_aes_xts_context * ctx ,
361
+ int mode ,
362
+ size_t length ,
363
+ const unsigned char data_unit [16 ],
364
+ const unsigned char * input ,
365
+ unsigned char * output );
368
366
#endif /* MBEDTLS_CIPHER_MODE_XTS */
369
367
370
368
#if defined(MBEDTLS_CIPHER_MODE_CFB )
@@ -408,13 +406,13 @@ int mbedtls_aes_crypt_xts( mbedtls_aes_xts_context *ctx,
408
406
* \return \c 0 on success.
409
407
*/
410
408
MBEDTLS_CHECK_RETURN_TYPICAL
411
- int mbedtls_aes_crypt_cfb128 ( mbedtls_aes_context * ctx ,
412
- int mode ,
413
- size_t length ,
414
- size_t * iv_off ,
415
- unsigned char iv [16 ],
416
- const unsigned char * input ,
417
- unsigned char * output );
409
+ int mbedtls_aes_crypt_cfb128 (mbedtls_aes_context * ctx ,
410
+ int mode ,
411
+ size_t length ,
412
+ size_t * iv_off ,
413
+ unsigned char iv [16 ],
414
+ const unsigned char * input ,
415
+ unsigned char * output );
418
416
419
417
/**
420
418
* \brief This function performs an AES-CFB8 encryption or decryption
@@ -453,12 +451,12 @@ int mbedtls_aes_crypt_cfb128( mbedtls_aes_context *ctx,
453
451
* \return \c 0 on success.
454
452
*/
455
453
MBEDTLS_CHECK_RETURN_TYPICAL
456
- int mbedtls_aes_crypt_cfb8 ( mbedtls_aes_context * ctx ,
457
- int mode ,
458
- size_t length ,
459
- unsigned char iv [16 ],
460
- const unsigned char * input ,
461
- unsigned char * output );
454
+ int mbedtls_aes_crypt_cfb8 (mbedtls_aes_context * ctx ,
455
+ int mode ,
456
+ size_t length ,
457
+ unsigned char iv [16 ],
458
+ const unsigned char * input ,
459
+ unsigned char * output );
462
460
#endif /*MBEDTLS_CIPHER_MODE_CFB */
463
461
464
462
#if defined(MBEDTLS_CIPHER_MODE_OFB )
@@ -508,12 +506,12 @@ int mbedtls_aes_crypt_cfb8( mbedtls_aes_context *ctx,
508
506
* \return \c 0 on success.
509
507
*/
510
508
MBEDTLS_CHECK_RETURN_TYPICAL
511
- int mbedtls_aes_crypt_ofb ( mbedtls_aes_context * ctx ,
512
- size_t length ,
513
- size_t * iv_off ,
514
- unsigned char iv [16 ],
515
- const unsigned char * input ,
516
- unsigned char * output );
509
+ int mbedtls_aes_crypt_ofb (mbedtls_aes_context * ctx ,
510
+ size_t length ,
511
+ size_t * iv_off ,
512
+ unsigned char iv [16 ],
513
+ const unsigned char * input ,
514
+ unsigned char * output );
517
515
518
516
#endif /* MBEDTLS_CIPHER_MODE_OFB */
519
517
@@ -591,13 +589,13 @@ int mbedtls_aes_crypt_ofb( mbedtls_aes_context *ctx,
591
589
* \return \c 0 on success.
592
590
*/
593
591
MBEDTLS_CHECK_RETURN_TYPICAL
594
- int mbedtls_aes_crypt_ctr ( mbedtls_aes_context * ctx ,
595
- size_t length ,
596
- size_t * nc_off ,
597
- unsigned char nonce_counter [16 ],
598
- unsigned char stream_block [16 ],
599
- const unsigned char * input ,
600
- unsigned char * output );
592
+ int mbedtls_aes_crypt_ctr (mbedtls_aes_context * ctx ,
593
+ size_t length ,
594
+ size_t * nc_off ,
595
+ unsigned char nonce_counter [16 ],
596
+ unsigned char stream_block [16 ],
597
+ const unsigned char * input ,
598
+ unsigned char * output );
601
599
#endif /* MBEDTLS_CIPHER_MODE_CTR */
602
600
603
601
/**
@@ -612,9 +610,9 @@ int mbedtls_aes_crypt_ctr( mbedtls_aes_context *ctx,
612
610
* \return \c 0 on success.
613
611
*/
614
612
MBEDTLS_CHECK_RETURN_TYPICAL
615
- int mbedtls_internal_aes_encrypt ( mbedtls_aes_context * ctx ,
616
- const unsigned char input [16 ],
617
- unsigned char output [16 ] );
613
+ int mbedtls_internal_aes_encrypt (mbedtls_aes_context * ctx ,
614
+ const unsigned char input [16 ],
615
+ unsigned char output [16 ]);
618
616
619
617
/**
620
618
* \brief Internal AES block decryption function. This is only
@@ -628,9 +626,9 @@ int mbedtls_internal_aes_encrypt( mbedtls_aes_context *ctx,
628
626
* \return \c 0 on success.
629
627
*/
630
628
MBEDTLS_CHECK_RETURN_TYPICAL
631
- int mbedtls_internal_aes_decrypt ( mbedtls_aes_context * ctx ,
632
- const unsigned char input [16 ],
633
- unsigned char output [16 ] );
629
+ int mbedtls_internal_aes_decrypt (mbedtls_aes_context * ctx ,
630
+ const unsigned char input [16 ],
631
+ unsigned char output [16 ]);
634
632
635
633
#if !defined(MBEDTLS_DEPRECATED_REMOVED )
636
634
#if defined(MBEDTLS_DEPRECATED_WARNING )
@@ -648,9 +646,9 @@ int mbedtls_internal_aes_decrypt( mbedtls_aes_context *ctx,
648
646
* \param input Plaintext block.
649
647
* \param output Output (ciphertext) block.
650
648
*/
651
- MBEDTLS_DEPRECATED void mbedtls_aes_encrypt ( mbedtls_aes_context * ctx ,
652
- const unsigned char input [16 ],
653
- unsigned char output [16 ] );
649
+ MBEDTLS_DEPRECATED void mbedtls_aes_encrypt (mbedtls_aes_context * ctx ,
650
+ const unsigned char input [16 ],
651
+ unsigned char output [16 ]);
654
652
655
653
/**
656
654
* \brief Deprecated internal AES block decryption function
@@ -662,9 +660,9 @@ MBEDTLS_DEPRECATED void mbedtls_aes_encrypt( mbedtls_aes_context *ctx,
662
660
* \param input Ciphertext block.
663
661
* \param output Output (plaintext) block.
664
662
*/
665
- MBEDTLS_DEPRECATED void mbedtls_aes_decrypt ( mbedtls_aes_context * ctx ,
666
- const unsigned char input [16 ],
667
- unsigned char output [16 ] );
663
+ MBEDTLS_DEPRECATED void mbedtls_aes_decrypt (mbedtls_aes_context * ctx ,
664
+ const unsigned char input [16 ],
665
+ unsigned char output [16 ]);
668
666
669
667
#undef MBEDTLS_DEPRECATED
670
668
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
@@ -678,7 +676,7 @@ MBEDTLS_DEPRECATED void mbedtls_aes_decrypt( mbedtls_aes_context *ctx,
678
676
* \return \c 1 on failure.
679
677
*/
680
678
MBEDTLS_CHECK_RETURN_CRITICAL
681
- int mbedtls_aes_self_test ( int verbose );
679
+ int mbedtls_aes_self_test (int verbose );
682
680
683
681
#endif /* MBEDTLS_SELF_TEST */
684
682
0 commit comments