1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

adventure requires deterministic random for its internal data

"obfuscation" scheme to work (words fail me), but we can use arc4random
for the in game fun. from theo buehler
This commit is contained in:
tedu 2014-12-31 15:45:57 +00:00
parent d71bc48f60
commit 1cc65eec88
3 changed files with 11 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: init.c,v 1.12 2014/12/08 21:56:27 deraadt Exp $ */
/* $OpenBSD: init.c,v 1.13 2014/12/31 15:45:57 tedu Exp $ */
/* $NetBSD: init.c,v 1.4 1996/05/21 21:53:05 mrg Exp $ */
/*-
@ -56,6 +56,11 @@ int setbit[16] = {1, 2, 4, 010, 020, 040, 0100, 0200, 0400, 01000, 02000,
void
init(void) /* everything for 1st time run */
{
/*
* We need deterministic randomness for the obfuscation schemes
* in io.c and setup.c.
*/
srandom_deterministic(1);
rdata(); /* read data from orig. file */
linkdata();
poof();

View File

@ -1,4 +1,4 @@
/* $OpenBSD: setup.c,v 1.11 2014/12/08 21:56:27 deraadt Exp $ */
/* $OpenBSD: setup.c,v 1.12 2014/12/31 15:45:57 tedu Exp $ */
/* $NetBSD: setup.c,v 1.2 1995/03/21 12:05:10 cgd Exp $ */
/*-
@ -78,6 +78,8 @@ main(int argc, char *argv[])
count = 0;
linestart = YES;
srandom_deterministic(1);
while ((c = getc(infile)) != EOF) {
if (count++ % LINE == 0)
printf("\n\t");

View File

@ -1,4 +1,4 @@
/* $OpenBSD: wizard.c,v 1.16 2014/11/16 04:49:48 guenther Exp $ */
/* $OpenBSD: wizard.c,v 1.17 2014/12/31 15:45:57 tedu Exp $ */
/* $NetBSD: wizard.c,v 1.3 1995/04/24 12:21:41 cgd Exp $ */
/*-
@ -141,8 +141,5 @@ ciao(void)
int
ran(int range)
{
long i;
i = random() % range;
return (i);
return (arc4random_uniform(range));
}