summary refs log tree commit diff stats
path: root/hw/misc
diff options
context:
space:
mode:
authorJackson Donaldson <jackson88044@gmail.com>2025-07-21 10:07:53 +0100
committerPeter Maydell <peter.maydell@linaro.org>2025-07-21 10:07:53 +0100
commit30dbcd9283988ba352181cb42c6a69ae32075363 (patch)
treea41086a63fe89995a9340b440fa07617c7f31e58 /hw/misc
parente74aad9f81cc2bfee2057086610e21bd98e9c5a5 (diff)
downloadfocaccia-qemu-30dbcd9283988ba352181cb42c6a69ae32075363.tar.gz
focaccia-qemu-30dbcd9283988ba352181cb42c6a69ae32075363.zip
hw/misc/max78000_aes: Comment Internal Key Storage
Coverity Scan noted an unusual pattern in the
MAX78000 aes device, with duplicated calls to
set_decrypt. This commit adds a comment noting
why the implementation is correct.

Signed-off-by: Jackson Donaldson <jcksn@duck.com>
Message-id: 20250716002622.84685-1-jcksn@duck.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/misc')
-rw-r--r--hw/misc/max78000_aes.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/misc/max78000_aes.c b/hw/misc/max78000_aes.c
index 0bfb2f02b5..d883ddd2b6 100644
--- a/hw/misc/max78000_aes.c
+++ b/hw/misc/max78000_aes.c
@@ -79,6 +79,12 @@ static void max78000_aes_do_crypto(Max78000AesState *s)
         keydata += 8;
     }
 
+    /*
+     * The MAX78000 AES engine stores an internal key, which it uses only
+     * for decryption. This results in the slighly odd looking pairs of
+     * set_encrypt and set_decrypt calls below; s->internal_key is
+     * being stored for later use in both cases.
+     */
     AES_KEY key;
     if ((s->ctrl & TYPE) == 0) {
         AES_set_encrypt_key(keydata, keylen, &key);