]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
rsa: cosmetic: rename pad_len to key_len
authorAndrew Duda <aduda@meraki.com>
Tue, 8 Nov 2016 18:53:39 +0000 (18:53 +0000)
committerTom Rini <trini@konsulko.com>
Mon, 21 Nov 2016 19:07:30 +0000 (14:07 -0500)
checksum_algo's pad_len field isn't actually used to store the length of
the padding but the total length of the RSA key (msg_len + pad_len)

Signed-off-by: Andrew Duda <aduda@meraki.com>
Signed-off-by: aduda <aduda@meraki.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
include/image.h
lib/rsa/rsa-verify.c

index 2b1296c86c9407d13e2126f99ebfac85b2d1fece..bfe10a0190c19470ee3bc247865dd9b894047c41 100644 (file)
@@ -1070,7 +1070,7 @@ struct image_region {
 struct checksum_algo {
        const char *name;
        const int checksum_len;
-       const int pad_len;
+       const int key_len;
 #if IMAGE_ENABLE_SIGN
        const EVP_MD *(*calculate_sign)(void);
 #endif
index 442b7695639a20e189088af66a2d7d746c105eab..5418f594aecfeea481f905339407bd740ec5917a 100644 (file)
@@ -84,7 +84,7 @@ static int rsa_verify_key(struct key_prop *prop, const uint8_t *sig,
        }
 
        padding = algo->rsa_padding;
-       pad_len = algo->pad_len - algo->checksum_len;
+       pad_len = algo->key_len - algo->checksum_len;
 
        /* Check pkcs1.5 padding bytes. */
        if (memcmp(buf, padding, pad_len)) {
@@ -160,7 +160,7 @@ int rsa_verify(struct image_sign_info *info,
 {
        const void *blob = info->fdt_blob;
        /* Reserve memory for maximum checksum-length */
-       uint8_t hash[info->algo->checksum->pad_len];
+       uint8_t hash[info->algo->checksum->key_len];
        int ndepth, noffset;
        int sig_node, node;
        char name[100];
@@ -171,7 +171,7 @@ int rsa_verify(struct image_sign_info *info,
         * rsa-signature-length
         */
        if (info->algo->checksum->checksum_len >
-           info->algo->checksum->pad_len) {
+           info->algo->checksum->key_len) {
                debug("%s: invlaid checksum-algorithm %s for %s\n",
                      __func__, info->algo->checksum->name, info->algo->name);
                return -EINVAL;