39
39
#define MBEDTLS_ERR_AES_INVALID_KEY_LENGTH -0x0020 /**< Invalid key length. */
40
40
#define MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH -0x0022 /**< Invalid data input length. */
41
41
42
+ #if ( defined(__ARMCC_VERSION ) || defined(_MSC_VER ) ) && \
43
+ !defined(inline ) && !defined(__cplusplus )
44
+ #define inline __inline
45
+ #endif
46
+
42
47
#if !defined(MBEDTLS_AES_ALT )
43
48
// Regular implementation
44
49
//
@@ -253,10 +258,12 @@ int mbedtls_aes_crypt_ctr( mbedtls_aes_context *ctx,
253
258
* \param ctx AES context
254
259
* \param input Plaintext block
255
260
* \param output Output (ciphertext) block
261
+ *
262
+ * \return 0 if successful
256
263
*/
257
- void mbedtls_aes_encrypt ( mbedtls_aes_context * ctx ,
258
- const unsigned char input [16 ],
259
- unsigned char output [16 ] );
264
+ int mbedtls_internal_aes_encrypt ( mbedtls_aes_context * ctx ,
265
+ const unsigned char input [16 ],
266
+ unsigned char output [16 ] );
260
267
261
268
/**
262
269
* \brief Internal AES block decryption function
@@ -266,10 +273,59 @@ void mbedtls_aes_encrypt( mbedtls_aes_context *ctx,
266
273
* \param ctx AES context
267
274
* \param input Ciphertext block
268
275
* \param output Output (plaintext) block
276
+ *
277
+ * \return 0 if successful
278
+ */
279
+ int mbedtls_internal_aes_decrypt ( mbedtls_aes_context * ctx ,
280
+ const unsigned char input [16 ],
281
+ unsigned char output [16 ] );
282
+
283
+ #if !defined(MBEDTLS_DEPRECATED_REMOVED )
284
+ #if defined(MBEDTLS_DEPRECATED_WARNING )
285
+ #define MBEDTLS_DEPRECATED __attribute__((deprecated))
286
+ #else
287
+ #define MBEDTLS_DEPRECATED
288
+ #endif
289
+ /**
290
+ * \brief Internal AES block encryption function
291
+ * (Only exposed to allow overriding it,
292
+ * see MBEDTLS_AES_ENCRYPT_ALT)
293
+ *
294
+ * \deprecated Superseded by mbedtls_aes_encrypt_ext() in 2.5.0
295
+ *
296
+ * \param ctx AES context
297
+ * \param input Plaintext block
298
+ * \param output Output (ciphertext) block
269
299
*/
270
- void mbedtls_aes_decrypt ( mbedtls_aes_context * ctx ,
271
- const unsigned char input [16 ],
272
- unsigned char output [16 ] );
300
+ MBEDTLS_DEPRECATED static inline void mbedtls_aes_encrypt (
301
+ mbedtls_aes_context * ctx ,
302
+ const unsigned char input [16 ],
303
+ unsigned char output [16 ] )
304
+ {
305
+ mbedtls_internal_aes_encrypt ( ctx , input , output );
306
+ }
307
+
308
+ /**
309
+ * \brief Internal AES block decryption function
310
+ * (Only exposed to allow overriding it,
311
+ * see MBEDTLS_AES_DECRYPT_ALT)
312
+ *
313
+ * \deprecated Superseded by mbedtls_aes_decrypt_ext() in 2.5.0
314
+ *
315
+ * \param ctx AES context
316
+ * \param input Ciphertext block
317
+ * \param output Output (plaintext) block
318
+ */
319
+ MBEDTLS_DEPRECATED static inline void mbedtls_aes_decrypt (
320
+ mbedtls_aes_context * ctx ,
321
+ const unsigned char input [16 ],
322
+ unsigned char output [16 ] )
323
+ {
324
+ mbedtls_internal_aes_decrypt ( ctx , input , output );
325
+ }
326
+
327
+ #undef MBEDTLS_DEPRECATED
328
+ #endif /* !MBEDTLS_DEPRECATED_REMOVED */
273
329
274
330
#ifdef __cplusplus
275
331
}
0 commit comments