diff options
author | Bret Lambert <blambert@cvs.openbsd.org> | 2013-04-24 08:23:46 +0000 |
---|---|---|
committer | Bret Lambert <blambert@cvs.openbsd.org> | 2013-04-24 08:23:46 +0000 |
commit | 34233fd0b370968c82f37cd6516f0694394946dc (patch) | |
tree | 503fb051710ff6b4519441de18543e6f4422e2a9 /sys/arch/amd64 | |
parent | 2817e076025d1ec99e0514d5582bc8c7b2f552e2 (diff) |
Use the manufacturer-supplied bios serial/uuid as a source of
uniqueness to seed the random pool; although it's somewhat
hit-or-miss, as serial numbers of 123456789 (I have the same
combination on my luggage!) and lazy uuid instantiation
mean it's not as unique as we would like.
Still, on those boards where the manufacturer isn't a slacker,
it's better than nothing...
ok deraadt@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r-- | sys/arch/amd64/amd64/bios.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/arch/amd64/amd64/bios.c b/sys/arch/amd64/amd64/bios.c index 6dcb9c4895c..a4cb791b6be 100644 --- a/sys/arch/amd64/amd64/bios.c +++ b/sys/arch/amd64/amd64/bios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bios.c,v 1.23 2013/03/12 16:31:50 deraadt Exp $ */ +/* $OpenBSD: bios.c,v 1.24 2013/04/24 08:23:44 blambert Exp $ */ /* * Copyright (c) 2006 Gordon Willem Klok <gklok@cogeco.ca> * @@ -38,6 +38,8 @@ #include <dev/acpi/acpireg.h> #include <dev/acpi/acpivar.h> +#include <dev/rndvar.h> + #include "acpi.h" #include "mpbios.h" #include "pci.h" @@ -421,6 +423,8 @@ smbios_info(char * str) sminfop = fixstring(p); if (sminfop) { infolen = strlen(sminfop) + 1; + for (i = 0; i < infolen - 1; i++) + add_timer_randomness(sminfop[i]); hw_serial = malloc(infolen, M_DEVBUF, M_NOWAIT); if (hw_serial) strlcpy(hw_serial, sminfop, infolen); @@ -444,6 +448,8 @@ smbios_info(char * str) else if (uuidf & SMBIOS_UUID_NSET) hw_uuid = "Not Set"; else { + for (i = 0; i < sizeof(sys->uuid); i++) + add_timer_randomness(sys->uuid[i]); hw_uuid = malloc(SMBIOS_UUID_REPLEN, M_DEVBUF, M_NOWAIT); if (hw_uuid) { |