]> Git Repo - J-u-boot.git/blobdiff - lib/rsa/rsa-verify.c
dtoc: Make use of node properties
[J-u-boot.git] / lib / rsa / rsa-verify.c
index 2057f6819db8ac721ad99d4980ac9d579f3ff5b6..aee76f42d578da3b1aba7c53a0fe379365c0d7a0 100644 (file)
@@ -439,12 +439,20 @@ static int rsa_verify_with_keynode(struct image_sign_info *info,
        struct key_prop prop;
        int length;
        int ret = 0;
+       const char *algo;
 
        if (node < 0) {
                debug("%s: Skipping invalid node", __func__);
                return -EBADF;
        }
 
+       algo = fdt_getprop(blob, node, "algo", NULL);
+       if (strcmp(info->name, algo)) {
+               debug("%s: Wrong algo: have %s, expected %s", __func__,
+                     info->name, algo);
+               return -EFAULT;
+       }
+
        prop.num_bits = fdtdec_get_int(blob, node, "rsa,num-bits", 0);
 
        prop.n0inv = fdtdec_get_int(blob, node, "rsa,n0-inverse", 0);
@@ -517,10 +525,10 @@ int rsa_verify_hash(struct image_sign_info *info,
                        return ret;
 
                /* No luck, so try each of the keys in turn */
-               for (ndepth = 0, noffset = fdt_next_node(info->fit, sig_node,
+               for (ndepth = 0, noffset = fdt_next_node(blob, sig_node,
                                                         &ndepth);
                     (noffset >= 0) && (ndepth > 0);
-                    noffset = fdt_next_node(info->fit, noffset, &ndepth)) {
+                    noffset = fdt_next_node(blob, noffset, &ndepth)) {
                        if (ndepth == 1 && noffset != node) {
                                ret = rsa_verify_with_keynode(info, hash,
                                                              sig, sig_len,
@@ -540,7 +548,7 @@ int rsa_verify(struct image_sign_info *info,
 {
        /* Reserve memory for maximum checksum-length */
        uint8_t hash[info->crypto->key_len];
-       int ret = -EACCES;
+       int ret;
 
        /*
         * Verify that the checksum-length does not exceed the
This page took 0.026941 seconds and 4 git commands to generate.