Commit 195f273b6c86 ("tools: mkimage: resolve image-data references
between FIT images") added FIT_DATA_SIZE_UNCIPHERED_PROP but did not
convert the existing code that spells the property name out:
fit_image_get_data_size_unciphered() on the boot side, and in mkimage
fit_image_write_cipher(), which adds the property, and
fit_image_cipher_data(), which checks for it to avoid encrypting the
data twice. Use the constant there as well, and in the fit_cipher unit
test that creates the property.

No functional change intended.

Signed-off-by: Aristo Chen <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
---
v2: also convert the two literals in test/boot/fit_cipher.c, as
suggested by Simon, no other changes, Reviewed-by kept

 boot/image-fit.c       | 2 +-
 test/boot/fit_cipher.c | 4 ++--
 tools/image-host.c     | 6 ++++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/boot/image-fit.c b/boot/image-fit.c
index e173108033b..cf435329e44 100644
--- a/boot/image-fit.c
+++ b/boot/image-fit.c
@@ -1044,7 +1044,7 @@ int fit_image_get_data_size_unciphered(const void *fit, 
int noffset,
        const fdt32_t *val;
        int len;
 
-       val = fdt_getprop(fit, noffset, "data-size-unciphered", &len);
+       val = fdt_getprop(fit, noffset, FIT_DATA_SIZE_UNCIPHERED_PROP, &len);
        if (!val)
                return -ENOENT;
 
diff --git a/test/boot/fit_cipher.c b/test/boot/fit_cipher.c
index b98c69fcb0b..3bb73ccaebf 100644
--- a/test/boot/fit_cipher.c
+++ b/test/boot/fit_cipher.c
@@ -96,14 +96,14 @@ static int fit_cipher_test_data_size_unciphered_len(struct 
unit_test_state *uts)
 
        img = fdt_add_subnode(fit, images, "kernel");
        ut_assert(img >= 0);
-       ut_assertok(fdt_setprop(fit, img, "data-size-unciphered",
+       ut_assertok(fdt_setprop(fit, img, FIT_DATA_SIZE_UNCIPHERED_PROP,
                                &truncated, sizeof(truncated)));
 
        ret = fit_image_get_data_size_unciphered(fit, img, &data_size);
        ut_asserteq(-EINVAL, ret);
 
        /* a correctly sized property still works */
-       ut_assertok(fdt_setprop(fit, img, "data-size-unciphered",
+       ut_assertok(fdt_setprop(fit, img, FIT_DATA_SIZE_UNCIPHERED_PROP,
                                &valid, sizeof(valid)));
        ut_assertok(fit_image_get_data_size_unciphered(fit, img, &data_size));
        ut_asserteq(0x100, data_size);
diff --git a/tools/image-host.c b/tools/image-host.c
index 7718d8f678a..4774c1743c5 100644
--- a/tools/image-host.c
+++ b/tools/image-host.c
@@ -529,7 +529,8 @@ int fit_image_write_cipher(void *fit, int image_noffset, 
int noffset,
        }
 
        /* add non ciphered data size */
-       ret = fdt_setprop_u32(fit, image_noffset, "data-size-unciphered", size);
+       ret = fdt_setprop_u32(fit, image_noffset,
+                             FIT_DATA_SIZE_UNCIPHERED_PROP, size);
        if (ret == -FDT_ERR_NOSPACE) {
                ret = -ENOSPC;
                goto out;
@@ -623,7 +624,8 @@ int fit_image_cipher_data(const char *keydir, void *keydest,
         * image is already encrypted. This is important as 'mkimage -F' can be
         * run multiple times on a FIT image.
         */
-       if (fdt_getprop(fit, image_noffset, "data-size-unciphered", &len))
+       if (fdt_getprop(fit, image_noffset,
+                       FIT_DATA_SIZE_UNCIPHERED_PROP, &len))
                return 0;
        if (len != -FDT_ERR_NOTFOUND) {
                fprintf(stderr, "Failure testing for data-size-unciphered\n");
-- 
2.43.0

Reply via email to