xref: /minix3/crypto/external/bsd/openssl/dist/MacOS/Randomizer.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1ebfedea0SLionel Sambuc 
2ebfedea0SLionel Sambuc // Gathers unpredictable system data to be used for generating
3ebfedea0SLionel Sambuc // random bits
4ebfedea0SLionel Sambuc 
5ebfedea0SLionel Sambuc #include <MacTypes.h>
6ebfedea0SLionel Sambuc 
7*0a6a1f1dSLionel Sambuc class CRandomizer {
8ebfedea0SLionel Sambuc  public:
9ebfedea0SLionel Sambuc     CRandomizer(void);
10ebfedea0SLionel Sambuc     void PeriodicAction(void);
11ebfedea0SLionel Sambuc 
12ebfedea0SLionel Sambuc  private:
13ebfedea0SLionel Sambuc 
14ebfedea0SLionel Sambuc     // Private calls
15ebfedea0SLionel Sambuc 
16ebfedea0SLionel Sambuc     void AddTimeSinceMachineStartup(void);
17ebfedea0SLionel Sambuc     void AddAbsoluteSystemStartupTime(void);
18ebfedea0SLionel Sambuc     void AddAppRunningTime(void);
19ebfedea0SLionel Sambuc     void AddStartupVolumeInfo(void);
20ebfedea0SLionel Sambuc     void AddFiller(void);
21ebfedea0SLionel Sambuc 
22ebfedea0SLionel Sambuc     void AddCurrentMouse(void);
23ebfedea0SLionel Sambuc     void AddNow(double millisecondUncertainty);
24ebfedea0SLionel Sambuc     void AddBytes(void *data, long size, double entropy);
25ebfedea0SLionel Sambuc 
26ebfedea0SLionel Sambuc     void GetTimeBaseResolution(void);
27ebfedea0SLionel Sambuc     unsigned long SysTimer(void);
28ebfedea0SLionel Sambuc 
29ebfedea0SLionel Sambuc     // System Info
30ebfedea0SLionel Sambuc     bool mSupportsLargeVolumes;
31ebfedea0SLionel Sambuc     bool mIsPowerPC;
32ebfedea0SLionel Sambuc     bool mIs601;
33ebfedea0SLionel Sambuc 
34ebfedea0SLionel Sambuc     // Time info
35ebfedea0SLionel Sambuc     double mTimebaseTicksPerMillisec;
36ebfedea0SLionel Sambuc     unsigned long mLastPeriodicTicks;
37ebfedea0SLionel Sambuc 
38ebfedea0SLionel Sambuc     // Mouse info
39ebfedea0SLionel Sambuc     long mSamplePeriod;
40ebfedea0SLionel Sambuc     Point mLastMouse;
41ebfedea0SLionel Sambuc     long mMouseStill;
42ebfedea0SLionel Sambuc };
43