From a034369eca145b9cdf132938d552ffcf812cd0c6 Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Tue, 18 Dec 2018 09:42:58 +0000 Subject: [PATCH] Undo deprecation of MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH --- ChangeLog | 6 ++---- include/mbedtls/aria.h | 3 ++- include/mbedtls/error.h | 2 +- library/aria.c | 2 +- library/error.c | 2 ++ 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a569a389..42e3f9420 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,10 +31,8 @@ API Changes 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. + * Deprecate the ARIA error MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH + in favour of a new generic error MBEDTLS_ERR_ARIA_BAD_INPUT_DATA. * Deprecate the CAMELLIA error MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH in favour a new generic error MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA. * Deprecate the Blowfish error constants diff --git a/include/mbedtls/aria.h b/include/mbedtls/aria.h index 61987507f..9e981d92c 100644 --- a/include/mbedtls/aria.h +++ b/include/mbedtls/aria.h @@ -50,10 +50,11 @@ #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. */ +#define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E /**< Invalid data input length. */ + /* MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE is deprecated and should not be used. */ #define MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE -0x005A /**< Feature not available. For example, an unsupported ARIA key size. */ diff --git a/include/mbedtls/error.h b/include/mbedtls/error.h index c4883be65..56042c90c 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 3 0x0058-0x005C + * ARIA 4 0x0058-0x005E * ASN1 7 0x0060-0x006C * CMAC 1 0x007A-0x007A * PBKDF2 1 0x007C-0x007C diff --git a/library/aria.c b/library/aria.c index 9763ca6ed..6d87941c1 100644 --- a/library/aria.c +++ b/library/aria.c @@ -613,7 +613,7 @@ int mbedtls_aria_crypt_cbc( mbedtls_aria_context *ctx, unsigned char temp[MBEDTLS_ARIA_BLOCKSIZE]; if( length % MBEDTLS_ARIA_BLOCKSIZE ) - return( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA ); + return( MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH ); if( mode == MBEDTLS_ARIA_DECRYPT ) { diff --git a/library/error.c b/library/error.c index 80f4948b9..a70db689d 100644 --- a/library/error.c +++ b/library/error.c @@ -620,6 +620,8 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen ) #if defined(MBEDTLS_ARIA_C) if( use_ret == -(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA) ) mbedtls_snprintf( buf, buflen, "ARIA - Bad input data" ); + if( use_ret == -(MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH) ) + mbedtls_snprintf( buf, buflen, "ARIA - Invalid data input length" ); if( use_ret == -(MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE) ) mbedtls_snprintf( buf, buflen, "ARIA - Feature not available. For example, an unsupported ARIA key size" ); if( use_ret == -(MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED) )