summaryrefslogtreecommitdiff
path: root/lib/rsa/rsa-sign.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-07-30 10:00:17 -0600
committerTom Rini <trini@ti.com>2014-08-09 11:17:04 -0400
commit542671623129f1db947801d2756186b501c98c49 (patch)
tree4eec89ac139e09980f5d81ade3cefb1a7ed1346a /lib/rsa/rsa-sign.c
parent8ac22a60e29c4d0925e3d640a3607eabb2732b26 (diff)
downloadu-boot-imx-542671623129f1db947801d2756186b501c98c49.zip
u-boot-imx-542671623129f1db947801d2756186b501c98c49.tar.gz
u-boot-imx-542671623129f1db947801d2756186b501c98c49.tar.bz2
rsa: Fix two errors in the implementation
1. Failure to set the return code correctly 2. Failure to detect the loop end condition when the value is equal to the modulus. Reported-by: Jeroen Hofstee <jeroen@myspectrum.nl> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/rsa/rsa-sign.c')
-rw-r--r--lib/rsa/rsa-sign.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c
index f4d4338..5d9716f 100644
--- a/lib/rsa/rsa-sign.c
+++ b/lib/rsa/rsa-sign.c
@@ -76,6 +76,7 @@ static int rsa_get_pub_key(const char *keydir, const char *name, RSA **rsap)
rsa = EVP_PKEY_get1_RSA(key);
if (!rsa) {
rsa_err("Couldn't convert to a RSA style key");
+ ret = -EINVAL;
goto err_rsa;
}
fclose(f);