added PasswordHasher::initialize() to make libgcrypt warnings go away
This commit is contained in:
parent
2789116d03
commit
2deabebc7c
3 changed files with 11 additions and 0 deletions
|
@ -157,6 +157,8 @@ int main(int argc, char *argv[])
|
||||||
std::cerr << "Servatrice " << VERSION_STRING << " starting." << std::endl;
|
std::cerr << "Servatrice " << VERSION_STRING << " starting." << std::endl;
|
||||||
std::cerr << "-------------------------" << std::endl;
|
std::cerr << "-------------------------" << std::endl;
|
||||||
|
|
||||||
|
PasswordHasher::initialize();
|
||||||
|
|
||||||
if (testRandom)
|
if (testRandom)
|
||||||
testRNG();
|
testRNG();
|
||||||
if (testHashFunction)
|
if (testHashFunction)
|
||||||
|
|
|
@ -3,6 +3,14 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <gcrypt.h>
|
#include <gcrypt.h>
|
||||||
|
|
||||||
|
void PasswordHasher::initialize()
|
||||||
|
{
|
||||||
|
// These calls are required by libgcrypt before we use any of its functions.
|
||||||
|
gcry_check_version(0);
|
||||||
|
gcry_control(GCRYCTL_DISABLE_SECMEM, 0);
|
||||||
|
gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
|
||||||
|
}
|
||||||
|
|
||||||
QString PasswordHasher::computeHash(const QString &password, const QString &salt)
|
QString PasswordHasher::computeHash(const QString &password, const QString &salt)
|
||||||
{
|
{
|
||||||
const int algo = GCRY_MD_SHA512;
|
const int algo = GCRY_MD_SHA512;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
class PasswordHasher {
|
class PasswordHasher {
|
||||||
public:
|
public:
|
||||||
|
static void initialize();
|
||||||
static QString computeHash(const QString &password, const QString &salt);
|
static QString computeHash(const QString &password, const QString &salt);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue