diff options
| author | riastradh <riastradh@NetBSD.org> | 2013-08-28 15:24:41 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2013-08-28 15:24:41 +0000 |
| commit | bb1d12db8a8adebb626f9db549d429a14a964832 (patch) | |
| tree | 7985a24cf84b4efdae237d3e3124760f5a44547f /sys/netipsec | |
| parent | a454fa8ec73dcbe9f5d629a35f6eef562b14f41a (diff) | |
Fix sense of consttime_memequal and update all callers.
Now it returns true (nonzero) to mean equal and false (zero) to mean
inequal, as the name suggests.
As promised on tech-userlevel back in June:
https://mail-index.netbsd.org/tech-userlevel/2013/06/24/msg007843.html
Diffstat (limited to 'sys/netipsec')
| -rw-r--r-- | sys/netipsec/xform_ah.c | 6 | ||||
| -rw-r--r-- | sys/netipsec/xform_esp.c | 7 |
2 files changed, 6 insertions, 7 deletions
diff --git a/sys/netipsec/xform_ah.c b/sys/netipsec/xform_ah.c index 1cb22c9c31d..69fc8755616 100644 --- a/sys/netipsec/xform_ah.c +++ b/sys/netipsec/xform_ah.c @@ -1,4 +1,4 @@ -/* $NetBSD: xform_ah.c,v 1.40 2013/06/24 04:21:20 riastradh Exp $ */ +/* $NetBSD: xform_ah.c,v 1.41 2013/08/28 15:24:41 riastradh Exp $ */ /* $FreeBSD: src/sys/netipsec/xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $ */ /* $OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */ /* @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.40 2013/06/24 04:21:20 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.41 2013/08/28 15:24:41 riastradh Exp $"); #include "opt_inet.h" #ifdef __FreeBSD__ @@ -910,7 +910,7 @@ ah_input_cb(struct cryptop *crp) ptr = (char *) (tc + 1); /* Verify authenticator. */ - if (consttime_memequal(ptr + skip + rplen, calc, authsize)) { + if (!consttime_memequal(ptr + skip + rplen, calc, authsize)) { u_int8_t *pppp = ptr + skip+rplen; DPRINTF(("ah_input: authentication hash mismatch " \ "over %d bytes " \ diff --git a/sys/netipsec/xform_esp.c b/sys/netipsec/xform_esp.c index b6d97fd321c..80b9c451c85 100644 --- a/sys/netipsec/xform_esp.c +++ b/sys/netipsec/xform_esp.c @@ -1,4 +1,4 @@ -/* $NetBSD: xform_esp.c,v 1.43 2013/06/24 04:21:20 riastradh Exp $ */ +/* $NetBSD: xform_esp.c,v 1.44 2013/08/28 15:24:41 riastradh Exp $ */ /* $FreeBSD: src/sys/netipsec/xform_esp.c,v 1.2.2.1 2003/01/24 05:11:36 sam Exp $ */ /* $OpenBSD: ip_esp.c,v 1.69 2001/06/26 06:18:59 angelos Exp $ */ @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.43 2013/06/24 04:21:20 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.44 2013/08/28 15:24:41 riastradh Exp $"); #include "opt_inet.h" #ifdef __FreeBSD__ @@ -593,8 +593,7 @@ esp_input_cb(struct cryptop *crp) ptr = (tc + 1); /* Verify authenticator */ - if (consttime_memequal(ptr, aalg, esph->authsize) - != 0) { + if (!consttime_memequal(ptr, aalg, esph->authsize)) { DPRINTF(("esp_input_cb: " "authentication hash mismatch for packet in SA %s/%08lx\n", ipsec_address(&saidx->dst), |
