summaryrefslogtreecommitdiff
path: root/sys/lib/libkern
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2013-06-24 04:21:19 +0000
committerriastradh <riastradh@NetBSD.org>2013-06-24 04:21:19 +0000
commitadfdcceb8aad478bc3c5692fb3aff045c0c8ef37 (patch)
treeee62fd1d002750ee339715e953885019cf401475 /sys/lib/libkern
parent8fcb059d64019ef3a03b90cb11f6c6d47aeeb6b9 (diff)
Replace consttime_bcmp/explicit_bzero by consttime_memequal/explicit_memset.
consttime_memequal is the same as the old consttime_bcmp. explicit_memset is to memset as explicit_bzero was to bcmp. Passes amd64 release and i386/ALL, but I'm sure I missed some spots, so please let me know.
Diffstat (limited to 'sys/lib/libkern')
-rw-r--r--sys/lib/libkern/Makefile.libkern4
-rw-r--r--sys/lib/libkern/arc4random.c6
-rw-r--r--sys/lib/libkern/libkern.h6
3 files changed, 8 insertions, 8 deletions
diff --git a/sys/lib/libkern/Makefile.libkern b/sys/lib/libkern/Makefile.libkern
index 675331f8057..3d355a6ad22 100644
--- a/sys/lib/libkern/Makefile.libkern
+++ b/sys/lib/libkern/Makefile.libkern
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.libkern,v 1.23 2013/03/17 00:47:13 christos Exp $
+# $NetBSD: Makefile.libkern,v 1.24 2013/06/24 04:21:20 riastradh Exp $
#
# Variable definitions for libkern.
@@ -96,7 +96,7 @@ SRCS+= xlat_mbr_fstype.c
SRCS+= heapsort.c ptree.c rb.c
# for crypto
-SRCS+= explicit_bzero.c consttime_bcmp.c
+SRCS+= explicit_memset.c consttime_memequal.c
# Files to clean up
CLEANFILES+= lib${LIB}.o lib${LIB}.po
diff --git a/sys/lib/libkern/arc4random.c b/sys/lib/libkern/arc4random.c
index 2b7eb85f609..fc820d00b8f 100644
--- a/sys/lib/libkern/arc4random.c
+++ b/sys/lib/libkern/arc4random.c
@@ -1,4 +1,4 @@
-/* $NetBSD: arc4random.c,v 1.34 2013/06/23 02:38:22 riastradh Exp $ */
+/* $NetBSD: arc4random.c,v 1.35 2013/06/24 04:21:20 riastradh Exp $ */
/*-
* Copyright (c) 2002, 2011 The NetBSD Foundation, Inc.
@@ -145,7 +145,7 @@ arc4_randrekey(void)
const bool full_entropy = rndsink_request(arc4_rndsink, seed,
sizeof(seed));
arc4_randrekey_from(seed, full_entropy);
- explicit_bzero(seed, sizeof(seed));
+ explicit_memset(seed, 0, sizeof(seed));
}
/*
@@ -171,7 +171,7 @@ arc4_randrekey_from(const uint8_t seed[ARC4_KEYBYTES], bool full_entropy)
}
arc4_i = arc4_j;
- explicit_bzero(key, sizeof(key));
+ explicit_memset(key, 0, sizeof(key));
/*
* Throw away the first N words of output, as suggested in the
diff --git a/sys/lib/libkern/libkern.h b/sys/lib/libkern/libkern.h
index 63312119e08..767ced5199a 100644
--- a/sys/lib/libkern/libkern.h
+++ b/sys/lib/libkern/libkern.h
@@ -1,4 +1,4 @@
-/* $NetBSD: libkern.h,v 1.106 2012/08/30 12:16:49 drochner Exp $ */
+/* $NetBSD: libkern.h,v 1.107 2013/06/24 04:21:20 riastradh Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -346,6 +346,6 @@ unsigned int popcountll(unsigned long long) __constfunc;
unsigned int popcount32(uint32_t) __constfunc;
unsigned int popcount64(uint64_t) __constfunc;
-void explicit_bzero(void *, size_t);
-int consttime_bcmp(const void *, const void *, size_t);
+void explicit_memset(void *, int, size_t);
+int consttime_memequal(const void *, const void *, size_t);
#endif /* !_LIB_LIBKERN_LIBKERN_H_ */