mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-16 17:43:14 +00:00
Add guarding to aes_maybe_realign
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
This commit is contained in:
parent
95589c5c2e
commit
6a758fc7a1
@ -981,6 +981,7 @@ int mbedtls_internal_aes_decrypt(mbedtls_aes_context *ctx,
|
|||||||
*/
|
*/
|
||||||
MBEDTLS_MAYBE_UNUSED static void aes_maybe_realign(mbedtls_aes_context *ctx)
|
MBEDTLS_MAYBE_UNUSED static void aes_maybe_realign(mbedtls_aes_context *ctx)
|
||||||
{
|
{
|
||||||
|
#if defined(MAY_NEED_TO_ALIGN)
|
||||||
unsigned new_offset = mbedtls_aes_rk_offset(ctx->buf);
|
unsigned new_offset = mbedtls_aes_rk_offset(ctx->buf);
|
||||||
if (new_offset != ctx->rk_offset) {
|
if (new_offset != ctx->rk_offset) {
|
||||||
memmove(ctx->buf + new_offset, // new address
|
memmove(ctx->buf + new_offset, // new address
|
||||||
@ -988,6 +989,8 @@ MBEDTLS_MAYBE_UNUSED static void aes_maybe_realign(mbedtls_aes_context *ctx)
|
|||||||
(ctx->nr + 1) * 16); // number of round keys * bytes per rk
|
(ctx->nr + 1) * 16); // number of round keys * bytes per rk
|
||||||
ctx->rk_offset = new_offset;
|
ctx->rk_offset = new_offset;
|
||||||
}
|
}
|
||||||
|
#endif /* MAY_NEED_TO_ALIGN */
|
||||||
|
(void) ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user