summaryrefslogtreecommitdiff
path: root/src/lib/libssl/d1_clnt.c
diff options
context:
space:
mode:
authormiod <>2014-08-07 19:46:31 +0000
committermiod <>2014-08-07 19:46:31 +0000
commit15e8f255e119bc9bcc3d331677007d5263431e63 (patch)
treef63319cf5456a29e9fa85ebbd2f5e44de3fb4043 /src/lib/libssl/d1_clnt.c
parent4bcdac8281676ec72b23bb5dbfa6716fc392dfc1 (diff)
downloadopenbsd-15e8f255e119bc9bcc3d331677007d5263431e63.tar.gz
openbsd-15e8f255e119bc9bcc3d331677007d5263431e63.tar.bz2
openbsd-15e8f255e119bc9bcc3d331677007d5263431e63.zip
When you expect a function to return a particular value, don't put a comment
saying that you expect it to return that value and compare it against zero because it is supposedly faster, for this leads to bugs (especially given the high rate of sloppy cut'n'paste within ssl3 and dtls1 routines in this library). Instead, compare for the exact value it ought to return upon success. ok deraadt@
Diffstat (limited to 'src/lib/libssl/d1_clnt.c')
-rw-r--r--src/lib/libssl/d1_clnt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libssl/d1_clnt.c b/src/lib/libssl/d1_clnt.c
index 552667f6c1..165f9441f6 100644
--- a/src/lib/libssl/d1_clnt.c
+++ b/src/lib/libssl/d1_clnt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_clnt.c,v 1.31 2014/07/12 22:33:39 jsing Exp $ */ 1/* $OpenBSD: d1_clnt.c,v 1.32 2014/08/07 19:46:31 miod Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -778,8 +778,9 @@ dtls1_client_hello(SSL *s)
778 778
779 /* if client_random is initialized, reuse it, we are 779 /* if client_random is initialized, reuse it, we are
780 * required to use same upon reply to HelloVerify */ 780 * required to use same upon reply to HelloVerify */
781 for (i = 0; p[i]=='\0' && i < sizeof(s->s3->client_random); i++) 781 for (i = 0; i < sizeof(s->s3->client_random); i++)
782 ; 782 if (p[i] != '\0')
783 break;
783 if (i == sizeof(s->s3->client_random)) 784 if (i == sizeof(s->s3->client_random))
784 RAND_pseudo_bytes(p, sizeof(s->s3->client_random)); 785 RAND_pseudo_bytes(p, sizeof(s->s3->client_random));
785 786
@@ -1338,7 +1339,6 @@ dtls1_send_client_certificate(SSL *s)
1338 /* If we get an error, we need to 1339 /* If we get an error, we need to
1339 * ssl->rwstate=SSL_X509_LOOKUP; return(-1); 1340 * ssl->rwstate=SSL_X509_LOOKUP; return(-1);
1340 * We then get retied later */ 1341 * We then get retied later */
1341 i = 0;
1342 i = ssl_do_client_cert_cb(s, &x509, &pkey); 1342 i = ssl_do_client_cert_cb(s, &x509, &pkey);
1343 if (i < 0) { 1343 if (i < 0) {
1344 s->rwstate = SSL_X509_LOOKUP; 1344 s->rwstate = SSL_X509_LOOKUP;