summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/libgcryptif.cpp
Side-by-side diff
Diffstat (limited to 'pwmanager/pwmanager/libgcryptif.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/libgcryptif.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/pwmanager/pwmanager/libgcryptif.cpp b/pwmanager/pwmanager/libgcryptif.cpp
index ff94bf6..15f6cef 100644
--- a/pwmanager/pwmanager/libgcryptif.cpp
+++ b/pwmanager/pwmanager/libgcryptif.cpp
@@ -43,3 +43,5 @@ PwMerror LibGCryptIf::encrypt(unsigned char **outBuf,
size_t keylen,
- char _algo)
+ char _algo,
+ char _hashalgo //US BUG: pass _hashalgo because we need it in hashPassphrase
+ )
{
@@ -107,3 +109,3 @@ PwMerror LibGCryptIf::encrypt(unsigned char **outBuf,
hashedKey = new unsigned char[cipherKeylen];
- hashPassphrase(key, keylen, salt, hashedKey, cipherKeylen, true);
+ hashPassphrase(key, keylen, salt, hashedKey, cipherKeylen, true, _hashalgo);
// so now set the hashed key
@@ -154,3 +156,5 @@ PwMerror LibGCryptIf::decrypt(unsigned char **outBuf,
size_t keylen,
- char _algo)
+ char _algo,
+ char _hashalgo //US BUG: pass _hashalgo because we need it in hashPassphrase
+)
{
@@ -203,3 +207,3 @@ PwMerror LibGCryptIf::decrypt(unsigned char **outBuf,
hashedKey = new unsigned char[cipherKeylen];
- hashPassphrase(key, keylen, salt, hashedKey, cipherKeylen, false);
+ hashPassphrase(key, keylen, salt, hashedKey, cipherKeylen, false, _hashalgo);
// so now set the hashed key
@@ -316,3 +320,5 @@ bool LibGCryptIf::hashPassphrase(const unsigned char *pw,
size_t keylen,
- bool create)
+ bool create,
+ char _hashalgo //US BUG: pass _hashalgo because we need it in hashPassphrase
+)
{
@@ -324,3 +330,6 @@ bool LibGCryptIf::hashPassphrase(const unsigned char *pw,
s2k.mode = 1;
- s2k.hash_algo = mapHashId(conf()->confGlobHashAlgo());
+ //US bug: do not use the global hash algo here. Use the passed ago instead. The hashalgo stored in the file can
+ // be different from the one in the configuration.
+ s2k.hash_algo = mapHashId(_hashalgo //conf()->confGlobHashAlgo()
+ );
s2k.count = 0;
@@ -441,3 +450,3 @@ void LibGCryptIf::unpadData(const unsigned char *buf,
while (buf[pos] != static_cast<char>(0x01)) {
- qDebug("pos %d %d %d", pos, buf[pos], static_cast<char>(0x01) );
+ //qDebug("pos %d %d %d", pos, buf[pos], static_cast<char>(0x01) );
BUG_ON(!pos);
@@ -449,3 +458,3 @@ void LibGCryptIf::unpadData(const unsigned char *buf,
*bufLen = pos;
- qDebug("ente ");
+ //qDebug("ente ");
}