summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortedu <>2014-06-21 22:57:15 +0000
committertedu <>2014-06-21 22:57:15 +0000
commitab87651885f6ced49fa0570974bb617573a41a5c (patch)
tree5aaab4514d34d4b547fc7187b7030a1fc9f8d2a4
parent427e0fb1ee400598c3991feede215822741f6e82 (diff)
downloadopenbsd-ab87651885f6ced49fa0570974bb617573a41a5c.tar.gz
openbsd-ab87651885f6ced49fa0570974bb617573a41a5c.tar.bz2
openbsd-ab87651885f6ced49fa0570974bb617573a41a5c.zip
matthew reminds me to update regress to reflect current spec
-rw-r--r--src/regress/lib/libc/timingsafe/timingsafe.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/regress/lib/libc/timingsafe/timingsafe.c b/src/regress/lib/libc/timingsafe/timingsafe.c
index e7807db258..f6605f8696 100644
--- a/src/regress/lib/libc/timingsafe/timingsafe.c
+++ b/src/regress/lib/libc/timingsafe/timingsafe.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: timingsafe.c,v 1.2 2014/06/13 02:12:17 matthew Exp $ */ 1/* $OpenBSD: timingsafe.c,v 1.3 2014/06/21 22:57:15 tedu Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Google Inc. 3 * Copyright (c) 2014 Google Inc.
4 * 4 *
@@ -32,13 +32,6 @@ check()
32{ 32{
33 int cmp = memcmp(bufone, buftwo, N); 33 int cmp = memcmp(bufone, buftwo, N);
34 34
35 /*
36 * timingsafe_memcmp is specified to return -1, 0, or 1,
37 * but memcmp only specifies <0, 0, or >0.
38 */
39 if (cmp < 0) cmp = -1;
40 if (cmp > 0) cmp = 1;
41
42 /* Check for reflexivity. */ 35 /* Check for reflexivity. */
43 ASSERT_EQ(0, timingsafe_bcmp(bufone, bufone, N)); 36 ASSERT_EQ(0, timingsafe_bcmp(bufone, bufone, N));
44 ASSERT_EQ(0, timingsafe_bcmp(buftwo, buftwo, N)); 37 ASSERT_EQ(0, timingsafe_bcmp(buftwo, buftwo, N));
@@ -49,10 +42,10 @@ check()
49 ASSERT_EQ(cmp == 0, timingsafe_bcmp(bufone, buftwo, N) == 0); 42 ASSERT_EQ(cmp == 0, timingsafe_bcmp(bufone, buftwo, N) == 0);
50 43
51 /* Check that timingsafe_memcmp returns cmp... */ 44 /* Check that timingsafe_memcmp returns cmp... */
52 ASSERT_EQ(cmp, timingsafe_memcmp(bufone, buftwo, N)); 45 ASSERT_EQ(cmp < 0, timingsafe_memcmp(bufone, buftwo, N) < 0);
53 46
54 /* ... or -cmp if the argument order is swapped. */ 47 /* ... or -cmp if the argument order is swapped. */
55 ASSERT_EQ(-cmp, timingsafe_memcmp(buftwo, bufone, N)); 48 ASSERT_EQ(-cmp < 0, timingsafe_memcmp(buftwo, bufone, N) < 0);
56} 49}
57 50
58int 51int