Improved seeding of the random number generator
Fixed AppDir on Windows git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@183 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
@@ -20,6 +20,42 @@
|
||||
#ifndef RANDOM_H_
|
||||
#define RANDOM_H_
|
||||
|
||||
extern void getRandomBytes(void* buffer,int NumBlocks);
|
||||
#include <QObject>
|
||||
|
||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
||||
#define HAS_DEV_RANDOM
|
||||
#include <QThread>
|
||||
#endif
|
||||
|
||||
class RandomSource : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RandomSource();
|
||||
|
||||
private:
|
||||
static void getRandomWeak(quint8* buffer, int length);
|
||||
|
||||
#ifdef HAS_DEV_RANDOM
|
||||
private slots:
|
||||
void seedStrong(int source, QByteArray buffer, int length);
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef HAS_DEV_RANDOM
|
||||
class DevRandom : public QThread {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DevRandom(QObject* parent = 0);
|
||||
void run();
|
||||
|
||||
signals:
|
||||
void randomAvailable(int source, QByteArray buffer, int length);
|
||||
|
||||
private:
|
||||
static bool getRandomStrong(quint8* buffer, int length);
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user