mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-30 00:46:22 -04:00
Use mbedtls_xor in ARIA
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
a8cf607458
commit
7bb6b84b29
@ -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 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user