Changeset View
Changeset View
Standalone View
Standalone View
src/randomenv.cpp
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
#if HAVE_SYS_RESOURCES_H | #if HAVE_SYS_RESOURCES_H | ||||
#include <sys/resources.h> | #include <sys/resources.h> | ||||
#endif | #endif | ||||
#if HAVE_SYS_VMMETER_H | #if HAVE_SYS_VMMETER_H | ||||
#include <sys/vmmeter.h> | #include <sys/vmmeter.h> | ||||
#endif | #endif | ||||
#endif | #endif | ||||
#ifdef __linux__ | |||||
#include <sys/auxv.h> | |||||
#endif | |||||
//! Necessary on some platforms | //! Necessary on some platforms | ||||
extern char **environ; | extern char **environ; | ||||
namespace { | namespace { | ||||
void RandAddSeedPerfmon(CSHA512 &hasher) { | void RandAddSeedPerfmon(CSHA512 &hasher) { | ||||
#ifdef WIN32 | #ifdef WIN32 | ||||
// Don't need this on Linux, OpenSSL automatically uses /dev/urandom | // Don't need this on Linux, OpenSSL automatically uses /dev/urandom | ||||
▲ Show 20 Lines • Show All 287 Lines • ▼ Show 20 Lines | #ifdef __VERSION__ | ||||
const char *COMPILER_VERSION = __VERSION__; | const char *COMPILER_VERSION = __VERSION__; | ||||
hasher.Write((const uint8_t *)COMPILER_VERSION, | hasher.Write((const uint8_t *)COMPILER_VERSION, | ||||
strlen(COMPILER_VERSION) + 1); | strlen(COMPILER_VERSION) + 1); | ||||
#endif | #endif | ||||
// Bitcoin client version | // Bitcoin client version | ||||
hasher << CLIENT_VERSION; | hasher << CLIENT_VERSION; | ||||
#ifdef __linux__ | |||||
// Information available through getauxval() | |||||
#ifdef AT_HWCAP | |||||
hasher << getauxval(AT_HWCAP); | |||||
#endif | |||||
#ifdef AT_HWCAP2 | |||||
hasher << getauxval(AT_HWCAP2); | |||||
#endif | |||||
#ifdef AT_RANDOM | |||||
const uint8_t *random_aux = (const uint8_t *)getauxval(AT_RANDOM); | |||||
if (random_aux) { | |||||
hasher.Write(random_aux, 16); | |||||
} | |||||
#endif | |||||
#ifdef AT_PLATFORM | |||||
const char *platform_str = (const char *)getauxval(AT_PLATFORM); | |||||
if (platform_str) { | |||||
hasher.Write((const uint8_t *)platform_str, strlen(platform_str) + 1); | |||||
} | |||||
#endif | |||||
#ifdef AT_EXECFN | |||||
const char *exec_str = (const char *)getauxval(AT_EXECFN); | |||||
if (exec_str) { | |||||
hasher.Write((const uint8_t *)exec_str, strlen(exec_str) + 1); | |||||
} | |||||
#endif | |||||
#endif // __linux__ | |||||
#ifdef HAVE_GETCPUID | #ifdef HAVE_GETCPUID | ||||
AddAllCPUID(hasher); | AddAllCPUID(hasher); | ||||
#endif | #endif | ||||
// Memory locations | // Memory locations | ||||
hasher << &hasher << &RandAddStaticEnv << &malloc << &errno << &environ; | hasher << &hasher << &RandAddStaticEnv << &malloc << &errno << &environ; | ||||
// Hostname | // Hostname | ||||
▲ Show 20 Lines • Show All 146 Lines • Show Last 20 Lines |