Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/CPP
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2015-11-20 03:00:00 +0300
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:16:58 +0300
commit5de23c1deb52b8be4c43ad9f694c64bbddd0c38a (patch)
tree5b17a1cd7ecef0cba33bb3734356394136226940 /CPP
parente24f7fba53cc8f28d74b5039f7279d9bf945ff25 (diff)
15.1215.12
Diffstat (limited to 'CPP')
-rw-r--r--CPP/7zip/Archive/Zip/ZipHandler.cpp2
-rw-r--r--CPP/7zip/Archive/Zip/ZipItem.h2
-rw-r--r--CPP/7zip/Bundles/Format7zExtract/makefile2
-rw-r--r--CPP/7zip/Crypto/ZipStrong.cpp86
-rw-r--r--CPP/7zip/UI/Console/Console.mak1
-rw-r--r--CPP/7zip/UI/FileManager/PanelItems.cpp1
-rw-r--r--CPP/7zip/UI/GUI/HashGUI.cpp7
7 files changed, 89 insertions, 12 deletions
diff --git a/CPP/7zip/Archive/Zip/ZipHandler.cpp b/CPP/7zip/Archive/Zip/ZipHandler.cpp
index 510ecb41..a65c9e32 100644
--- a/CPP/7zip/Archive/Zip/ZipHandler.cpp
+++ b/CPP/7zip/Archive/Zip/ZipHandler.cpp
@@ -373,6 +373,8 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
ConvertUInt32ToString(f.AlgId, temp + 1);
m += temp;
}
+ if (f.CertificateIsUsed())
+ m += "-Cert";
}
else
m += kMethod_StrongCrypto;
diff --git a/CPP/7zip/Archive/Zip/ZipItem.h b/CPP/7zip/Archive/Zip/ZipItem.h
index 98afdf1d..c01ede8d 100644
--- a/CPP/7zip/Archive/Zip/ZipItem.h
+++ b/CPP/7zip/Archive/Zip/ZipItem.h
@@ -109,6 +109,8 @@ struct CStrongCryptoExtra
Flags = GetUi16(p + 6);
return (Format == 2);
}
+
+ bool CertificateIsUsed() const { return (Flags > 0x0001); }
};
struct CExtraBlock
diff --git a/CPP/7zip/Bundles/Format7zExtract/makefile b/CPP/7zip/Bundles/Format7zExtract/makefile
index b512144d..82265b08 100644
--- a/CPP/7zip/Bundles/Format7zExtract/makefile
+++ b/CPP/7zip/Bundles/Format7zExtract/makefile
@@ -107,4 +107,4 @@ C_OBJS = \
!include "../../Aes.mak"
!include "../../Crc.mak"
-!include "../../7zip.mak" \ No newline at end of file
+!include "../../7zip.mak"
diff --git a/CPP/7zip/Crypto/ZipStrong.cpp b/CPP/7zip/Crypto/ZipStrong.cpp
index c5e368b9..d70e1ba1 100644
--- a/CPP/7zip/Crypto/ZipStrong.cpp
+++ b/CPP/7zip/Crypto/ZipStrong.cpp
@@ -112,25 +112,87 @@ HRESULT CDecoder::Init_and_CheckPassword(bool &passwOK)
if (algId * 64 + 128 != bitLen)
return E_NOTIMPL;
_key.KeySize = 16 + algId * 8;
- if ((flags & 1) == 0)
- return E_NOTIMPL;
+ bool cert = ((flags & 2) != 0);
+
if ((flags & 0x4000) != 0)
{
// Use 3DES
return E_NOTIMPL;
}
+ if (cert)
+ {
+ return E_NOTIMPL;
+ }
+ else
+ {
+ if ((flags & 1) == 0)
+ return E_NOTIMPL;
+ }
+
UInt32 rdSize = GetUi16(p + 8);
- if ((rdSize & 0xF) != 0 || rdSize + 16 > _remSize)
+
+ if (rdSize + 16 > _remSize)
return E_NOTIMPL;
+
+ /*
+ if (cert)
+ {
+ // how to filter rd, if ((rdSize & 0xF) != 0) ?
+ /*
+ if ((rdSize & 0x7) != 0)
+ return E_NOTIMPL;
+ }
+ else
+ */
+ {
+ if ((rdSize & 0xF) != 0)
+ return E_NOTIMPL;
+ }
+
memmove(p, p + 10, rdSize);
- Byte *validData = p + rdSize + 16;
- if (GetUi32(validData - 6) != 0) // reserved
- return E_NOTIMPL;
- UInt32 validSize = GetUi16(validData - 2);
- if ((validSize & 0xF) != 0 || 16 + rdSize + validSize != _remSize)
- return E_NOTIMPL;
+ const Byte *p2 = p + rdSize + 10;
+ UInt32 reserved = GetUi32(p2);
+ p2 += 4;
+
+ /*
+ if (cert)
+ {
+ UInt32 numRecipients = reserved;
+
+ if (numRecipients == 0)
+ return E_NOTIMPL;
+
+ {
+ UInt32 hashAlg = GetUi16(p2);
+ hashAlg = hashAlg;
+ UInt32 hashSize = GetUi16(p2 + 2);
+ hashSize = hashSize;
+ p2 += 4;
+
+ reserved = reserved;
+ // return E_NOTIMPL;
+
+ for (unsigned r = 0; r < numRecipients; r++)
+ {
+ UInt32 specSize = GetUi16(p2);
+ p2 += 2;
+ p2 += specSize;
+ }
+ }
+ }
+ else
+ */
+ {
+ if (reserved != 0)
+ return E_NOTIMPL;
+ }
+ UInt32 validSize = GetUi16(p2);
+ p2 += 2;
+ const size_t validOffset = p2 - p;
+ if ((validSize & 0xF) != 0 || validOffset + validSize != _remSize)
+ return E_NOTIMPL;
{
RINOK(SetKey(_key.MasterKey, _key.KeySize));
@@ -149,12 +211,14 @@ HRESULT CDecoder::Init_and_CheckPassword(bool &passwOK)
RINOK(SetKey(fileKey, _key.KeySize));
RINOK(SetInitVector(_iv, 16));
Init();
- Filter(validData, validSize);
+
+ memmove(p, p + validOffset, validSize);
+ Filter(p, validSize);
if (validSize < 4)
return E_NOTIMPL;
validSize -= 4;
- if (GetUi32(validData + validSize) != CrcCalc(validData, validSize))
+ if (GetUi32(p + validSize) != CrcCalc(p, validSize))
return S_OK;
passwOK = true;
return S_OK;
diff --git a/CPP/7zip/UI/Console/Console.mak b/CPP/7zip/UI/Console/Console.mak
index 29b6a854..05a07e5a 100644
--- a/CPP/7zip/UI/Console/Console.mak
+++ b/CPP/7zip/UI/Console/Console.mak
@@ -33,3 +33,4 @@ UI_COMMON_OBJS = \
$O\UpdatePair.obj \
$O\UpdateProduce.obj \
+#
diff --git a/CPP/7zip/UI/FileManager/PanelItems.cpp b/CPP/7zip/UI/FileManager/PanelItems.cpp
index e72d1bb6..8f73cffd 100644
--- a/CPP/7zip/UI/FileManager/PanelItems.cpp
+++ b/CPP/7zip/UI/FileManager/PanelItems.cpp
@@ -1097,6 +1097,7 @@ void CPanel::SaveListViewInfo()
viewInfo.SortID = sortPropID;
viewInfo.Ascending = _ascending;
+ viewInfo.IsLoaded = true;
if (!_listViewInfo.IsEqual(viewInfo))
{
viewInfo.Save(_typeIDString);
diff --git a/CPP/7zip/UI/GUI/HashGUI.cpp b/CPP/7zip/UI/GUI/HashGUI.cpp
index 68c2b768..03d65156 100644
--- a/CPP/7zip/UI/GUI/HashGUI.cpp
+++ b/CPP/7zip/UI/GUI/HashGUI.cpp
@@ -175,6 +175,7 @@ void AddHashBundleRes(UString &s, const CHashBundle &hb, const UString &firstFil
AddValuePair(s, IDS_PROP_NUM_ERRORS, hb.NumErrors);
s.Add_LF();
}
+
if (hb.NumFiles == 1 && hb.NumDirs == 0 && !firstFileName.IsEmpty())
{
AddLangString(s, IDS_PROP_NAME);
@@ -197,6 +198,12 @@ void AddHashBundleRes(UString &s, const CHashBundle &hb, const UString &firstFil
AddSizeValuePair(s, IDS_PROP_ALT_STREAMS_SIZE, hb.AltStreamsSize);
}
+ if (hb.NumErrors == 0 && hb.Hashers.IsEmpty())
+ {
+ s.Add_LF();
+ AddLangString(s, IDS_MESSAGE_NO_ERRORS);
+ }
+
FOR_VECTOR (i, hb.Hashers)
{
s.Add_LF();