summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/pwmdoc.cpp
Side-by-side diff
Diffstat (limited to 'pwmanager/pwmanager/pwmdoc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index 17cb74a..a740d6d 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -486,9 +486,9 @@ PwMerror PwMDoc::saveDoc(char compress, const QString *file)
f.close();
ret = e_enc;
goto out_moveback;
}
- e = encrypt(&serialized, &currentPw, &f, cryptAlgo);
+ e = encrypt(&serialized, &currentPw, &f, cryptAlgo, hashAlgo);
if (e == e_weakPw) {
printDebug("PwMDoc::saveDoc(): encrypt() failed: e_weakPw");
f.close();
ret = e_weakPw;
@@ -606,9 +606,9 @@ PwMerror PwMDoc::openDoc(const QString *file, int openLocked)
return ret;
} else
return e_readFile;
}
- ret = decrypt(&decrypted, headerLen, &currentPw, cryptAlgo, &f);
+ ret = decrypt(&decrypted, headerLen, &currentPw, cryptAlgo, dataHashType, &f);
if (ret == e_cryptNotImpl) {
printDebug("PwMDoc::openDoc(): decrypt() failed: e_cryptNotImpl");
f.close();
return e_cryptNotImpl;
@@ -1306,9 +1306,11 @@ bool PwMDoc::decompressDta(string *d, char algo)
}
return false;
}
-PwMerror PwMDoc::encrypt(string *d, const QString *pw, QFile *f, char algo)
+PwMerror PwMDoc::encrypt(string *d, const QString *pw, QFile *f, char algo,
+ char hashalgo //US BUG: pass _hashalgo because we need it in hashPassphrase
+)
{
PWM_ASSERT(d);
PWM_ASSERT(pw);
PWM_ASSERT(f);
@@ -1347,9 +1349,11 @@ PwMerror PwMDoc::encrypt(string *d, const QString *pw, QFile *f, char algo)
plain,
d->length(),
reinterpret_cast<const unsigned char *>(pw->latin1()),
pw->length(),
- algo);
+ algo,
+ hashalgo //US BUG: pass _hashalgo because we need it in hashPassphrase
+ );
delete [] plain;
if (err != e_success)
return e_cryptNotImpl;
break;
@@ -1370,9 +1374,11 @@ PwMerror PwMDoc::encrypt(string *d, const QString *pw, QFile *f, char algo)
return e_success;
}
PwMerror PwMDoc::decrypt(string *d, unsigned int pos, const QString *pw,
- char algo, QFile *f)
+ char algo,
+ char hashalgo, //US BUG: pass _hashalgo because we need it in hashPassphrase
+ QFile *f)
{
PWM_ASSERT(d);
PWM_ASSERT(pw);
PWM_ASSERT(f);
@@ -1422,9 +1428,11 @@ PwMerror PwMDoc::decrypt(string *d, unsigned int pos, const QString *pw,
encrypted,
cryptLen,
reinterpret_cast<const unsigned char *>(pw->latin1()),
pw->length(),
- algo);
+ algo,
+ hashalgo //US BUG: pass _hashalgo because we need it in hashPassphrase
+);
if (err != e_success) {
delete [] encrypted;
delete [] decrypted;
return e_cryptNotImpl;