mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-03 20:14:17 -04:00
Add more Crypto::initalized() assertions.
This commit is contained in:
parent
e5bba14994
commit
11ccdd4c9c
2 changed files with 8 additions and 0 deletions
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
#include <gcrypt.h>
|
#include <gcrypt.h>
|
||||||
|
|
||||||
|
#include "crypto/Crypto.h"
|
||||||
|
|
||||||
class CryptoHashPrivate
|
class CryptoHashPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -31,6 +33,8 @@ CryptoHash::CryptoHash(CryptoHash::Algorithm algo)
|
||||||
{
|
{
|
||||||
Q_D(CryptoHash);
|
Q_D(CryptoHash);
|
||||||
|
|
||||||
|
Q_ASSERT(Crypto::initalized());
|
||||||
|
|
||||||
int algoGcrypt;
|
int algoGcrypt;
|
||||||
|
|
||||||
switch (algo) {
|
switch (algo) {
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
#include <gcrypt.h>
|
#include <gcrypt.h>
|
||||||
|
|
||||||
|
#include "crypto/Crypto.h"
|
||||||
|
|
||||||
void Random::randomize(QByteArray& ba)
|
void Random::randomize(QByteArray& ba)
|
||||||
{
|
{
|
||||||
randomize(ba.data(), ba.size());
|
randomize(ba.data(), ba.size());
|
||||||
|
@ -48,6 +50,8 @@ quint32 Random::randomUIntRange(quint32 min, quint32 max)
|
||||||
|
|
||||||
void Random::randomize(void* data, int len)
|
void Random::randomize(void* data, int len)
|
||||||
{
|
{
|
||||||
|
Q_ASSERT(Crypto::initalized());
|
||||||
|
|
||||||
gcry_randomize(data, len, GCRY_STRONG_RANDOM);
|
gcry_randomize(data, len, GCRY_STRONG_RANDOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue