All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] kwbimage: fixing the issue with proper return code checking
@ 2019-04-17  9:20 Young Xiao
  0 siblings, 0 replies; 3+ messages in thread
From: Young Xiao @ 2019-04-17  9:20 UTC (permalink / raw)
  To: u-boot

EVP_VerifyFinal would return one of three values:
1 if the data is verified to be correct;
0 if it is incorrect;
-1 if there is any failure in the verification process.

The varification in unpatched version is wrong, since it ignored
the return value of -1.

The bug allows a malformed signature to be treated as a good
signature rather than as an error. This issue affects the
signature checks on DSA ans ECDSA keys used with SSL/TLS.

This issue is similar to CVE-2008-5077, CVE-2009-0021,
CVE-2009-0025, CVE-2009-0046 ~ CVE-2009-0049.

Signed-off-by: Young Xiao <92siuyang@gmail.com>
---
 tools/kwbimage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index dffaf90..b8f8d38 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -701,7 +701,7 @@ int kwb_verify(RSA *key, void *data, int datasz, struct sig_v1 *sig,
 		goto err_ctx;
 	}
 
-	if (!EVP_VerifyFinal(ctx, sig->sig, sizeof(sig->sig), evp_key)) {
+	if (EVP_VerifyFinal(ctx, sig->sig, sizeof(sig->sig), evp_key) != 1) {
 		ret = openssl_err("Could not verify signature");
 		goto err_ctx;
 	}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] kwbimage: fixing the issue with proper return code checking
  2019-04-17 10:53 Young Xiao
@ 2019-05-03 11:46 ` Stefan Roese
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Roese @ 2019-05-03 11:46 UTC (permalink / raw)
  To: u-boot

On 17.04.19 12:53, Young Xiao wrote:
> EVP_VerifyFinal would return one of three values:
> 1 if the data is verified to be correct;
> 0 if it is incorrect;
> -1 if there is any failure in the verification process.
> 
> The varification in unpatched version is wrong, since it ignored
> the return value of -1.
> 
> The bug allows a malformed signature to be treated as a good
> signature rather than as an error. This issue affects the
> signature checks on DSA ans ECDSA keys used with SSL/TLS.
> 
> This issue is similar to CVE-2008-5077, CVE-2009-0021,
> CVE-2009-0025, CVE-2009-0046 ~ CVE-2009-0049.
> 
> Signed-off-by: Young Xiao <92siuyang@gmail.com>

Applied to u-boot-marvell/master.

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] kwbimage: fixing the issue with proper return code checking
@ 2019-04-17 10:53 Young Xiao
  2019-05-03 11:46 ` Stefan Roese
  0 siblings, 1 reply; 3+ messages in thread
From: Young Xiao @ 2019-04-17 10:53 UTC (permalink / raw)
  To: u-boot

EVP_VerifyFinal would return one of three values:
1 if the data is verified to be correct;
0 if it is incorrect;
-1 if there is any failure in the verification process.

The varification in unpatched version is wrong, since it ignored
the return value of -1.

The bug allows a malformed signature to be treated as a good
signature rather than as an error. This issue affects the
signature checks on DSA ans ECDSA keys used with SSL/TLS.

This issue is similar to CVE-2008-5077, CVE-2009-0021,
CVE-2009-0025, CVE-2009-0046 ~ CVE-2009-0049.

Signed-off-by: Young Xiao <92siuyang@gmail.com>
---
 tools/kwbimage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index dffaf90..b8f8d38 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -701,7 +701,7 @@ int kwb_verify(RSA *key, void *data, int datasz, struct sig_v1 *sig,
 		goto err_ctx;
 	}
 
-	if (!EVP_VerifyFinal(ctx, sig->sig, sizeof(sig->sig), evp_key)) {
+	if (EVP_VerifyFinal(ctx, sig->sig, sizeof(sig->sig), evp_key) != 1) {
 		ret = openssl_err("Could not verify signature");
 		goto err_ctx;
 	}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-03 11:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-17  9:20 [U-Boot] [PATCH] kwbimage: fixing the issue with proper return code checking Young Xiao
2019-04-17 10:53 Young Xiao
2019-05-03 11:46 ` Stefan Roese

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.