Add more Crypto::initalized() assertions.

This commit is contained in:
Felix Geyer 2011-11-20 11:46:09 +01:00
parent e5bba14994
commit 11ccdd4c9c
2 changed files with 8 additions and 0 deletions

View File

@ -19,6 +19,8 @@
#include <gcrypt.h>
#include "crypto/Crypto.h"
class CryptoHashPrivate
{
public:
@ -31,6 +33,8 @@ CryptoHash::CryptoHash(CryptoHash::Algorithm algo)
{
Q_D(CryptoHash);
Q_ASSERT(Crypto::initalized());
int algoGcrypt;
switch (algo) {

View File

@ -19,6 +19,8 @@
#include <gcrypt.h>
#include "crypto/Crypto.h"
void Random::randomize(QByteArray& ba)
{
randomize(ba.data(), ba.size());
@ -48,6 +50,8 @@ quint32 Random::randomUIntRange(quint32 min, quint32 max)
void Random::randomize(void* data, int len)
{
Q_ASSERT(Crypto::initalized());
gcry_randomize(data, len, GCRY_STRONG_RANDOM);
}