aboutsummaryrefslogtreecommitdiff
path: root/src/randomenv.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2019-10-27 12:36:05 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2019-11-12 15:35:26 -0800
commit483b94292e89587e5ab40a30b8a90e2f56e847f3 (patch)
treecc2844001bfc7610bf08b807f51728a208981c0f /src/randomenv.cpp
parent11793ea22e1298fa7d3b44a5b6d20830248d8cf4 (diff)
downloadbitcoin-483b94292e89587e5ab40a30b8a90e2f56e847f3.tar.xz
Add information gathered through getauxval()
Suggested by Wladimir van der Laan.
Diffstat (limited to 'src/randomenv.cpp')
-rw-r--r--src/randomenv.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/randomenv.cpp b/src/randomenv.cpp
index bfe57dafe5..05be090d93 100644
--- a/src/randomenv.cpp
+++ b/src/randomenv.cpp
@@ -57,6 +57,9 @@
#include <sys/vmmeter.h>
#endif
#endif
+#ifdef __linux__
+#include <sys/auxv.h>
+#endif
//! Necessary on some platforms
extern char** environ;
@@ -329,6 +332,28 @@ void RandAddStaticEnv(CSHA512& hasher)
// Bitcoin 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 unsigned char* random_aux = (const unsigned char*)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 unsigned char*)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 unsigned char*)exec_str, strlen(exec_str) + 1);
+# endif
+#endif // __linux__
+
#ifdef HAVE_GETCPUID
AddAllCPUID(hasher);
#endif