From 28cc8c738305152ba1636b91a1fc01ed7bcc4d40 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sun, 19 Jan 2014 12:45:37 +0000 Subject: Initialize ci_randseed better using arc4random() + a trick. Remove the libkern srandom() API since it is not suitable for this use. ok kettenis miod --- sys/arch/amd64/amd64/cpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/arch/amd64') diff --git a/sys/arch/amd64/amd64/cpu.c b/sys/arch/amd64/amd64/cpu.c index ee1a97f2cd9..2039f0c12f6 100644 --- a/sys/arch/amd64/amd64/cpu.c +++ b/sys/arch/amd64/amd64/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.58 2013/12/19 21:30:02 deraadt Exp $ */ +/* $OpenBSD: cpu.c,v 1.59 2014/01/19 12:45:35 deraadt Exp $ */ /* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */ /*- @@ -73,6 +73,7 @@ #include #include #include +#include #include @@ -101,7 +102,6 @@ #include #include #include -#include int cpu_match(struct device *, void *, void *); void cpu_attach(struct device *, struct device *, void *); @@ -591,7 +591,7 @@ cpu_boot_secondary_processors(void) continue; if (ci->ci_flags & (CPUF_BSP|CPUF_SP|CPUF_PRIMARY)) continue; - ci->ci_randseed = random(); + ci->ci_randseed = (arc4random() & 0x7fffffff) + 1; cpu_boot_secondary(ci); } } -- cgit v1.2.3