Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/string Explain why there is no consttime_memcmp().



details:   https://anonhg.NetBSD.org/src/rev/997b048cfaba
branches:  trunk
changeset: 336844:997b048cfaba
user:      apb <apb%NetBSD.org@localhost>
date:      Mon Mar 23 07:41:16 2015 +0000

description:
Explain why there is no consttime_memcmp().

Inspired by a patch from Kamil Rytarowski.

diffstat:

 lib/libc/string/consttime_memequal.3 |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r b902464a5bef -r 997b048cfaba lib/libc/string/consttime_memequal.3
--- a/lib/libc/string/consttime_memequal.3      Mon Mar 23 07:40:31 2015 +0000
+++ b/lib/libc/string/consttime_memequal.3      Mon Mar 23 07:41:16 2015 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: consttime_memequal.3,v 1.4 2014/11/14 22:46:34 wiz Exp $
+.\"    $NetBSD: consttime_memequal.3,v 1.5 2015/03/23 07:41:16 apb Exp $
 .\"
 .\" Copyright (c) 2013 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 14, 2014
+.Dd March 23, 2015
 .Dt CONSTTIME_MEMEQUAL 3
 .Os
 .Sh NAME
@@ -78,6 +78,13 @@
 and
 .Fa b2 ;
 it tells only whether they are equal.
+.Nx
+does not provide a
+.Fn consttime_memcmp
+function, because all known use cases that require
+.Sq constant time
+memory comparison also require only comparison for equality,
+not lexicographic ordering.
 .Sh SEE ALSO
 .Xr explicit_memset 3 ,
 .Xr memcmp 3



Home | Main Index | Thread Index | Old Index