Skip to content

Commit

Permalink
Update Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
TotalTechGeek committed May 9, 2018
1 parent b51d15b commit 14e470c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tool/toolCrypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -840,20 +840,22 @@ void encryptFile(const std::string& fileName, const std::string& outputFile, con
unsigned char* ikey = (unsigned char*)&fp.key[0];


// Used to determine what the derived key size will be.
int derivedKeySize = keysize;

// Eventually: Remove this.
// This will be deprecated in production relatively soon.
if(fp.version == 3)
{
// There was an old "bug" (not a security risk) where the derived key was longer
// than necessary.
derivedKeySize = keysize * 8;
}

// For each of the exchanges, encrypt the key used for payload encryption.
for(int i = 0; i < exchanges.size(); i++)
{
// Derives a key from the exchange to encrypt the payload key with.
// This is actually a bug right here, as the key size should really be / 8.
string scr = intToScrypt(exchanges[i].computed, exchanges[i].sp, derivedKeySize, fp);
const unsigned char* key = (unsigned char*)scr.c_str();

Expand Down Expand Up @@ -1041,6 +1043,8 @@ char decryptFile(const std::string& fileName, const std::string& outputFile, con
// This will be deprecated in production relatively soon.
if(fp.version == 3)
{
// There was an old "bug" (not a security risk) where the derived key was longer
// than necessary.
derivedKeySize = keysize * 8;
}

Expand Down

0 comments on commit 14e470c

Please # to comment.