diff options
| author | Paul HENRYS <[email protected]> | 2024-11-25 18:47:15 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2024-12-19 09:10:34 -0600 |
| commit | 79d7b11102e31f3b92afff1c94dd9fe1a8b9a9e4 (patch) | |
| tree | 98b54533b077c73263c49227af6dbe38e0500faf /lib | |
| parent | 337bfdce5aa52637b482b182db959b9bb058f4b7 (diff) | |
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 <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/aes/aes-encrypt.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/aes/aes-encrypt.c b/lib/aes/aes-encrypt.c index e74e35eaa28..90e1407b4f0 100644 --- a/lib/aes/aes-encrypt.c +++ b/lib/aes/aes-encrypt.c @@ -84,6 +84,13 @@ int image_aes_add_cipher_data(struct image_cipher_info *info, void *keydest, char name[128]; int ret = 0; + if (!keydest && !info->ivname) { + /* At least, store the IV in the FIT image */ + ret = fdt_setprop(fit, node_noffset, "iv", + info->iv, info->cipher->iv_len); + goto done; + } + /* Either create or overwrite the named cipher node */ parent = fdt_subnode_offset(keydest, 0, FIT_CIPHER_NODENAME); if (parent == -FDT_ERR_NOTFOUND) { |
