hw/misc/max78000_aes: Comment Internal Key Storage
PATCH 1/1 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 <[email protected]>
--- hw/misc/max78000_aes.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/misc/max78000_aes.c +6 -0
@@ -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);
Signature · 1 line
2.34.1
Peter Maydell
AppliedQuoted 18 lines · Jackson Donaldson
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 <[email protected]>--- hw/misc/max78000_aes.c | 6 ++++++ 1 file changed, 6 insertions(+)hw/misc/max78000_aes.c +0
-0@@ -79,6 +79,12 @@ static void max78000_aes_do_crypto(Max78000AesState *s) keydata +=8 ; }
hw/misc/max78000_aes.c static void max78000_aes_do_crypto(Max78000AesState *s) · line 90
Quoted 10 lines
hw/misc/max78000_aes.c +6
-0+/* +* 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);
Applied to target-arm.next, thanks.
-- PMM