Skip to content

Commit c197258

Browse files
committed
Add information gathered through getauxval()
Suggested by Wladimir van der Laan.
1 parent 713c163 commit c197258

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/randomenv.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#ifdef WIN32
2323
#include <compat.h> // for Windows API
2424
#else
25+
#include <sys/auxv.h>
2526
#include <sys/time.h>
2627
#include <sys/resource.h>
2728
#include <sys/types.h>
@@ -213,6 +214,27 @@ void RandAddStaticEnv(CSHA512& hasher)
213214
hasher << x;
214215
#endif
215216

217+
#ifndef WIN32
218+
// Information available through getauxval()
219+
# ifdef AT_HWCAP
220+
hasher << getauxval(AT_HWCAP);
221+
# endif
222+
# ifdef AT_HWCAP2
223+
hasher << getauxval(AT_HWCAP2);
224+
# endif
225+
# ifdef AT_RANDOM
226+
hasher << getauxval(AT_RANDOM);
227+
# endif
228+
# ifdef AT_PLATFORM
229+
const char* platform_str = (const char*)getauxval(AT_PLATFORM);
230+
hasher.Write((const unsigned char*)platform_str, strlen(platform_str) + 1);
231+
# endif
232+
# ifdef AT_EXECFN
233+
const char* exec_str = (const char*)getauxval(AT_EXECFN);
234+
hasher.Write((const unsigned char*)exec_str, strlen(exec_str) + 1);
235+
# endif
236+
#endif
237+
216238
#ifdef HAVE_GETCPUID
217239
AddCPUID(hasher);
218240
#endif

0 commit comments

Comments
 (0)