|
|
@ -1432,17 +1432,15 @@ bool Kdb3Database::save(){ |
|
|
|
aes.key256(FinalKey); |
|
|
|
aes.key256(FinalKey); |
|
|
|
aes.cbc_encrypt((unsigned char*)buffer+DB_HEADER_SIZE,(unsigned char*)buffer+DB_HEADER_SIZE,EncryptedPartSize,(unsigned char*)EncryptionIV); |
|
|
|
aes.cbc_encrypt((unsigned char*)buffer+DB_HEADER_SIZE,(unsigned char*)buffer+DB_HEADER_SIZE,EncryptedPartSize,(unsigned char*)EncryptionIV); |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
else{ // Algorithm == Twofish_Cipher
|
|
|
|
if(Algorithm == Twofish_Cipher){ |
|
|
|
CTwofish twofish; |
|
|
|
CTwofish twofish; |
|
|
|
if(twofish.init(FinalKey, 32, EncryptionIV) == false){ |
|
|
|
if(twofish.init(FinalKey, 32, EncryptionIV) == false){ |
|
|
|
UNEXP_ERROR |
|
|
|
UNEXP_ERROR |
|
|
|
delete [] buffer; |
|
|
|
delete [] buffer; |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
EncryptedPartSize = (unsigned long)twofish.padEncrypt((quint8*)buffer+DB_HEADER_SIZE, |
|
|
|
|
|
|
|
pos - DB_HEADER_SIZE,(quint8*)buffer+DB_HEADER_SIZE); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
EncryptedPartSize = (unsigned long)twofish.padEncrypt((quint8*)buffer+DB_HEADER_SIZE, |
|
|
|
|
|
|
|
pos - DB_HEADER_SIZE,(quint8*)buffer+DB_HEADER_SIZE); |
|
|
|
} |
|
|
|
} |
|
|
|
if((EncryptedPartSize > (0xFFFFFFE - 202)) || (!EncryptedPartSize && Groups.size())){ |
|
|
|
if((EncryptedPartSize > (0xFFFFFFE - 202)) || (!EncryptedPartSize && Groups.size())){ |
|
|
|
UNEXP_ERROR |
|
|
|
UNEXP_ERROR |
|
|
|