diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2009-01-07 10:48:23 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2009-01-07 10:48:23 +0000 |
commit | a00c3c4019a4bc0fa938b7dd3c0cd8e95cdc6943 (patch) | |
tree | 97dc675154f89679d944819529935c988924a301 /apps | |
parent | f4677b79609a17b125c46a8bc9899be94ac65919 (diff) |
Properly check EVP_VerifyFinal() and similar return values
(CVE-2008-5077).
Submitted by: Ben Laurie, Bodo Moeller, Google Security Team
Diffstat (limited to 'apps')
-rw-r--r-- | apps/speed.c | 2 | ||||
-rw-r--r-- | apps/spkac.c | 2 | ||||
-rw-r--r-- | apps/verify.c | 3 | ||||
-rw-r--r-- | apps/x509.c | 2 |
4 files changed, 4 insertions, 5 deletions
diff --git a/apps/speed.c b/apps/speed.c index e6b187d840..af077b54a8 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -2132,7 +2132,7 @@ int MAIN(int argc, char **argv) { ret=RSA_verify(NID_md5_sha1, buf,36, buf2, rsa_num, rsa_key[j]); - if (ret == 0) + if (ret <= 0) { BIO_printf(bio_err, "RSA verify failure\n"); diff --git a/apps/spkac.c b/apps/spkac.c index ae2d88694f..0e01ea9947 100644 --- a/apps/spkac.c +++ b/apps/spkac.c @@ -285,7 +285,7 @@ bad: pkey = NETSCAPE_SPKI_get_pubkey(spki); if(verify) { i = NETSCAPE_SPKI_verify(spki, pkey); - if(i) BIO_printf(bio_err, "Signature OK\n"); + if (i > 0) BIO_printf(bio_err, "Signature OK\n"); else { BIO_printf(bio_err, "Signature Failure\n"); ERR_print_errors(bio_err); diff --git a/apps/verify.c b/apps/verify.c index 9ff32cb068..20cc9e354c 100644 --- a/apps/verify.c +++ b/apps/verify.c @@ -266,7 +266,7 @@ static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X ret=0; end: - if (i) + if (i > 0) { fprintf(stdout,"OK\n"); ret=1; @@ -367,4 +367,3 @@ static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx) ERR_clear_error(); return(ok); } - diff --git a/apps/x509.c b/apps/x509.c index f6938356f8..d904d34021 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -1151,7 +1151,7 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest, /* NOTE: this certificate can/should be self signed, unless it was * a certificate request in which case it is not. */ X509_STORE_CTX_set_cert(&xsc,x); - if (!reqfile && !X509_verify_cert(&xsc)) + if (!reqfile && X509_verify_cert(&xsc) <= 0) goto end; if (!X509_check_private_key(xca,pkey)) |