summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm <>2009-01-09 11:40:35 +0000
committerdjm <>2009-01-09 11:40:35 +0000
commitae00a4a174a8ab1c1732f844465acd4f98eb72e2 (patch)
tree7963b369b51d15aff49766905584b5d706c1569e
parentf42db7740c732d06f8be3b7322b15456d47e5313 (diff)
downloadopenbsd-ae00a4a174a8ab1c1732f844465acd4f98eb72e2.tar.gz
openbsd-ae00a4a174a8ab1c1732f844465acd4f98eb72e2.tar.bz2
openbsd-ae00a4a174a8ab1c1732f844465acd4f98eb72e2.zip
Fix CVE-2008-5077: Incorrect checks for malformed signatures
-rw-r--r--src/lib/libssl/src/apps/speed.c2
-rw-r--r--src/lib/libssl/src/apps/spkac.c2
-rw-r--r--src/lib/libssl/src/apps/verify.c3
-rw-r--r--src/lib/libssl/src/apps/x509.c2
-rw-r--r--src/lib/libssl/src/ssl/s2_clnt.c2
-rw-r--r--src/lib/libssl/src/ssl/s2_srvr.c4
-rw-r--r--src/lib/libssl/src/ssl/s3_clnt.c4
-rw-r--r--src/lib/libssl/src/ssl/s3_srvr.c2
-rw-r--r--src/lib/libssl/src/ssl/ssltest.c2
9 files changed, 11 insertions, 12 deletions
diff --git a/src/lib/libssl/src/apps/speed.c b/src/lib/libssl/src/apps/speed.c
index 2fc327c375..643a76870c 100644
--- a/src/lib/libssl/src/apps/speed.c
+++ b/src/lib/libssl/src/apps/speed.c
@@ -1486,7 +1486,7 @@ int MAIN(int argc, char **argv)
1486 { 1486 {
1487 ret=RSA_verify(NID_md5_sha1, buf,36, buf2, 1487 ret=RSA_verify(NID_md5_sha1, buf,36, buf2,
1488 rsa_num, rsa_key[j]); 1488 rsa_num, rsa_key[j]);
1489 if (ret == 0) 1489 if (ret <= 0)
1490 { 1490 {
1491 BIO_printf(bio_err, 1491 BIO_printf(bio_err,
1492 "RSA verify failure\n"); 1492 "RSA verify failure\n");
diff --git a/src/lib/libssl/src/apps/spkac.c b/src/lib/libssl/src/apps/spkac.c
index 47ee53f1ee..4fb539537c 100644
--- a/src/lib/libssl/src/apps/spkac.c
+++ b/src/lib/libssl/src/apps/spkac.c
@@ -284,7 +284,7 @@ bad:
284 pkey = NETSCAPE_SPKI_get_pubkey(spki); 284 pkey = NETSCAPE_SPKI_get_pubkey(spki);
285 if(verify) { 285 if(verify) {
286 i = NETSCAPE_SPKI_verify(spki, pkey); 286 i = NETSCAPE_SPKI_verify(spki, pkey);
287 if(i) BIO_printf(bio_err, "Signature OK\n"); 287 if (i > 0) BIO_printf(bio_err, "Signature OK\n");
288 else { 288 else {
289 BIO_printf(bio_err, "Signature Failure\n"); 289 BIO_printf(bio_err, "Signature Failure\n");
290 ERR_print_errors(bio_err); 290 ERR_print_errors(bio_err);
diff --git a/src/lib/libssl/src/apps/verify.c b/src/lib/libssl/src/apps/verify.c
index d73280cdd0..dabbf6fc89 100644
--- a/src/lib/libssl/src/apps/verify.c
+++ b/src/lib/libssl/src/apps/verify.c
@@ -275,7 +275,7 @@ static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X
275 275
276 ret=0; 276 ret=0;
277end: 277end:
278 if (i) 278 if (i > 0)
279 { 279 {
280 fprintf(stdout,"OK\n"); 280 fprintf(stdout,"OK\n");
281 ret=1; 281 ret=1;
@@ -366,4 +366,3 @@ static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx)
366 ERR_clear_error(); 366 ERR_clear_error();
367 return(ok); 367 return(ok);
368 } 368 }
369
diff --git a/src/lib/libssl/src/apps/x509.c b/src/lib/libssl/src/apps/x509.c
index e7115cac67..b83d8a13a3 100644
--- a/src/lib/libssl/src/apps/x509.c
+++ b/src/lib/libssl/src/apps/x509.c
@@ -1123,7 +1123,7 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
1123 /* NOTE: this certificate can/should be self signed, unless it was 1123 /* NOTE: this certificate can/should be self signed, unless it was
1124 * a certificate request in which case it is not. */ 1124 * a certificate request in which case it is not. */
1125 X509_STORE_CTX_set_cert(&xsc,x); 1125 X509_STORE_CTX_set_cert(&xsc,x);
1126 if (!reqfile && !X509_verify_cert(&xsc)) 1126 if (!reqfile && X509_verify_cert(&xsc) <= 0)
1127 goto end; 1127 goto end;
1128 1128
1129 if (!X509_check_private_key(xca,pkey)) 1129 if (!X509_check_private_key(xca,pkey))
diff --git a/src/lib/libssl/src/ssl/s2_clnt.c b/src/lib/libssl/src/ssl/s2_clnt.c
index 003809271b..72ff070495 100644
--- a/src/lib/libssl/src/ssl/s2_clnt.c
+++ b/src/lib/libssl/src/ssl/s2_clnt.c
@@ -1062,7 +1062,7 @@ int ssl2_set_certificate(SSL *s, int type, int len, unsigned char *data)
1062 1062
1063 i=ssl_verify_cert_chain(s,sk); 1063 i=ssl_verify_cert_chain(s,sk);
1064 1064
1065 if ((s->verify_mode != SSL_VERIFY_NONE) && (!i)) 1065 if ((s->verify_mode != SSL_VERIFY_NONE) && (i <= 0))
1066 { 1066 {
1067 SSLerr(SSL_F_SSL2_SET_CERTIFICATE,SSL_R_CERTIFICATE_VERIFY_FAILED); 1067 SSLerr(SSL_F_SSL2_SET_CERTIFICATE,SSL_R_CERTIFICATE_VERIFY_FAILED);
1068 goto err; 1068 goto err;
diff --git a/src/lib/libssl/src/ssl/s2_srvr.c b/src/lib/libssl/src/ssl/s2_srvr.c
index 7a4992b7aa..a978aaea4b 100644
--- a/src/lib/libssl/src/ssl/s2_srvr.c
+++ b/src/lib/libssl/src/ssl/s2_srvr.c
@@ -1070,7 +1070,7 @@ static int request_certificate(SSL *s)
1070 1070
1071 i=ssl_verify_cert_chain(s,sk); 1071 i=ssl_verify_cert_chain(s,sk);
1072 1072
1073 if (i) /* we like the packet, now check the chksum */ 1073 if (i > 0) /* we like the packet, now check the chksum */
1074 { 1074 {
1075 EVP_MD_CTX ctx; 1075 EVP_MD_CTX ctx;
1076 EVP_PKEY *pkey=NULL; 1076 EVP_PKEY *pkey=NULL;
@@ -1099,7 +1099,7 @@ static int request_certificate(SSL *s)
1099 EVP_PKEY_free(pkey); 1099 EVP_PKEY_free(pkey);
1100 EVP_MD_CTX_cleanup(&ctx); 1100 EVP_MD_CTX_cleanup(&ctx);
1101 1101
1102 if (i) 1102 if (i > 0)
1103 { 1103 {
1104 if (s->session->peer != NULL) 1104 if (s->session->peer != NULL)
1105 X509_free(s->session->peer); 1105 X509_free(s->session->peer);
diff --git a/src/lib/libssl/src/ssl/s3_clnt.c b/src/lib/libssl/src/ssl/s3_clnt.c
index 4163d97944..ec4b44979a 100644
--- a/src/lib/libssl/src/ssl/s3_clnt.c
+++ b/src/lib/libssl/src/ssl/s3_clnt.c
@@ -833,7 +833,7 @@ static int ssl3_get_server_certificate(SSL *s)
833 } 833 }
834 834
835 i=ssl_verify_cert_chain(s,sk); 835 i=ssl_verify_cert_chain(s,sk);
836 if ((s->verify_mode != SSL_VERIFY_NONE) && (!i) 836 if ((s->verify_mode != SSL_VERIFY_NONE) && (i <= 0)
837#ifndef OPENSSL_NO_KRB5 837#ifndef OPENSSL_NO_KRB5
838 && (s->s3->tmp.new_cipher->algorithms & (SSL_MKEY_MASK|SSL_AUTH_MASK)) 838 && (s->s3->tmp.new_cipher->algorithms & (SSL_MKEY_MASK|SSL_AUTH_MASK))
839 != (SSL_aKRB5|SSL_kKRB5) 839 != (SSL_aKRB5|SSL_kKRB5)
@@ -1200,7 +1200,7 @@ static int ssl3_get_key_exchange(SSL *s)
1200 EVP_VerifyUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE); 1200 EVP_VerifyUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE);
1201 EVP_VerifyUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE); 1201 EVP_VerifyUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE);
1202 EVP_VerifyUpdate(&md_ctx,param,param_len); 1202 EVP_VerifyUpdate(&md_ctx,param,param_len);
1203 if (!EVP_VerifyFinal(&md_ctx,p,(int)n,pkey)) 1203 if (EVP_VerifyFinal(&md_ctx,p,(int)n,pkey) <= 0)
1204 { 1204 {
1205 /* bad signature */ 1205 /* bad signature */
1206 al=SSL_AD_DECRYPT_ERROR; 1206 al=SSL_AD_DECRYPT_ERROR;
diff --git a/src/lib/libssl/src/ssl/s3_srvr.c b/src/lib/libssl/src/ssl/s3_srvr.c
index 36fc39d7f8..37fe43d397 100644
--- a/src/lib/libssl/src/ssl/s3_srvr.c
+++ b/src/lib/libssl/src/ssl/s3_srvr.c
@@ -2009,7 +2009,7 @@ static int ssl3_get_client_certificate(SSL *s)
2009 else 2009 else
2010 { 2010 {
2011 i=ssl_verify_cert_chain(s,sk); 2011 i=ssl_verify_cert_chain(s,sk);
2012 if (!i) 2012 if (i <= 0)
2013 { 2013 {
2014 al=ssl_verify_alarm_type(s->verify_result); 2014 al=ssl_verify_alarm_type(s->verify_result);
2015 SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE,SSL_R_NO_CERTIFICATE_RETURNED); 2015 SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE,SSL_R_NO_CERTIFICATE_RETURNED);
diff --git a/src/lib/libssl/src/ssl/ssltest.c b/src/lib/libssl/src/ssl/ssltest.c
index 9381c435d5..0edd0d2025 100644
--- a/src/lib/libssl/src/ssl/ssltest.c
+++ b/src/lib/libssl/src/ssl/ssltest.c
@@ -1984,7 +1984,7 @@ static int MS_CALLBACK app_verify_callback(X509_STORE_CTX *ctx, void *arg)
1984 1984
1985 if (cb_arg->proxy_auth) 1985 if (cb_arg->proxy_auth)
1986 { 1986 {
1987 if (ok) 1987 if (ok > 0)
1988 { 1988 {
1989 const char *cond_end = NULL; 1989 const char *cond_end = NULL;
1990 1990