Skip to content
Snippets Groups Projects
Commit 54267162 authored by Simon Glass's avatar Simon Glass Committed by Tom Rini
Browse files

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: default avatarJeroen Hofstee <jeroen@myspectrum.nl>
Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
parent 8ac22a60
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -57,9 +57,9 @@ static void subtract_modulus(const struct rsa_public_key *key, uint32_t num[])
static int greater_equal_modulus(const struct rsa_public_key *key,
uint32_t num[])
{
uint32_t i;
int i;
for (i = key->len - 1; i >= 0; i--) {
for (i = (int)key->len - 1; i >= 0; i--) {
if (num[i] < key->modulus[i])
return 0;
if (num[i] > key->modulus[i])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment