use arc4random_uniform(); from Tim van der Molen <tbvdm@xs4all.nl>

This commit is contained in:
robert 2008-04-22 09:15:08 +00:00
parent 4b569347fd
commit 78f43cd6a2
3 changed files with 8 additions and 7 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.6 2007/12/04 10:28:29 sthen Exp $
# $OpenBSD: Makefile,v 1.7 2008/04/22 09:15:08 robert Exp $
COMMENT= simple password generator
DISTNAME= pwgen-2.06
PKGNAME= ${DISTNAME}p0
CATEGORIES= security
MAINTAINER= Robert Nagy <robert@openbsd.org>

View File

@ -1,11 +1,11 @@
$OpenBSD: patch-configure_in,v 1.2 2007/12/04 10:28:29 sthen Exp $
$OpenBSD: patch-configure_in,v 1.3 2008/04/22 09:15:08 robert Exp $
--- configure.in.orig Thu Jul 5 01:42:19 2007
+++ configure.in Mon Dec 3 09:15:48 2007
+++ configure.in Tue Apr 22 11:13:08 2008
@@ -6,6 +6,6 @@ AC_PATH_PROG(MV, mv, mv)
AC_PATH_PROG(RM, rm, rm)
AC_PATH_PROG(SED, sed, sed)
AC_PATH_PROG(PERL, perl, perl)
-AC_CHECK_FUNCS(drand48 getopt_long)
+AC_CHECK_FUNCS(arc4random drand48 getopt_long)
+AC_CHECK_FUNCS(arc4random arc4random_uniform drand48 getopt_long)
AC_CHECK_HEADERS(getopt.h)
AC_OUTPUT(Makefile)

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-randnum_c,v 1.2 2007/12/04 10:28:29 sthen Exp $
$OpenBSD: patch-randnum_c,v 1.3 2008/04/22 09:15:08 robert Exp $
--- randnum.c.orig Thu Jul 5 01:42:19 2007
+++ randnum.c Mon Dec 3 09:15:48 2007
+++ randnum.c Tue Apr 22 11:12:27 2008
@@ -17,6 +17,15 @@
#include "pwgen.h"
@ -9,7 +9,7 @@ $OpenBSD: patch-randnum_c,v 1.2 2007/12/04 10:28:29 sthen Exp $
+
+int pw_random_number(int max_num)
+{
+ return (arc4random() % max_num);
+ return (arc4random_uniform(max_num));
+}
+
+#else