aes: Allow to store randomly generated IV in the FIT

When the initialisation vector is randomly generated, its value shall be
stored in the FIT together with the encrypted data. The changes allow to
store the IV in the FIT also in the case where the key is not stored in
the DTB but retrieved somewhere else at runtime.

Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Paul HENRYS
2024-11-25 18:47:15 +01:00
committed by Simon Glass
parent 558aa24b46
commit 3c70ace95c
3 changed files with 23 additions and 1 deletions

View File

@@ -540,7 +540,7 @@ fit_image_process_cipher(const char *keydir, void *keydest, void *fit,
* size values
* And, if needed, write the iv in the FIT file
*/
if (keydest) {
if (keydest || (!keydest && !info.ivname)) {
ret = info.cipher->add_cipher_data(&info, keydest, fit, node_noffset);
if (ret) {
fprintf(stderr,