Add fallback when rk unaligned with padlock
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
This commit is contained in:
parent
ec0193d019
commit
c1999d5746
1 changed files with 9 additions and 3 deletions
|
@ -83,6 +83,10 @@ int mbedtls_padlock_xcryptecb( mbedtls_aes_context *ctx,
|
||||||
unsigned char buf[256];
|
unsigned char buf[256];
|
||||||
|
|
||||||
rk = ctx->buf + ctx->rk_offset;
|
rk = ctx->buf + ctx->rk_offset;
|
||||||
|
|
||||||
|
if( ( (long) rk & 15 ) != 0 )
|
||||||
|
return( MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED );
|
||||||
|
|
||||||
blk = MBEDTLS_PADLOCK_ALIGN16( buf );
|
blk = MBEDTLS_PADLOCK_ALIGN16( buf );
|
||||||
memcpy( blk, input, 16 );
|
memcpy( blk, input, 16 );
|
||||||
|
|
||||||
|
@ -125,11 +129,13 @@ int mbedtls_padlock_xcryptcbc( mbedtls_aes_context *ctx,
|
||||||
uint32_t *ctrl;
|
uint32_t *ctrl;
|
||||||
unsigned char buf[256];
|
unsigned char buf[256];
|
||||||
|
|
||||||
|
rk = ctx->buf + ctx->rk_offset;
|
||||||
|
|
||||||
if( ( (long) input & 15 ) != 0 ||
|
if( ( (long) input & 15 ) != 0 ||
|
||||||
( (long) output & 15 ) != 0 )
|
( (long) output & 15 ) != 0 ||
|
||||||
|
( (long) rk & 15 ) != 0 )
|
||||||
return( MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED );
|
return( MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED );
|
||||||
|
|
||||||
rk = ctx->buf + ctx->rk_offset;
|
|
||||||
iw = MBEDTLS_PADLOCK_ALIGN16( buf );
|
iw = MBEDTLS_PADLOCK_ALIGN16( buf );
|
||||||
memcpy( iw, iv, 16 );
|
memcpy( iw, iv, 16 );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue