From: VMware, Inc <> Date: Mon, 21 Nov 2011 23:57:20 +0000 (-0800) Subject: lib/misc: pick up a few review comments X-Git-Tag: 2011.11.20-535097~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d566e72fad8187e22784cd51ae8ec4d2cbd9e666;p=thirdparty%2Fopen-vm-tools.git lib/misc: pick up a few review comments Pick up a few review comments on random.c Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/misc/random.c b/open-vm-tools/lib/misc/random.c index ce8062051..b87620251 100644 --- a/open-vm-tools/lib/misc/random.c +++ b/open-vm-tools/lib/misc/random.c @@ -33,7 +33,6 @@ # include # include -# define ESX_RANDOM_DEVICE "/vmfs/devices/char/vmkdriver/urandom" # define GENERIC_RANDOM_DEVICE "/dev/urandom" #endif @@ -91,7 +90,8 @@ RandomBytesWin32(unsigned int size, // IN: * * RandomBytesPosix -- * - * Generate 'size' bytes of random bits in 'buffer'. + * Generate 'size' bytes of cryptographically strong random bits in + * 'buffer'. * * Results: * TRUE success @@ -155,9 +155,7 @@ RandomBytesPosix(const char *name, // IN: * external to the application. * * DO NOT USE THIS FUNCTION UNLESS YOU HAVE AN ABSOLUTE, EXPLICIT - * NEED FOR CRYPTOGRAPHICALLY VALID RANDOM NUMBERS. SEE BELOW. - * - * THIS ROUTINE MAY BLOCK WAITING FOR SUFFICIENT ENTROPY. + * NEED FOR CRYPTOGRAPHICALLY VALID RANDOM NUMBERS. * * Results: * TRUE success @@ -181,30 +179,7 @@ Random_Crypto(unsigned int size, // IN: * because it cannot block. --hpreg */ - if (vmx86_server) { - /* - * ESX: attempt to use the wonderful random device. - */ - - if (RandomBytesPosix(ESX_RANDOM_DEVICE, size, buffer)) { - return TRUE; - } - } - - /* - * On ESX developer builds attempt to fall back to the generic random - * device, even if it is much slower. This has a nice side-effect - - * some things built for ESX will actually work in a Linux hosted - * environment. - */ - - if ((vmx86_server && vmx86_devel) || !vmx86_server) { - if (RandomBytesPosix(GENERIC_RANDOM_DEVICE, size, buffer)) { - return TRUE; - } - } - - return FALSE; + return RandomBytesPosix(GENERIC_RANDOM_DEVICE, size, buffer); #endif }