mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Refactor AES context to be shallow-copyable
Replace RK pointer in AES context with a buffer offset, to allow shallow copying. Fixes #2147. Signed-off-by: Werner Lewis <werner.lewis@arm.com>
This commit is contained in:
committed by
Werner Lewis
parent
07040bb179
commit
dd76ef359d
@@ -82,7 +82,7 @@ int mbedtls_padlock_xcryptecb( mbedtls_aes_context *ctx,
|
||||
uint32_t *ctrl;
|
||||
unsigned char buf[256];
|
||||
|
||||
rk = ctx->rk;
|
||||
rk = ctx->buf + ctx->rk_offset;
|
||||
blk = MBEDTLS_PADLOCK_ALIGN16( buf );
|
||||
memcpy( blk, input, 16 );
|
||||
|
||||
@@ -129,7 +129,7 @@ int mbedtls_padlock_xcryptcbc( mbedtls_aes_context *ctx,
|
||||
( (long) output & 15 ) != 0 )
|
||||
return( MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED );
|
||||
|
||||
rk = ctx->rk;
|
||||
rk = ctx->buf + ctx->rk_offset;
|
||||
iw = MBEDTLS_PADLOCK_ALIGN16( buf );
|
||||
memcpy( iw, iv, 16 );
|
||||
|
||||
|
Reference in New Issue
Block a user