]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
fdt: Check for a token to skip auto-hash validation
authorJoe Hershberger <joe.hershberger@ni.com>
Fri, 17 Aug 2012 10:34:39 +0000 (10:34 +0000)
committerGerald Van Baren <gvb@unssw.com>
Mon, 15 Oct 2012 23:20:32 +0000 (19:20 -0400)
Allow the itb file to declare to u-boot that its hash should not be
checked automatically on bootm or iminfo.  This allows an image to
either be checked automatically or to include a script which may
check it otherwise (such as after part of the itb has been relocated
to RAM by the script).

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
common/image.c
include/image.h

index 852a96fab8b89b0c9b59ed9d0b606c814180d6c1..750a98b6ba9e46880f222c7fc6796d4427241f0b 100644 (file)
@@ -2496,6 +2496,36 @@ int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value,
        return 0;
 }
 
+#ifndef USE_HOSTCC
+/**
+ * fit_image_hash_get_ignore - get hash ignore flag
+ * @fit: pointer to the FIT format image header
+ * @noffset: hash node offset
+ * @ignore: pointer to an int, will hold hash ignore flag
+ *
+ * fit_image_hash_get_ignore() finds hash ignore property in a given hash node.
+ * If the property is found and non-zero, the hash algorithm is not verified by
+ * u-boot automatically.
+ *
+ * returns:
+ *     0, on ignore not found
+ *     value, on ignore found
+ */
+int fit_image_hash_get_ignore(const void *fit, int noffset, int *ignore)
+{
+       int len;
+       int *value;
+
+       value = (int *)fdt_getprop(fit, noffset, FIT_IGNORE_PROP, &len);
+       if (value == NULL || len != sizeof(int))
+               *ignore = 0;
+       else
+               *ignore = *value;
+
+       return 0;
+}
+#endif
+
 /**
  * fit_set_timestamp - set node timestamp property
  * @fit: pointer to the FIT format image header
@@ -2759,6 +2789,9 @@ int fit_image_check_hashes(const void *fit, int image_noffset)
        char            *algo;
        uint8_t         *fit_value;
        int             fit_value_len;
+#ifndef USE_HOSTCC
+       int             ignore;
+#endif
        uint8_t         value[FIT_MAX_HASH_LEN];
        int             value_len;
        int             noffset;
@@ -2795,6 +2828,14 @@ int fit_image_check_hashes(const void *fit, int image_noffset)
                        }
                        printf("%s", algo);
 
+#ifndef USE_HOSTCC
+                       fit_image_hash_get_ignore(fit, noffset, &ignore);
+                       if (ignore) {
+                               printf("-skipped ");
+                               continue;
+                       }
+#endif
+
                        if (fit_image_hash_get_value(fit, noffset, &fit_value,
                                                        &fit_value_len)) {
                                err_msg = " error!\nCan't get hash value "
index e5f6649291e24ccd524f67e211cd2bb63bf482a4..4e5863ff7fbd73fb6c22b981a2445f80b2213cc1 100644 (file)
@@ -511,6 +511,7 @@ static inline int image_check_target_arch(const image_header_t *hdr)
 #define FIT_HASH_NODENAME      "hash"
 #define FIT_ALGO_PROP          "algo"
 #define FIT_VALUE_PROP         "value"
+#define FIT_IGNORE_PROP                "uboot-ignore"
 
 /* image node */
 #define FIT_DATA_PROP          "data"
@@ -595,6 +596,9 @@ int fit_image_get_data(const void *fit, int noffset,
 int fit_image_hash_get_algo(const void *fit, int noffset, char **algo);
 int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value,
                                int *value_len);
+#ifndef USE_HOSTCC
+int fit_image_hash_get_ignore(const void *fit, int noffset, int *ignore);
+#endif
 
 int fit_set_timestamp(void *fit, int noffset, time_t timestamp);
 int fit_set_hashes(void *fit);