mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Use mbedtls_xor in ARIA
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
@@ -588,7 +588,6 @@ int mbedtls_aria_crypt_cbc( mbedtls_aria_context *ctx,
|
||||
const unsigned char *input,
|
||||
unsigned char *output )
|
||||
{
|
||||
int i;
|
||||
unsigned char temp[MBEDTLS_ARIA_BLOCKSIZE];
|
||||
|
||||
ARIA_VALIDATE_RET( ctx != NULL );
|
||||
@@ -608,8 +607,7 @@ int mbedtls_aria_crypt_cbc( mbedtls_aria_context *ctx,
|
||||
memcpy( temp, input, MBEDTLS_ARIA_BLOCKSIZE );
|
||||
mbedtls_aria_crypt_ecb( ctx, input, output );
|
||||
|
||||
for( i = 0; i < MBEDTLS_ARIA_BLOCKSIZE; i++ )
|
||||
output[i] = (unsigned char)( output[i] ^ iv[i] );
|
||||
mbedtls_xor( output, output, iv, MBEDTLS_ARIA_BLOCKSIZE );
|
||||
|
||||
memcpy( iv, temp, MBEDTLS_ARIA_BLOCKSIZE );
|
||||
|
||||
@@ -622,8 +620,7 @@ int mbedtls_aria_crypt_cbc( mbedtls_aria_context *ctx,
|
||||
{
|
||||
while( length > 0 )
|
||||
{
|
||||
for( i = 0; i < MBEDTLS_ARIA_BLOCKSIZE; i++ )
|
||||
output[i] = (unsigned char)( input[i] ^ iv[i] );
|
||||
mbedtls_xor( output, input, iv, MBEDTLS_ARIA_BLOCKSIZE );
|
||||
|
||||
mbedtls_aria_crypt_ecb( ctx, output, output );
|
||||
memcpy( iv, output, MBEDTLS_ARIA_BLOCKSIZE );
|
||||
|
Reference in New Issue
Block a user