Skip to content

Commit

Permalink
Add information gathered through getauxval()
Browse files Browse the repository at this point in the history
Suggested by Wladimir van der Laan.
  • Loading branch information
sipa committed Oct 27, 2019
1 parent 713c163 commit c197258
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/randomenv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#ifdef WIN32
#include <compat.h> // for Windows API
#else
#include <sys/auxv.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/types.h>
Expand Down Expand Up @@ -213,6 +214,27 @@ void RandAddStaticEnv(CSHA512& hasher)
hasher << x;
#endif

#ifndef WIN32
// Information available through getauxval()
# ifdef AT_HWCAP
hasher << getauxval(AT_HWCAP);
# endif
# ifdef AT_HWCAP2
hasher << getauxval(AT_HWCAP2);
# endif
# ifdef AT_RANDOM
hasher << getauxval(AT_RANDOM);
# endif
# ifdef AT_PLATFORM
const char* platform_str = (const char*)getauxval(AT_PLATFORM);
hasher.Write((const unsigned char*)platform_str, strlen(platform_str) + 1);
# endif
# ifdef AT_EXECFN
const char* exec_str = (const char*)getauxval(AT_EXECFN);
hasher.Write((const unsigned char*)exec_str, strlen(exec_str) + 1);
# endif
#endif

#ifdef HAVE_GETCPUID
AddCPUID(hasher);
#endif
Expand Down

0 comments on commit c197258

Please sign in to comment.