From f0d4f91f1453b0e125ed1191c81157551c9c97e1 Mon Sep 17 00:00:00 2001 From: tedu <> Date: Sat, 21 Jun 2014 20:22:15 +0000 Subject: [PATCH] loosen the spec for timingsafe functions slightly, so as to not artificially constrain alternative implementations. ok deraadt --- src/lib/libc/string/timingsafe_bcmp.3 | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/lib/libc/string/timingsafe_bcmp.3 b/src/lib/libc/string/timingsafe_bcmp.3 index 0886731c..00da7691 100644 --- a/src/lib/libc/string/timingsafe_bcmp.3 +++ b/src/lib/libc/string/timingsafe_bcmp.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: timingsafe_bcmp.3,v 1.1 2014/06/13 02:12:17 matthew Exp $ +.\" $OpenBSD: timingsafe_bcmp.3,v 1.2 2014/06/21 20:22:15 tedu Exp $ .\" .\" Copyright (c) 2014 Google Inc. .\" @@ -13,7 +13,7 @@ .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.Dd $Mdocdate: June 13 2014 $ +.Dd $Mdocdate: June 21 2014 $ .Dt TIMINGSAFE_BCMP 3 .Os .Sh NAME @@ -50,7 +50,7 @@ may short-circuit after finding the first differing byte. .Sh RETURN VALUES The .Fn timingsafe_bcmp -function returns 0 or 1 if the byte sequence pointed to by +function returns 0 or not zero if the byte sequence pointed to by .Fa b1 compares equal to or not equal to (respectively) the byte sequence pointed to by @@ -58,17 +58,12 @@ the byte sequence pointed to by .Pp The .Fn timingsafe_memcmp -function returns \-1, 0, or 1 if the byte sequence pointed to by +function returns a negative value, 0, or positive value if the byte sequence +pointed to by .Fa b1 compares less than, equal to, or greater than (respectively) the byte sequence pointed to by .Fa b2 . -.Pp -Note that these return values are compatible with, but stricter than, -the ones specified for -.Xr bcmp 3 -and -.Xr memcmp 3 . .Sh SEE ALSO .Xr bcmp 3 , .Xr memcmp 3