diff options
| author | Tomas Bzatek <tbzatek@redhat.com> | 2023-12-17 21:23:58 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@redhat.com> | 2023-12-17 21:23:58 +0100 |
| commit | 02d6107c97b48888362e7c6a70dcac323c89d741 (patch) | |
| tree | 5069a77adaf73f7249ac79b6c49a47168a647ef8 /zip/ZipArchive/ZipCrc32Cryptograph.cpp | |
| parent | 4e17c2527b106f1b493a3ac77c89858d14f834e2 (diff) | |
| download | tuxcmd-modules-02d6107c97b48888362e7c6a70dcac323c89d741.tar.xz | |
ZipArchive: Update to the 4.6.9 release
Diffstat (limited to 'zip/ZipArchive/ZipCrc32Cryptograph.cpp')
| -rw-r--r-- | zip/ZipArchive/ZipCrc32Cryptograph.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/zip/ZipArchive/ZipCrc32Cryptograph.cpp b/zip/ZipArchive/ZipCrc32Cryptograph.cpp index 50a0e2b..8994e44 100644 --- a/zip/ZipArchive/ZipCrc32Cryptograph.cpp +++ b/zip/ZipArchive/ZipCrc32Cryptograph.cpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////////
-// This source file is part of the ZipArchive library source distribution and
-// is Copyrighted 2000 - 2007 by Artpol Software - Tadeusz Dracz
+// This source file is part of the ZipArchive Library Open Source distribution
+// and is Copyrighted 2000 - 2022 by Artpol Software - Tadeusz Dracz
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -9,13 +9,13 @@ //
// For the licensing details refer to the License.txt file.
//
-// Web Site: http://www.artpol-software.com
+// Web Site: https://www.artpol-software.com
////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ZipCrc32Cryptograph.h"
-bool CZipCrc32Cryptograph::InitDecode(CZipAutoBuffer& password, CZipFileHeader& currentFile, CZipStorage& storage)
+bool CZipCrc32Cryptograph::InitDecode(CZipAutoBuffer& password, CZipFileHeader& currentFile, CZipStorage& storage, bool ignoreCheck)
{
CryptInitKeys(password);
CZipAutoBuffer buf(ZIPARCHIVE_ENCR_HEADER_LEN);
@@ -27,8 +27,8 @@ bool CZipCrc32Cryptograph::InitDecode(CZipAutoBuffer& password, CZipFileHeader& CryptDecode((char&)b);
}
// check the last byte
- return currentFile.IsDataDescriptor() ?
- (BYTE(currentFile.m_uModTime >> 8) == b) : (BYTE(currentFile.m_uCrc32 >> 24) == b);
+ return ignoreCheck || (currentFile.IsDataDescriptor() ?
+ (BYTE(currentFile.m_uModTime >> 8) == b) : (BYTE(currentFile.m_uCrc32 >> 24) == b));
}
void CZipCrc32Cryptograph::InitEncode(CZipAutoBuffer& password, CZipFileHeader& currentFile, CZipStorage& storage)
@@ -37,7 +37,7 @@ void CZipCrc32Cryptograph::InitEncode(CZipAutoBuffer& password, CZipFileHeader& // use pseudo-crc since we don't know it yet
CryptInitKeys(password);
srand(UINT(time(NULL)));
- // genereate pseudo-random sequence
+ // generate pseudo-random sequence
char c;
char* buffer = (char*)buf;
for (int i = 0; i < ZIPARCHIVE_ENCR_HEADER_LEN - 2; i++)
@@ -50,7 +50,7 @@ void CZipCrc32Cryptograph::InitEncode(CZipAutoBuffer& password, CZipFileHeader& buffer[i] = c;
}
- long iCrc = (long)currentFile.m_uModTime << 16;
+ int iCrc = (int)currentFile.m_uModTime << 16;
c = (char)((iCrc >> 16) & 0xFF);
CryptEncode(c);
buffer[ZIPARCHIVE_ENCR_HEADER_LEN - 2] = c;
|
