summaryrefslogtreecommitdiff
path: root/src/lib/libssl/d1_both.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_both.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_both.c')
-rw-r--r--src/lib/libssl/d1_both.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/libssl/d1_both.c b/src/lib/libssl/d1_both.c
index e25f69dbb6..2391d52994 100644
--- a/src/lib/libssl/d1_both.c
+++ b/src/lib/libssl/d1_both.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_both.c,v 1.24 2014/07/10 08:51:14 tedu Exp $ */ 1/* $OpenBSD: d1_both.c,v 1.25 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.
@@ -903,6 +903,7 @@ dtls1_send_finished(SSL *s, int a, int b, const char *sender, int slen)
903 903
904 i = s->method->ssl3_enc->final_finish_mac(s, sender, slen, 904 i = s->method->ssl3_enc->final_finish_mac(s, sender, slen,
905 s->s3->tmp.finish_md); 905 s->s3->tmp.finish_md);
906 OPENSSL_assert(i <= EVP_MAX_MD_SIZE);
906 s->s3->tmp.finish_md_len = i; 907 s->s3->tmp.finish_md_len = i;
907 memcpy(p, s->s3->tmp.finish_md, i); 908 memcpy(p, s->s3->tmp.finish_md, i);
908 p += i; 909 p += i;
@@ -913,12 +914,10 @@ dtls1_send_finished(SSL *s, int a, int b, const char *sender, int slen)
913 * renegotiation checks 914 * renegotiation checks
914 */ 915 */
915 if (s->type == SSL_ST_CONNECT) { 916 if (s->type == SSL_ST_CONNECT) {
916 OPENSSL_assert(i <= EVP_MAX_MD_SIZE);
917 memcpy(s->s3->previous_client_finished, 917 memcpy(s->s3->previous_client_finished,
918 s->s3->tmp.finish_md, i); 918 s->s3->tmp.finish_md, i);
919 s->s3->previous_client_finished_len = i; 919 s->s3->previous_client_finished_len = i;
920 } else { 920 } else {
921 OPENSSL_assert(i <= EVP_MAX_MD_SIZE);
922 memcpy(s->s3->previous_server_finished, 921 memcpy(s->s3->previous_server_finished,
923 s->s3->tmp.finish_md, i); 922 s->s3->tmp.finish_md, i);
924 s->s3->previous_server_finished_len = i; 923 s->s3->previous_server_finished_len = i;