Merge tag 'u-boot-amlogic-20200428' of https://gitlab.denx.de/u-boot/custodians/u...
[oweals/u-boot.git] / tools / image-host.c
index 9483561bfa518487366a131d81d2c94d509081f1..9a83b7f6755f89c6b202897d7487fcdbe687a891 100644 (file)
@@ -10,9 +10,9 @@
 
 #include "mkimage.h"
 #include <bootm.h>
+#include <fdt_region.h>
 #include <image.h>
 #include <version.h>
-#include <uboot_aes.h>
 
 /**
  * fit_set_hash_value - set hash value in requested has node
@@ -171,7 +171,7 @@ static int fit_image_setup_sig(struct image_sign_info *info,
 
        memset(info, '\0', sizeof(*info));
        info->keydir = keydir;
-       info->keyname = fdt_getprop(fit, noffset, "key-name-hint", NULL);
+       info->keyname = fdt_getprop(fit, noffset, FIT_KEY_HINT, NULL);
        info->fit = fit;
        info->node_offset = noffset;
        info->name = strdup(algo_name);
@@ -250,7 +250,7 @@ static int fit_image_process_sig(const char *keydir, void *keydest,
        free(value);
 
        /* Get keyname again, as FDT has changed and invalidated our pointer */
-       info.keyname = fdt_getprop(fit, noffset, "key-name-hint", NULL);
+       info.keyname = fdt_getprop(fit, noffset, FIT_KEY_HINT, NULL);
 
        /*
         * Write the public key into the supplied FDT file; this might fail
@@ -308,7 +308,7 @@ static int fit_image_read_data(char *filename, unsigned char *data,
 
        /* Check that we have read all the file */
        if (n != sbuf.st_size) {
-               printf("Can't read all file %s (read %ld bytes, expexted %ld)\n",
+               printf("Can't read all file %s (read %zd bytes, expexted %ld)\n",
                       filename, n, sbuf.st_size);
                goto err;
        }
@@ -338,7 +338,7 @@ static int fit_image_setup_cipher(struct image_cipher_info *info,
        info->keydir = keydir;
 
        /* Read the key name */
-       info->keyname = fdt_getprop(fit, noffset, "key-name-hint", NULL);
+       info->keyname = fdt_getprop(fit, noffset, FIT_KEY_HINT, NULL);
        if (!info->keyname) {
                printf("Can't get key name for cipher '%s' in image '%s'\n",
                       node_name, image_name);
@@ -887,7 +887,7 @@ static int fit_config_process_sig(const char *keydir, void *keydest,
        free(region_prop);
 
        /* Get keyname again, as FDT has changed and invalidated our pointer */
-       info.keyname = fdt_getprop(fit, noffset, "key-name-hint", NULL);
+       info.keyname = fdt_getprop(fit, noffset, FIT_KEY_HINT, NULL);
 
        /* Write the public key into the supplied FDT file */
        if (keydest) {
@@ -1026,19 +1026,22 @@ int fit_add_verification_data(const char *keydir, void *keydest, void *fit,
 }
 
 #ifdef CONFIG_FIT_SIGNATURE
-int fit_check_sign(const void *fit, const void *key)
+int fit_check_sign(const void *fit, const void *key,
+                  const char *fit_uname_config)
 {
        int cfg_noffset;
        int ret;
 
-       cfg_noffset = fit_conf_get_node(fit, NULL);
+       cfg_noffset = fit_conf_get_node(fit, fit_uname_config);
        if (!cfg_noffset)
                return -1;
 
-       printf("Verifying Hash Integrity ... ");
+       printf("Verifying Hash Integrity for node '%s'... ",
+              fdt_get_name(fit, cfg_noffset, NULL));
        ret = fit_config_verify(fit, cfg_noffset);
        if (ret)
                return ret;
+       printf("Verified OK, loading images\n");
        ret = bootm_host_load_images(fit, cfg_noffset);
 
        return ret;