summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bind/lib/isc/unix/file.c
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2020-01-09 14:24:07 +0000
committerflorian <florian@openbsd.org>2020-01-09 14:24:07 +0000
commitb7f7b639524914fd0639ad24660118624c0c7ffa (patch)
tree440198a6c76836ab4d489539304d643c466b1450 /usr.sbin/bind/lib/isc/unix/file.c
parentFirst round of OPENSSL unifdef: (diff)
downloadwireguard-openbsd-b7f7b639524914fd0639ad24660118624c0c7ffa.tar.xz
wireguard-openbsd-b7f7b639524914fd0639ad24660118624c0c7ffa.zip
Replace entropy.c, random.c and an outdated arc4random copy with
calls to libc's arc4random. Minus about 3k lines. prodding deraadt@
Diffstat (limited to 'usr.sbin/bind/lib/isc/unix/file.c')
-rw-r--r--usr.sbin/bind/lib/isc/unix/file.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/usr.sbin/bind/lib/isc/unix/file.c b/usr.sbin/bind/lib/isc/unix/file.c
index ad1e4b72a08..1f7888621b5 100644
--- a/usr.sbin/bind/lib/isc/unix/file.c
+++ b/usr.sbin/bind/lib/isc/unix/file.c
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*/
-/* $Id: file.c,v 1.8 2020/01/09 14:18:30 florian Exp $ */
+/* $Id: file.c,v 1.9 2020/01/09 14:24:08 florian Exp $ */
/*! \file */
@@ -68,7 +68,7 @@
#include <isc/file.h>
#include <isc/log.h>
#include <isc/mem.h>
-#include <isc/random.h>
+
#include <isc/string.h>
#include <isc/time.h>
#include <isc/util.h>
@@ -258,7 +258,6 @@ isc_result_t
isc_file_renameunique(const char *file, char *templet) {
char *x;
char *cp;
- isc_uint32_t which;
REQUIRE(file != NULL);
REQUIRE(templet != NULL);
@@ -271,8 +270,7 @@ isc_file_renameunique(const char *file, char *templet) {
x = cp--;
while (cp >= templet && *cp == 'X') {
- isc_random_get(&which);
- *cp = alphnum[which % (sizeof(alphnum) - 1)];
+ *cp = alphnum[arc4random_uniform(sizeof(alphnum) - 1)];
x = cp--;
}
while (link(file, templet) == -1) {
@@ -316,7 +314,6 @@ isc_file_openuniquemode(char *templet, int mode, FILE **fp) {
isc_result_t result = ISC_R_SUCCESS;
char *x;
char *cp;
- isc_uint32_t which;
REQUIRE(templet != NULL);
REQUIRE(fp != NULL && *fp == NULL);
@@ -329,8 +326,7 @@ isc_file_openuniquemode(char *templet, int mode, FILE **fp) {
x = cp--;
while (cp >= templet && *cp == 'X') {
- isc_random_get(&which);
- *cp = alphnum[which % (sizeof(alphnum) - 1)];
+ *cp = alphnum[arc4random_uniform(sizeof(alphnum) - 1)];
x = cp--;
}