Updatde from stable branch.
authorDr. Stephen Henson <steve@openssl.org>
Wed, 7 Jan 2009 23:44:27 +0000 (23:44 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 7 Jan 2009 23:44:27 +0000 (23:44 +0000)
CHANGES
apps/speed.c
apps/spkac.c
apps/verify.c
apps/x509.c
crypto/camellia/.cvsignore
ssl/s2_clnt.c
ssl/s2_srvr.c
ssl/s3_clnt.c
ssl/s3_srvr.c
ssl/ssltest.c

diff --git a/CHANGES b/CHANGES
index 213927b375aabe768cec9d8e2242a36e4fa2f04f..dce8985ad8c6630b78a061d972e6a2d1d85ffeae 100644 (file)
--- a/CHANGES
+++ b/CHANGES
   *) Change 'Configure' script to enable Camellia by default.
      [NTT]
 
- Changes between 0.9.8i and 0.9.8j  [xx XXX xxxx]
+ Changes between 0.9.8i and 0.9.8j  [07 Jan 2009]
+
+  *) Properly check EVP_VerifyFinal() and similar return values
+     (CVE-2008-5077).
+     [Ben Laurie, Bodo Moeller, Google Security Team]
 
   *) Allow the CHIL engine to be loaded, whether the application is
      multithreaded or not. (This does not release the developer from the
index 209c0e64640ce4cbe17e9f5d4e13e9e64765031d..1bd2ce264c213618f5384b0c996d10cec2ff0d1e 100644 (file)
@@ -1994,7 +1994,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");
index ae2d88694f5257805513acb29cc8cb456b040c25..0e01ea9947dae0c3ce0bcf69c4ec70fc365909c1 100644 (file)
@@ -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);
index 9ff32cb06832162f6ea32e1055c8941a7a4c534c..20cc9e354cd3c1934d4c4036c1ad68f8fc4e453f 100644 (file)
@@ -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);
        }
-
index e08fdac8b935c64f71e1b9e95e0a2dce80894dd9..f1b1c6f7b6a14a6a7f6332de107d61e4551c71e9 100644 (file)
@@ -1130,7 +1130,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))
index c6d03a9dbc6b8f0c2044d3f751abc8410a06fea0..b7f68a85351312d7b12140e9f122284085021983 100644 (file)
@@ -1,2 +1,3 @@
 lib
 Makefile.save
+cmll-*.s
index e976ba82e9f87a44d9ddc02d6f3148a09741b576..00ac158f9bbcf7075ff06246b753037e3ac23276 100644 (file)
@@ -1046,7 +1046,7 @@ int ssl2_set_certificate(SSL *s, int type, int len, const unsigned char *data)
 
        i=ssl_verify_cert_chain(s,sk);
                
-       if ((s->verify_mode != SSL_VERIFY_NONE) && (!i))
+       if ((s->verify_mode != SSL_VERIFY_NONE) && (i <= 0))
                {
                SSLerr(SSL_F_SSL2_SET_CERTIFICATE,SSL_R_CERTIFICATE_VERIFY_FAILED);
                goto err;
index b43a046aa6cdca3bf3f9bb1e764d033efed41e05..c3b4e1d1c7557aa98aa5bbe1532ef84844c678d3 100644 (file)
@@ -1054,7 +1054,7 @@ static int request_certificate(SSL *s)
 
        i=ssl_verify_cert_chain(s,sk);
 
-       if (i)  /* we like the packet, now check the chksum */
+       if (i > 0)      /* we like the packet, now check the chksum */
                {
                EVP_MD_CTX ctx;
                EVP_PKEY *pkey=NULL;
@@ -1083,7 +1083,7 @@ static int request_certificate(SSL *s)
                EVP_PKEY_free(pkey);
                EVP_MD_CTX_cleanup(&ctx);
 
-               if (i
+               if (i > 0)
                        {
                        if (s->session->peer != NULL)
                                X509_free(s->session->peer);
index af97a7e1382a0fb7226278fcf6b4a1b27f8e33d0..5d8908657137512f5056bd99e9f4acae48402736 100644 (file)
@@ -1018,7 +1018,7 @@ int ssl3_get_server_certificate(SSL *s)
                }
 
        i=ssl_verify_cert_chain(s,sk);
-       if ((s->verify_mode != SSL_VERIFY_NONE) && (!i)
+       if ((s->verify_mode != SSL_VERIFY_NONE) && (i <= 0)
 #ifndef OPENSSL_NO_KRB5
            && !((s->s3->tmp.new_cipher->algorithm_mkey & SSL_kKRB5) &&
                 (s->s3->tmp.new_cipher->algorithm_auth & SSL_aKRB5))
@@ -1554,7 +1554,7 @@ int ssl3_get_key_exchange(SSL *s)
                        EVP_VerifyUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE);
                        EVP_VerifyUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE);
                        EVP_VerifyUpdate(&md_ctx,param,param_len);
-                       if (!EVP_VerifyFinal(&md_ctx,p,(int)n,pkey))
+                       if (EVP_VerifyFinal(&md_ctx,p,(int)n,pkey) <= 0)
                                {
                                /* bad signature */
                                al=SSL_AD_DECRYPT_ERROR;
@@ -1572,7 +1572,7 @@ int ssl3_get_key_exchange(SSL *s)
                        EVP_VerifyUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE);
                        EVP_VerifyUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE);
                        EVP_VerifyUpdate(&md_ctx,param,param_len);
-                       if (!EVP_VerifyFinal(&md_ctx,p,(int)n,pkey))
+                       if (EVP_VerifyFinal(&md_ctx,p,(int)n,pkey) <= 0)
                                {
                                /* bad signature */
                                al=SSL_AD_DECRYPT_ERROR;
index eaaadde3ad82e4781a1256989db9130186c40481..44a67f86d54ff649441297ed8c8ecca3791f291a 100644 (file)
@@ -2844,7 +2844,7 @@ int ssl3_get_client_certificate(SSL *s)
        else
                {
                i=ssl_verify_cert_chain(s,sk);
-               if (!i)
+               if (i <= 0)
                        {
                        al=ssl_verify_alarm_type(s->verify_result);
                        SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE,SSL_R_NO_CERTIFICATE_RETURNED);
index c76f6677b448c70948231f43d06f59f96ca3237f..9ef43dfa88fb48561200dbbf4d20003ec535f59d 100644 (file)
@@ -2177,7 +2177,7 @@ static int MS_CALLBACK app_verify_callback(X509_STORE_CTX *ctx, void *arg)
 
        if (cb_arg->proxy_auth)
                {
-               if (ok)
+               if (ok > 0)
                        {
                        const char *cond_end = NULL;