From 949ecbcd29660225f42bdfc37bdff4b79917620a Mon Sep 17 00:00:00 2001
From: Jon Mason <jon.mason@arm.com>
Date: Mon, 23 Feb 2026 11:53:38 -0500
Subject: [PATCH] Workaround compile errors in AES

TF-M commit d7c4850d8ce3abeb2634e85631b4bbadeb343f23 removes support for
bl1_aes_256_ctr_decrypt() API.  Since backporting that is more involved
than we want for this release.  Simply do some casting to address the
issues until the next release (which will have the commit referenced
previously).

Upstream-Status: Inappropriate
Signed-off-by: Jon Mason <jon.mason@arm.com>
---
 platform/ext/target/arm/corstone1000/bl1/cc312_rom_crypto.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/platform/ext/target/arm/corstone1000/bl1/cc312_rom_crypto.c b/platform/ext/target/arm/corstone1000/bl1/cc312_rom_crypto.c
index 542fc01bc7a8..5b34d90464eb 100644
--- a/platform/ext/target/arm/corstone1000/bl1/cc312_rom_crypto.c
+++ b/platform/ext/target/arm/corstone1000/bl1/cc312_rom_crypto.c
@@ -328,7 +328,7 @@ fih_int bl1_aes_256_ctr_decrypt(enum tfm_bl1_key_id_t key_id,
     uint32_t key_buf[32 / sizeof(uint32_t)];
     fih_int fih_rc;
     int32_t rc = 0;
-    const uint8_t *input_key = key_buf;
+    const uint8_t *input_key = (const uint8_t *)key_buf;
     cc3xx_err_t err;
 
     if (ciphertext_length == 0) {
@@ -356,7 +356,7 @@ fih_int bl1_aes_256_ctr_decrypt(enum tfm_bl1_key_id_t key_id,
     }
 
     err = cc3xx_lowlevel_aes_init(CC3XX_AES_DIRECTION_DECRYPT, CC3XX_AES_MODE_CTR,
-                                  cc3xx_key_type, input_key, CC3XX_AES_KEYSIZE_256,
+                                  cc3xx_key_type, (const uint32_t *)input_key, CC3XX_AES_KEYSIZE_256,
                                   (uint32_t *)counter, 16);
     fih_rc = fih_int_encode_zero_equality(err);
     if (fih_not_eq(fih_rc, FIH_SUCCESS)) {
@@ -388,7 +388,7 @@ static int32_t aes_256_ecb_encrypt(enum tfm_bl1_key_id_t key_id,
         return -1;
     }
 
-    rc = bl1_key_to_cc3xx_key(key_id, &cc3xx_key_type, key_buf, sizeof(key_buf));
+    rc = bl1_key_to_cc3xx_key(key_id, &cc3xx_key_type, (uint8_t *)key_buf, sizeof(key_buf));
     if (rc) {
         return rc;
     }
