diff --git a/CHANGELOG b/CHANGELOG index c5d6a2e..f7e8afd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ innoextract 1.10 (TBD) - Added support for Inno Setup 6.3.x installers + - Added preliminary support for Inno Setup 6.4.0 - Added support for a modified Inno Setup 5.3.10 variant - Added unit tests - Replaced USE_ARC4 build option with BUILD_DECRYPTION diff --git a/src/setup/data.cpp b/src/setup/data.cpp index f0a037c..4444ce2 100644 --- a/src/setup/data.cpp +++ b/src/setup/data.cpp @@ -73,7 +73,10 @@ void data_entry::load(std::istream & is, const info & i) { } uncompressed_size = file.size; - if(i.version >= INNO_VERSION(5, 3, 9)) { + if(i.version >= INNO_VERSION(6, 4, 0)) { + is.read(file.checksum.sha256, std::streamsize(sizeof(file.checksum.sha256))); + file.checksum.type = crypto::SHA256; + } else if(i.version >= INNO_VERSION(5, 3, 9)) { is.read(file.checksum.sha1, std::streamsize(sizeof(file.checksum.sha1))); file.checksum.type = crypto::SHA1; } else if(i.version >= INNO_VERSION(4, 2, 0)) { @@ -189,7 +192,9 @@ void data_entry::load(std::istream & is, const info & i) { } if(options & ChunkEncrypted) { - if(i.version >= INNO_VERSION(5, 3, 9)) { + if(i.version >= INNO_VERSION(6, 4, 0)) { + chunk.encryption = stream::XChaCha20; + } else if(i.version >= INNO_VERSION(5, 3, 9)) { chunk.encryption = stream::ARC4_SHA1; } else { chunk.encryption = stream::ARC4_MD5; diff --git a/src/setup/header.cpp b/src/setup/header.cpp index 26ea25e..f6325c4 100644 --- a/src/setup/header.cpp +++ b/src/setup/header.cpp @@ -373,17 +373,23 @@ void header::load(std::istream & is, const version & version) { image_alpha_format = AlphaIgnored; } - if(version < INNO_VERSION(4, 2, 0)) { - password.crc32 = util::load(is); - password.type = crypto::CRC32; - } else if(version < INNO_VERSION(5, 3, 9)) { + if(version >= INNO_VERSION(6, 4, 0)) { + is.read(password.sha256, 4); + password.type = crypto::PBKDF2_SHA256_XChaCha20; + } else if(version >= INNO_VERSION(5, 3, 9)) { + is.read(password.sha1, std::streamsize(sizeof(password.sha1))); + password.type = crypto::SHA1; + } else if(version >= INNO_VERSION(4, 2, 0)) { is.read(password.md5, std::streamsize(sizeof(password.md5))); password.type = crypto::MD5; } else { - is.read(password.sha1, std::streamsize(sizeof(password.sha1))); - password.type = crypto::SHA1; + password.crc32 = util::load(is); + password.type = crypto::CRC32; } - if(version >= INNO_VERSION(4, 2, 2)) { + if(version >= INNO_VERSION(6, 4, 0)) { + password_salt.resize(44); // PBKDF2 salt + iteration count + ChaCha2 base nonce + is.read(&password_salt[0], std::streamsize(password_salt.length())); + } else if(version >= INNO_VERSION(4, 2, 2)) { password_salt.resize(8); is.read(&password_salt[0], std::streamsize(password_salt.length())); password_salt.insert(0, "PasswordCheckHash"); diff --git a/src/setup/header.hpp b/src/setup/header.hpp index 8dfc5a5..ca50898 100644 --- a/src/setup/header.hpp +++ b/src/setup/header.hpp @@ -44,8 +44,6 @@ namespace setup { struct version; -typedef char salt[8]; - struct header { // Setup data header. diff --git a/src/setup/info.cpp b/src/setup/info.cpp index 267807b..d696924 100644 --- a/src/setup/info.cpp +++ b/src/setup/info.cpp @@ -124,7 +124,7 @@ void load_wizard_and_decompressor(std::istream & is, const setup::version & vers } info.decrypt_dll.clear(); - if(header.options & header::EncryptionUsed) { + if((header.options & header::EncryptionUsed) && version < INNO_VERSION(6, 4, 0)) { if(entries & (info::DecryptDll | info::NoSkip)) { is >> util::binary_string(info.decrypt_dll); } else { diff --git a/src/setup/version.cpp b/src/setup/version.cpp index 9fa12dd..fbdbc07 100644 --- a/src/setup/version.cpp +++ b/src/setup/version.cpp @@ -184,6 +184,7 @@ const known_version versions[] = { { "Inno Setup Setup Data (6.0.0) (u)", INNO_VERSION_EXT(6, 0, 0, 0), version::Unicode }, { "Inno Setup Setup Data (6.1.0) (u)", INNO_VERSION_EXT(6, 1, 0, 0), version::Unicode }, { "Inno Setup Setup Data (6.3.0)", INNO_VERSION_EXT(6, 3, 0, 0), version::Unicode }, + { "Inno Setup Setup Data (6.4.0)", INNO_VERSION_EXT(6, 4, 0, 0), version::Unicode }, }; } // anonymous namespace