Skip to content

Commit 483b942

Browse files
committed
Add information gathered through getauxval()
Suggested by Wladimir van der Laan.
1 parent 11793ea commit 483b942

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/randomenv.cpp

+25
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
#include <sys/vmmeter.h>
5858
#endif
5959
#endif
60+
#ifdef __linux__
61+
#include <sys/auxv.h>
62+
#endif
6063

6164
//! Necessary on some platforms
6265
extern char** environ;
@@ -329,6 +332,28 @@ void RandAddStaticEnv(CSHA512& hasher)
329332
// Bitcoin client version
330333
hasher << CLIENT_VERSION;
331334

335+
#ifdef __linux__
336+
// Information available through getauxval()
337+
# ifdef AT_HWCAP
338+
hasher << getauxval(AT_HWCAP);
339+
# endif
340+
# ifdef AT_HWCAP2
341+
hasher << getauxval(AT_HWCAP2);
342+
# endif
343+
# ifdef AT_RANDOM
344+
const unsigned char* random_aux = (const unsigned char*)getauxval(AT_RANDOM);
345+
if (random_aux) hasher.Write(random_aux, 16);
346+
# endif
347+
# ifdef AT_PLATFORM
348+
const char* platform_str = (const char*)getauxval(AT_PLATFORM);
349+
if (platform_str) hasher.Write((const unsigned char*)platform_str, strlen(platform_str) + 1);
350+
# endif
351+
# ifdef AT_EXECFN
352+
const char* exec_str = (const char*)getauxval(AT_EXECFN);
353+
if (exec_str) hasher.Write((const unsigned char*)exec_str, strlen(exec_str) + 1);
354+
# endif
355+
#endif // __linux__
356+
332357
#ifdef HAVE_GETCPUID
333358
AddAllCPUID(hasher);
334359
#endif

0 commit comments

Comments
 (0)