mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 07:18:08 +00:00
Introduce single CAMELLIA error code for bad input data
Deprecate the old specific error codes * MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH * MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH
This commit is contained in:
parent
2f47550018
commit
4c029d09be
5 changed files with 18 additions and 9 deletions
|
@ -35,6 +35,10 @@ API Changes
|
||||||
- MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH
|
- MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH
|
||||||
- MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH
|
- MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH
|
||||||
in favour of a new single error MBEDTLS_ERR_ARIA_BAD_INPUT_DATA.
|
in favour of a new single error MBEDTLS_ERR_ARIA_BAD_INPUT_DATA.
|
||||||
|
* Deprecate the CAMELLIA error constants
|
||||||
|
- MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH
|
||||||
|
- MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH
|
||||||
|
in favour of a new single error MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA.
|
||||||
|
|
||||||
New deprecations
|
New deprecations
|
||||||
* Deprecate mbedtls_ctr_drbg_update and mbedtls_hmac_drbg_update
|
* Deprecate mbedtls_ctr_drbg_update and mbedtls_hmac_drbg_update
|
||||||
|
|
|
@ -33,11 +33,16 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "platform_util.h"
|
||||||
|
|
||||||
#define MBEDTLS_CAMELLIA_ENCRYPT 1
|
#define MBEDTLS_CAMELLIA_ENCRYPT 1
|
||||||
#define MBEDTLS_CAMELLIA_DECRYPT 0
|
#define MBEDTLS_CAMELLIA_DECRYPT 0
|
||||||
|
|
||||||
#define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0024 /**< Invalid key length. */
|
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||||
#define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026 /**< Invalid data input length. */
|
#define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x0024 )
|
||||||
|
#define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x0026 )
|
||||||
|
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||||
|
#define MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA -0x0024 /**< Bad input data. */
|
||||||
|
|
||||||
/* MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED is deprecated and should not be used.
|
/* MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED is deprecated and should not be used.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
* BLOWFISH 3 0x0016-0x0018 0x0017-0x0017
|
* BLOWFISH 3 0x0016-0x0018 0x0017-0x0017
|
||||||
* THREADING 3 0x001A-0x001E
|
* THREADING 3 0x001A-0x001E
|
||||||
* AES 5 0x0020-0x0022 0x0021-0x0025
|
* AES 5 0x0020-0x0022 0x0021-0x0025
|
||||||
* CAMELLIA 3 0x0024-0x0026 0x0027-0x0027
|
* CAMELLIA 2 0x0024-0x0024 0x0027-0x0027
|
||||||
* XTEA 2 0x0028-0x0028 0x0029-0x0029
|
* XTEA 2 0x0028-0x0028 0x0029-0x0029
|
||||||
* BASE64 2 0x002A-0x002C
|
* BASE64 2 0x002A-0x002C
|
||||||
* OID 1 0x002E-0x002E 0x000B-0x000B
|
* OID 1 0x002E-0x002E 0x000B-0x000B
|
||||||
|
|
|
@ -356,7 +356,7 @@ int mbedtls_camellia_setkey_enc( mbedtls_camellia_context *ctx, const unsigned c
|
||||||
case 128: ctx->nr = 3; idx = 0; break;
|
case 128: ctx->nr = 3; idx = 0; break;
|
||||||
case 192:
|
case 192:
|
||||||
case 256: ctx->nr = 4; idx = 1; break;
|
case 256: ctx->nr = 4; idx = 1; break;
|
||||||
default : return( MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH );
|
default : return( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i = 0; i < keybits / 8; ++i )
|
for( i = 0; i < keybits / 8; ++i )
|
||||||
|
@ -562,7 +562,7 @@ int mbedtls_camellia_crypt_cbc( mbedtls_camellia_context *ctx,
|
||||||
unsigned char temp[16];
|
unsigned char temp[16];
|
||||||
|
|
||||||
if( length % 16 )
|
if( length % 16 )
|
||||||
return( MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH );
|
return( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA );
|
||||||
|
|
||||||
if( mode == MBEDTLS_CAMELLIA_DECRYPT )
|
if( mode == MBEDTLS_CAMELLIA_DECRYPT )
|
||||||
{
|
{
|
||||||
|
|
|
@ -185,16 +185,16 @@ depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||||
camellia_decrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"555FC3F34BDD2D54C62D9E3BF338C1C4":"F69F2445DF4F9B17AD2B417BE66C3710":"5953ADCE14DB8C7F39F1BD39F359BFFA"
|
camellia_decrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"555FC3F34BDD2D54C62D9E3BF338C1C4":"F69F2445DF4F9B17AD2B417BE66C3710":"5953ADCE14DB8C7F39F1BD39F359BFFA"
|
||||||
|
|
||||||
Camellia-ECB Encrypt (Invalid key length)
|
Camellia-ECB Encrypt (Invalid key length)
|
||||||
camellia_encrypt_ecb:"0123456789abcdeffedcba98765432":"0123456789abcdeffedcba9876543210":"67673138549669730857065648eabe43":MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH
|
camellia_encrypt_ecb:"0123456789abcdeffedcba98765432":"0123456789abcdeffedcba9876543210":"67673138549669730857065648eabe43":MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA
|
||||||
|
|
||||||
Camellia-ECB Decrypt (Invalid key length)
|
Camellia-ECB Decrypt (Invalid key length)
|
||||||
camellia_decrypt_ecb:"0123456789abcdeffedcba98765432":"0123456789abcdeffedcba9876543210":"67673138549669730857065648eabe43":MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH
|
camellia_decrypt_ecb:"0123456789abcdeffedcba98765432":"0123456789abcdeffedcba9876543210":"67673138549669730857065648eabe43":MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA
|
||||||
|
|
||||||
Camellia-256-CBC Encrypt (Invalid input length)
|
Camellia-256-CBC Encrypt (Invalid input length)
|
||||||
camellia_encrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"ffffffffffffffe000000000000000":"":MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH
|
camellia_encrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"ffffffffffffffe000000000000000":"":MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA
|
||||||
|
|
||||||
Camellia-256-CBC Decrypt (Invalid input length)
|
Camellia-256-CBC Decrypt (Invalid input length)
|
||||||
camellia_decrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"623a52fcea5d443e48d9181ab32c74":"":MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH
|
camellia_decrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"623a52fcea5d443e48d9181ab32c74":"":MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA
|
||||||
|
|
||||||
Camellia Selftest
|
Camellia Selftest
|
||||||
depends_on:MBEDTLS_SELF_TEST
|
depends_on:MBEDTLS_SELF_TEST
|
||||||
|
|
Loading…
Reference in a new issue