From 6a758fc7a137eef91185270a16b4e79357478e54 Mon Sep 17 00:00:00 2001 From: Thomas Daubney Date: Thu, 20 Jun 2024 16:43:20 +0100 Subject: [PATCH] Add guarding to aes_maybe_realign Signed-off-by: Thomas Daubney --- library/aes.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/aes.c b/library/aes.c index aaea70b16..203db0dcd 100644 --- a/library/aes.c +++ b/library/aes.c @@ -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) { +#if defined(MAY_NEED_TO_ALIGN) unsigned new_offset = mbedtls_aes_rk_offset(ctx->buf); if (new_offset != ctx->rk_offset) { 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->rk_offset = new_offset; } +#endif /* MAY_NEED_TO_ALIGN */ + (void) ctx; } /*