Introduce single ARIA error code for bad input data
Deprecate the old specific error codes
* MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH
* MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH
diff --git a/ChangeLog b/ChangeLog
index e5b6a24..ff413d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,6 +31,10 @@
mbedtls_ctr_drbg_update() -> mbedtls_ctr_drbg_update_ret()
mbedtls_hmac_drbg_update() -> mbedtls_hmac_drbg_update_ret()
* Extend ECDH interface to enable alternative implementations.
+ * Deprecate the ARIA error constants
+ - MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH
+ - MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH
+ in favour of a new single error MBEDTLS_ERR_ARIA_BAD_INPUT_DATA.
New deprecations
* Deprecate mbedtls_ctr_drbg_update and mbedtls_hmac_drbg_update
diff --git a/include/mbedtls/aria.h b/include/mbedtls/aria.h
index 483d4c2..ab6e8e5 100644
--- a/include/mbedtls/aria.h
+++ b/include/mbedtls/aria.h
@@ -39,6 +39,8 @@
#include <stddef.h>
#include <stdint.h>
+#include "platform_util.h"
+
#define MBEDTLS_ARIA_ENCRYPT 1 /**< ARIA encryption. */
#define MBEDTLS_ARIA_DECRYPT 0 /**< ARIA decryption. */
@@ -46,8 +48,11 @@
#define MBEDTLS_ARIA_MAX_ROUNDS 16 /**< Maxiumum number of rounds in ARIA. */
#define MBEDTLS_ARIA_MAX_KEYSIZE 32 /**< Maximum size of an ARIA key in bytes. */
-#define MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH -0x005C /**< Invalid key length. */
-#define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E /**< Invalid data input length. */
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+#define MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x005C )
+#define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x005E )
+#endif /* !MBEDTLS_DEPRECATED_REMOVED */
+#define MBEDTLS_ERR_ARIA_BAD_INPUT_DATA -0x005C /**< Bad input data. */
/* MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE is deprecated and should not be used.
*/
diff --git a/include/mbedtls/error.h b/include/mbedtls/error.h
index 0c38889..02505d9 100644
--- a/include/mbedtls/error.h
+++ b/include/mbedtls/error.h
@@ -63,7 +63,7 @@
* CTR_DBRG 4 0x0034-0x003A
* ENTROPY 3 0x003C-0x0040 0x003D-0x003F
* NET 13 0x0042-0x0052 0x0043-0x0049
- * ARIA 4 0x0058-0x005E
+ * ARIA 3 0x0058-0x005C
* ASN1 7 0x0060-0x006C
* CMAC 1 0x007A-0x007A
* PBKDF2 1 0x007C-0x007C
diff --git a/library/aria.c b/library/aria.c
index ca9e147..9763ca6 100644
--- a/library/aria.c
+++ b/library/aria.c
@@ -451,7 +451,7 @@
uint32_t w[4][4], *w2;
if( keybits != 128 && keybits != 192 && keybits != 256 )
- return( MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH );
+ return( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA );
/* Copy key to W0 (and potential remainder to W1) */
GET_UINT32_LE( w[0][0], key, 0 );
@@ -613,7 +613,7 @@
unsigned char temp[MBEDTLS_ARIA_BLOCKSIZE];
if( length % MBEDTLS_ARIA_BLOCKSIZE )
- return( MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH );
+ return( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA );
if( mode == MBEDTLS_ARIA_DECRYPT )
{