Commit d0215d8718da ("tools: mkimage: use an explicit iv from the
cipher node when encrypting") added FIT_IV_HINT and FIT_IV_PROP but did
not convert the other places that spell the iv-name-hint and iv
property names out: fit_image_setup_decrypt() on the boot side and
image_aes_add_cipher_data() in mkimage, which stores the IV. Use the
constants there as well.

This includes the iv property of the key node that mkimage adds to the
U-Boot device tree and U-Boot reads back. That node is not part of the
FIT, but lib/rsa/rsa-sign.c already uses FIT_KEY_HINT, FIT_ALGO_PROP and
FIT_KEY_REQUIRED for the properties of the key node it writes.

No functional change intended.

Signed-off-by: Aristo Chen <[email protected]>
---
 boot/image-cipher.c   | 6 +++---
 lib/aes/aes-encrypt.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/boot/image-cipher.c b/boot/image-cipher.c
index 9d389f26cea..535c671317d 100644
--- a/boot/image-cipher.c
+++ b/boot/image-cipher.c
@@ -94,8 +94,8 @@ static int fit_image_setup_decrypt(struct image_cipher_info 
*info,
                return -1;
        }
 
-       info->iv = fdt_getprop(fit, cipher_noffset, "iv", NULL);
-       info->ivname = fdt_getprop(fit, cipher_noffset, "iv-name-hint", NULL);
+       info->iv = fdt_getprop(fit, cipher_noffset, FIT_IV_PROP, NULL);
+       info->ivname = fdt_getprop(fit, cipher_noffset, FIT_IV_HINT, NULL);
 
        if (!info->iv && !info->ivname) {
                printf("Can't get IV or IV name\n");
@@ -144,7 +144,7 @@ static int fit_image_setup_decrypt(struct image_cipher_info 
*info,
 
        /* read iv */
        if (!info->iv) {
-               info->iv = fdt_getprop(fdt, noffset, "iv", NULL);
+               info->iv = fdt_getprop(fdt, noffset, FIT_IV_PROP, NULL);
                if (!info->iv) {
                        printf("Can't get IV in cipher node '%s'\n", node_path);
                        return -1;
diff --git a/lib/aes/aes-encrypt.c b/lib/aes/aes-encrypt.c
index 90e1407b4f0..def33a3b324 100644
--- a/lib/aes/aes-encrypt.c
+++ b/lib/aes/aes-encrypt.c
@@ -86,7 +86,7 @@ int image_aes_add_cipher_data(struct image_cipher_info *info, 
void *keydest,
 
        if (!keydest && !info->ivname) {
                /* At least, store the IV in the FIT image */
-               ret = fdt_setprop(fit, node_noffset, "iv",
+               ret = fdt_setprop(fit, node_noffset, FIT_IV_PROP,
                                  info->iv, info->cipher->iv_len);
                goto done;
        }
@@ -137,11 +137,11 @@ int image_aes_add_cipher_data(struct image_cipher_info 
*info, void *keydest,
 
        if (info->ivname)
                /* Store the IV in the u-boot device tree */
-               ret = fdt_setprop(keydest, node, "iv",
+               ret = fdt_setprop(keydest, node, FIT_IV_PROP,
                                  info->iv, info->cipher->iv_len);
        else
                /* Store the IV in the FIT image */
-               ret = fdt_setprop(fit, node_noffset, "iv",
+               ret = fdt_setprop(fit, node_noffset, FIT_IV_PROP,
                                  info->iv, info->cipher->iv_len);
 
        if (!ret)
-- 
2.43.0

Reply via email to