summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src/ssl/d1_pkt.c
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2014-08-07 19:46:31 +0000
committermiod <miod@openbsd.org>2014-08-07 19:46:31 +0000
commitffb772b401a7e4d8ff166372a160eb0da562824c (patch)
tree4204be25125390a03429c66abc90c5b245fee015 /lib/libssl/src/ssl/d1_pkt.c
parentBump example pubkey filenames to /etc/signify/openbsd-56-base.pub for (diff)
downloadwireguard-openbsd-ffb772b401a7e4d8ff166372a160eb0da562824c.tar.xz
wireguard-openbsd-ffb772b401a7e4d8ff166372a160eb0da562824c.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 'lib/libssl/src/ssl/d1_pkt.c')
-rw-r--r--lib/libssl/src/ssl/d1_pkt.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libssl/src/ssl/d1_pkt.c b/lib/libssl/src/ssl/d1_pkt.c
index c9ffab1f3c2..5be89f0955b 100644
--- a/lib/libssl/src/ssl/d1_pkt.c
+++ b/lib/libssl/src/ssl/d1_pkt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: d1_pkt.c,v 1.32 2014/07/10 08:51:14 tedu Exp $ */
+/* $OpenBSD: d1_pkt.c,v 1.33 2014/08/07 19:46:31 miod Exp $ */
/*
* DTLS implementation written by Nagendra Modadugu
* (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -414,10 +414,12 @@ dtls1_process_record(SSL *s)
}
i = s->method->ssl3_enc->mac(s, md, 0 /* not send */);
- if (i < 0 || mac == NULL || timingsafe_memcmp(md, mac, (size_t)mac_size) != 0)
+ if (i < 0 || mac == NULL ||
+ timingsafe_memcmp(md, mac, (size_t)mac_size) != 0)
enc_err = -1;
if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH + mac_size)
enc_err = -1;
+ OPENSSL_cleanse(&md, sizeof md);
}
if (enc_err < 0) {