VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Apidrvr.h6
-rw-r--r--src/Common/BaseCom.cpp2
-rw-r--r--src/Common/BaseCom.h2
-rw-r--r--src/Common/BootEncryption.cpp2
-rw-r--r--src/Common/BootEncryption.h2
-rw-r--r--src/Common/Cache.c2
-rw-r--r--src/Common/Cache.h2
-rw-r--r--src/Common/Cmdline.c4
-rw-r--r--src/Common/Cmdline.h2
-rw-r--r--src/Common/Combo.c2
-rw-r--r--src/Common/Combo.h2
-rw-r--r--src/Common/Common.h2
-rw-r--r--src/Common/Crc.c2
-rw-r--r--src/Common/Crc.h2
-rw-r--r--src/Common/Crypto.c30
-rw-r--r--src/Common/Crypto.h2
-rw-r--r--src/Common/Dictionary.c2
-rw-r--r--src/Common/Dictionary.h2
-rw-r--r--src/Common/Dlgcode.c95
-rw-r--r--src/Common/Dlgcode.h4
-rw-r--r--src/Common/EncryptionThreadPool.c2
-rw-r--r--src/Common/EncryptionThreadPool.h2
-rw-r--r--src/Common/Endian.c2
-rw-r--r--src/Common/Endian.h2
-rw-r--r--src/Common/Exception.h2
-rw-r--r--src/Common/Fat.c2
-rw-r--r--src/Common/Fat.h2
-rw-r--r--src/Common/Format.c10
-rw-r--r--src/Common/Format.h2
-rw-r--r--src/Common/Keyfiles.c2
-rw-r--r--src/Common/Keyfiles.h2
-rw-r--r--src/Common/Language.c2
-rw-r--r--src/Common/Language.h2
-rw-r--r--src/Common/Language.xml137
-rw-r--r--src/Common/Password.c2
-rw-r--r--src/Common/Password.h2
-rw-r--r--src/Common/Pkcs5.c2
-rw-r--r--src/Common/Pkcs5.h2
-rw-r--r--src/Common/Progress.c2
-rw-r--r--src/Common/Progress.h2
-rw-r--r--src/Common/Random.c352
-rw-r--r--src/Common/Random.h2
-rw-r--r--src/Common/Registry.c2
-rw-r--r--src/Common/Registry.h2
-rw-r--r--src/Common/SecurityToken.cpp2
-rw-r--r--src/Common/SecurityToken.h2
-rw-r--r--src/Common/Tcdefs.h10
-rw-r--r--src/Common/Tests.c4
-rw-r--r--src/Common/Tests.h2
-rw-r--r--src/Common/Volumes.c2
-rw-r--r--src/Common/Volumes.h2
-rw-r--r--src/Common/Wipe.c2
-rw-r--r--src/Common/Wipe.h2
-rw-r--r--src/Common/Xml.c2
-rw-r--r--src/Common/Xml.h2
-rw-r--r--src/Common/Xts.c2
-rw-r--r--src/Common/Xts.h2
-rw-r--r--src/Common/Zip.vcxproj1
-rw-r--r--src/Common/Zip.vcxproj.filters3
-rw-r--r--src/Common/libzip/NEWS.md17
-rw-r--r--src/Common/libzip/compat.h78
-rw-r--r--src/Common/libzip/config.h6
-rw-r--r--src/Common/libzip/zip.h6
-rw-r--r--src/Common/libzip/zip_add.c2
-rw-r--r--src/Common/libzip/zip_add_dir.c2
-rw-r--r--src/Common/libzip/zip_add_entry.c4
-rw-r--r--src/Common/libzip/zip_algorithm_bzip2.c2
-rw-r--r--src/Common/libzip/zip_algorithm_deflate.c2
-rw-r--r--src/Common/libzip/zip_algorithm_xz.c2
-rw-r--r--src/Common/libzip/zip_algorithm_zstd.c2
-rw-r--r--src/Common/libzip/zip_buffer.c5
-rw-r--r--src/Common/libzip/zip_close.c45
-rw-r--r--src/Common/libzip/zip_crypto.h2
-rw-r--r--src/Common/libzip/zip_crypto_commoncrypto.c2
-rw-r--r--src/Common/libzip/zip_crypto_commoncrypto.h2
-rw-r--r--src/Common/libzip/zip_crypto_gnutls.c2
-rw-r--r--src/Common/libzip/zip_crypto_gnutls.h2
-rw-r--r--src/Common/libzip/zip_crypto_mbedtls.c2
-rw-r--r--src/Common/libzip/zip_crypto_mbedtls.h2
-rw-r--r--src/Common/libzip/zip_crypto_openssl.c13
-rw-r--r--src/Common/libzip/zip_crypto_openssl.h2
-rw-r--r--src/Common/libzip/zip_crypto_win.c5
-rw-r--r--src/Common/libzip/zip_crypto_win.h2
-rw-r--r--src/Common/libzip/zip_delete.c2
-rw-r--r--src/Common/libzip/zip_dir_add.c2
-rw-r--r--src/Common/libzip/zip_dirent.c202
-rw-r--r--src/Common/libzip/zip_discard.c2
-rw-r--r--src/Common/libzip/zip_entry.c2
-rw-r--r--src/Common/libzip/zip_err_str.c6
-rw-r--r--src/Common/libzip/zip_error.c2
-rw-r--r--src/Common/libzip/zip_error_clear.c2
-rw-r--r--src/Common/libzip/zip_error_get.c2
-rw-r--r--src/Common/libzip/zip_error_get_sys_type.c2
-rw-r--r--src/Common/libzip/zip_error_strerror.c14
-rw-r--r--src/Common/libzip/zip_error_to_str.c2
-rw-r--r--src/Common/libzip/zip_extra_field.c2
-rw-r--r--src/Common/libzip/zip_extra_field_api.c6
-rw-r--r--src/Common/libzip/zip_fclose.c2
-rw-r--r--src/Common/libzip/zip_fdopen.c2
-rw-r--r--src/Common/libzip/zip_file_add.c2
-rw-r--r--src/Common/libzip/zip_file_error_clear.c2
-rw-r--r--src/Common/libzip/zip_file_error_get.c2
-rw-r--r--src/Common/libzip/zip_file_get_comment.c2
-rw-r--r--src/Common/libzip/zip_file_get_external_attributes.c2
-rw-r--r--src/Common/libzip/zip_file_get_offset.c2
-rw-r--r--src/Common/libzip/zip_file_rename.c2
-rw-r--r--src/Common/libzip/zip_file_replace.c8
-rw-r--r--src/Common/libzip/zip_file_set_comment.c2
-rw-r--r--src/Common/libzip/zip_file_set_encryption.c2
-rw-r--r--src/Common/libzip/zip_file_set_external_attributes.c2
-rw-r--r--src/Common/libzip/zip_file_set_mtime.c40
-rw-r--r--src/Common/libzip/zip_file_strerror.c2
-rw-r--r--src/Common/libzip/zip_fopen.c2
-rw-r--r--src/Common/libzip/zip_fopen_encrypted.c2
-rw-r--r--src/Common/libzip/zip_fopen_index.c2
-rw-r--r--src/Common/libzip/zip_fopen_index_encrypted.c2
-rw-r--r--src/Common/libzip/zip_fread.c8
-rw-r--r--src/Common/libzip/zip_fseek.c10
-rw-r--r--src/Common/libzip/zip_ftell.c8
-rw-r--r--src/Common/libzip/zip_get_archive_comment.c2
-rw-r--r--src/Common/libzip/zip_get_archive_flag.c2
-rw-r--r--src/Common/libzip/zip_get_encryption_implementation.c2
-rw-r--r--src/Common/libzip/zip_get_file_comment.c2
-rw-r--r--src/Common/libzip/zip_get_name.c2
-rw-r--r--src/Common/libzip/zip_get_num_entries.c2
-rw-r--r--src/Common/libzip/zip_get_num_files.c2
-rw-r--r--src/Common/libzip/zip_hash.c2
-rw-r--r--src/Common/libzip/zip_io_util.c10
-rw-r--r--src/Common/libzip/zip_libzip_version.c2
-rw-r--r--src/Common/libzip/zip_memdup.c4
-rw-r--r--src/Common/libzip/zip_new.c5
-rw-r--r--src/Common/libzip/zip_open.c491
-rw-r--r--src/Common/libzip/zip_pkware.c2
-rw-r--r--src/Common/libzip/zip_progress.c4
-rw-r--r--src/Common/libzip/zip_random_unix.c2
-rw-r--r--src/Common/libzip/zip_random_uwp.c2
-rw-r--r--src/Common/libzip/zip_random_win32.c2
-rw-r--r--src/Common/libzip/zip_rename.c2
-rw-r--r--src/Common/libzip/zip_replace.c2
-rw-r--r--src/Common/libzip/zip_set_archive_comment.c2
-rw-r--r--src/Common/libzip/zip_set_archive_flag.c2
-rw-r--r--src/Common/libzip/zip_set_default_password.c2
-rw-r--r--src/Common/libzip/zip_set_file_comment.c2
-rw-r--r--src/Common/libzip/zip_set_file_compression.c2
-rw-r--r--src/Common/libzip/zip_set_name.c2
-rw-r--r--src/Common/libzip/zip_source_accept_empty.c2
-rw-r--r--src/Common/libzip/zip_source_begin_write.c2
-rw-r--r--src/Common/libzip/zip_source_begin_write_cloning.c2
-rw-r--r--src/Common/libzip/zip_source_buffer.c2
-rw-r--r--src/Common/libzip/zip_source_call.c2
-rw-r--r--src/Common/libzip/zip_source_close.c2
-rw-r--r--src/Common/libzip/zip_source_commit_write.c2
-rw-r--r--src/Common/libzip/zip_source_compress.c2
-rw-r--r--src/Common/libzip/zip_source_crc.c2
-rw-r--r--src/Common/libzip/zip_source_error.c2
-rw-r--r--src/Common/libzip/zip_source_file.h7
-rw-r--r--src/Common/libzip/zip_source_file_common.c2
-rw-r--r--src/Common/libzip/zip_source_file_stdio.c12
-rw-r--r--src/Common/libzip/zip_source_file_stdio.h2
-rw-r--r--src/Common/libzip/zip_source_file_stdio_named.c14
-rw-r--r--src/Common/libzip/zip_source_file_win32.c2
-rw-r--r--src/Common/libzip/zip_source_file_win32.h11
-rw-r--r--src/Common/libzip/zip_source_file_win32_ansi.c69
-rw-r--r--src/Common/libzip/zip_source_file_win32_named.c29
-rw-r--r--src/Common/libzip/zip_source_file_win32_utf16.c65
-rw-r--r--src/Common/libzip/zip_source_file_win32_utf8.c2
-rw-r--r--src/Common/libzip/zip_source_free.c2
-rw-r--r--src/Common/libzip/zip_source_get_dostime.c72
-rw-r--r--src/Common/libzip/zip_source_get_file_attributes.c2
-rw-r--r--src/Common/libzip/zip_source_is_deleted.c2
-rw-r--r--src/Common/libzip/zip_source_layered.c2
-rw-r--r--src/Common/libzip/zip_source_open.c2
-rw-r--r--src/Common/libzip/zip_source_pass_to_lower_layer.c4
-rw-r--r--src/Common/libzip/zip_source_pkware_decode.c43
-rw-r--r--src/Common/libzip/zip_source_pkware_encode.c63
-rw-r--r--src/Common/libzip/zip_source_read.c2
-rw-r--r--src/Common/libzip/zip_source_remove.c2
-rw-r--r--src/Common/libzip/zip_source_rollback_write.c2
-rw-r--r--src/Common/libzip/zip_source_seek.c2
-rw-r--r--src/Common/libzip/zip_source_seek_write.c2
-rw-r--r--src/Common/libzip/zip_source_stat.c2
-rw-r--r--src/Common/libzip/zip_source_supports.c2
-rw-r--r--src/Common/libzip/zip_source_tell.c2
-rw-r--r--src/Common/libzip/zip_source_tell_write.c2
-rw-r--r--src/Common/libzip/zip_source_window.c30
-rw-r--r--src/Common/libzip/zip_source_winzip_aes_decode.c2
-rw-r--r--src/Common/libzip/zip_source_winzip_aes_encode.c2
-rw-r--r--src/Common/libzip/zip_source_write.c2
-rw-r--r--src/Common/libzip/zip_source_zip.c2
-rw-r--r--src/Common/libzip/zip_source_zip_new.c11
-rw-r--r--src/Common/libzip/zip_stat.c2
-rw-r--r--src/Common/libzip/zip_stat_index.c12
-rw-r--r--src/Common/libzip/zip_stat_init.c2
-rw-r--r--src/Common/libzip/zip_strerror.c2
-rw-r--r--src/Common/libzip/zip_string.c22
-rw-r--r--src/Common/libzip/zip_unchange_all.c2
-rw-r--r--src/Common/libzip/zip_unchange_archive.c2
-rw-r--r--src/Common/libzip/zip_unchange_data.c2
-rw-r--r--src/Common/libzip/zip_utf-8.c146
-rw-r--r--src/Common/libzip/zip_winzip_aes.c2
-rw-r--r--src/Common/libzip/zipconf.h6
-rw-r--r--src/Common/libzip/zipint.h54
202 files changed, 1564 insertions, 1055 deletions
diff --git a/src/Common/Apidrvr.h b/src/Common/Apidrvr.h
index 955286da..84a3de91 100644
--- a/src/Common/Apidrvr.h
+++ b/src/Common/Apidrvr.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
@@ -43,9 +43,9 @@
// Dismount volume
// IN OUT - UNMOUNT_STRUCT
-#define TC_IOCTL_DISMOUNT_VOLUME TC_IOCTL (4)
+#define TC_IOCTL_UNMOUNT_VOLUME TC_IOCTL (4)
// Dismount all volumes
// IN OUT - UNMOUNT_STRUCT
-#define TC_IOCTL_DISMOUNT_ALL_VOLUMES TC_IOCTL (5)
+#define TC_IOCTL_UNMOUNT_ALL_VOLUMES TC_IOCTL (5)
// Get list of all mounted volumes
diff --git a/src/Common/BaseCom.cpp b/src/Common/BaseCom.cpp
index 25c70963..3b502ef0 100644
--- a/src/Common/BaseCom.cpp
+++ b/src/Common/BaseCom.cpp
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/BaseCom.h b/src/Common/BaseCom.h
index 431b0257..1a7b68d2 100644
--- a/src/Common/BaseCom.h
+++ b/src/Common/BaseCom.h
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp
index 6a36a60f..833a67fd 100644
--- a/src/Common/BootEncryption.cpp
+++ b/src/Common/BootEncryption.cpp
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/BootEncryption.h b/src/Common/BootEncryption.h
index 2ec92503..432d10a9 100644
--- a/src/Common/BootEncryption.h
+++ b/src/Common/BootEncryption.h
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Cache.c b/src/Common/Cache.c
index 60b2f04a..4826673e 100644
--- a/src/Common/Cache.c
+++ b/src/Common/Cache.c
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Cache.h b/src/Common/Cache.h
index cfab6f4f..f629d8b8 100644
--- a/src/Common/Cache.h
+++ b/src/Common/Cache.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Cmdline.c b/src/Common/Cmdline.c
index f34b3bfb..ff19b76a 100644
--- a/src/Common/Cmdline.c
+++ b/src/Common/Cmdline.c
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
@@ -67,5 +67,5 @@ BOOL CALLBACK CommandHelpDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
}
#if defined(TCMOUNT) && !defined(VCEXPANDER)
- StringCchCatW (tmp, 8192, L"\nExamples:\n\nMount a volume as X:\tveracrypt.exe /q /v volume.hc /l X\nDismount a volume X:\tveracrypt.exe /q /d X");
+ StringCchCatW (tmp, 8192, L"\nExamples:\n\nMount a volume as X:\tveracrypt.exe /q /v volume.hc /l X\nUnmount a volume X:\tveracrypt.exe /q /u X");
#endif
SetWindowTextW (GetDlgItem (hwndDlg, IDC_COMMANDHELP_TEXT), tmp);
diff --git a/src/Common/Cmdline.h b/src/Common/Cmdline.h
index 5e0f3509..f1e1fd59 100644
--- a/src/Common/Cmdline.h
+++ b/src/Common/Cmdline.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Combo.c b/src/Common/Combo.c
index 880f0b7a..fec4c0df 100644
--- a/src/Common/Combo.c
+++ b/src/Common/Combo.c
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Combo.h b/src/Common/Combo.h
index 604395b5..73072b96 100644
--- a/src/Common/Combo.h
+++ b/src/Common/Combo.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Common.h b/src/Common/Common.h
index 62ee3d65..88e034e2 100644
--- a/src/Common/Common.h
+++ b/src/Common/Common.h
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Crc.c b/src/Common/Crc.c
index 7e18cb4f..2cda3794 100644
--- a/src/Common/Crc.c
+++ b/src/Common/Crc.c
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Crc.h b/src/Common/Crc.h
index 53960a79..c59fc823 100644
--- a/src/Common/Crc.h
+++ b/src/Common/Crc.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Crypto.c b/src/Common/Crypto.c
index 9ae841eb..2f4e447f 100644
--- a/src/Common/Crypto.c
+++ b/src/Common/Crypto.c
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
@@ -1165,6 +1165,4 @@ BOOL IsAesHwCpuSupported ()
return state && !HwEncryptionDisabled;
-#elif defined (_M_ARM64) || defined(__arm__) || defined (__arm64__) || defined (__aarch64__)
- return 0;
#else
return (HasAESNI() && !HwEncryptionDisabled)? TRUE : FALSE;
@@ -1484,28 +1482,2 @@ void VcUnprotectKeys (PCRYPTO_INFO pCryptoInfo, uint64 encID)
#endif
-#if defined(_M_ARM64) || defined(__arm__) || defined (__arm64__) || defined (__aarch64__)
-/* dummy implementation that should never be called */
-void aes_hw_cpu_decrypt(const uint8* ks, uint8* data)
-{
- ks = ks;
- data = data;
-}
-
-void aes_hw_cpu_decrypt_32_blocks(const uint8* ks, uint8* data)
-{
- ks = ks;
- data = data;
-}
-
-void aes_hw_cpu_encrypt(const uint8* ks, uint8* data)
-{
- ks = ks;
- data = data;
-}
-
-void aes_hw_cpu_encrypt_32_blocks(const uint8* ks, uint8* data)
-{
- ks = ks;
- data = data;
-}
-#endif
diff --git a/src/Common/Crypto.h b/src/Common/Crypto.h
index 03921da3..81ec791e 100644
--- a/src/Common/Crypto.h
+++ b/src/Common/Crypto.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Dictionary.c b/src/Common/Dictionary.c
index 47dcb0a4..5915760c 100644
--- a/src/Common/Dictionary.c
+++ b/src/Common/Dictionary.c
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Dictionary.h b/src/Common/Dictionary.h
index f0be2183..972ec832 100644
--- a/src/Common/Dictionary.h
+++ b/src/Common/Dictionary.h
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 681761bf..6c98b4d7 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
@@ -312,10 +312,10 @@ static unsigned char gpbSha512CodeSignCertFingerprint[64] = {
static unsigned char gpbSha512MSCodeSignCertFingerprint[64] = {
- 0xEB, 0x76, 0x2E, 0xD3, 0x5B, 0x4A, 0xB1, 0x0E, 0xF5, 0x3B, 0x99, 0x4E,
- 0xC1, 0xF7, 0x48, 0x88, 0xF6, 0xA0, 0xE9, 0xAC, 0x32, 0x69, 0xCF, 0x20,
- 0xE1, 0x60, 0xC4, 0x0C, 0xEF, 0x01, 0x1F, 0xCB, 0x41, 0x95, 0x72, 0xB9,
- 0xED, 0x63, 0x0C, 0x6B, 0xB9, 0xE9, 0xA2, 0x72, 0xA6, 0x78, 0x96, 0x4C,
- 0x69, 0x9F, 0x90, 0x3F, 0xB1, 0x3C, 0x64, 0xF2, 0xAB, 0xCF, 0x14, 0x1D,
- 0xEC, 0x7C, 0xB0, 0xC7
+ 0x17, 0x8C, 0x1B, 0x37, 0x70, 0xBF, 0x8B, 0xDF, 0x84, 0x55, 0xC5, 0x18,
+ 0x13, 0x64, 0xE9, 0x65, 0x6D, 0x67, 0xCA, 0x0C, 0xD6, 0x3B, 0x9E, 0x7B,
+ 0x9B, 0x6A, 0x63, 0xD6, 0x19, 0xAE, 0xD7, 0xBA, 0xBE, 0x5C, 0xCB, 0xD1,
+ 0x07, 0x89, 0x07, 0xFB, 0x12, 0xC0, 0x2C, 0x94, 0x86, 0xEB, 0x67, 0x0B,
+ 0x9C, 0x97, 0xEB, 0x20, 0x38, 0x13, 0x9C, 0x0F, 0x56, 0x93, 0x1B, 0x19,
+ 0x6F, 0x8F, 0x6A, 0x39
};
@@ -869,4 +869,73 @@ BOOL TCCopyFile (wchar_t *sourceFileName, wchar_t *destinationFile)
}
+#if !defined(_WIN64) && defined(NDEBUG) && !defined (VC_SKIP_OS_DRIVER_REQ_CHECK)
+// in 32-bit build, Crypto project is not compiled so we need to provide this function here
+
+#pragma comment(lib, "bcrypt.lib")
+
+void sha512(unsigned char* result, const unsigned char* source, uint64_t sourceLen)
+{
+ BCRYPT_ALG_HANDLE hAlg = NULL;
+ BCRYPT_HASH_HANDLE hHash = NULL;
+ NTSTATUS status = 0;
+
+ // Open an algorithm provider for SHA512.
+ status = BCryptOpenAlgorithmProvider(
+ &hAlg,
+ BCRYPT_SHA512_ALGORITHM,
+ NULL,
+ 0);
+ if (!BCRYPT_SUCCESS(status))
+ {
+ goto cleanup;
+ }
+
+ // Create a hash handle.
+ status = BCryptCreateHash(
+ hAlg,
+ &hHash,
+ NULL,
+ 0,
+ NULL, // Optional secret, not needed for SHA512
+ 0,
+ 0);
+ if (!BCRYPT_SUCCESS(status))
+ {
+ goto cleanup;
+ }
+
+ // Hash the data. Note: BCryptHashData takes an ULONG for the length.
+ status = BCryptHashData(
+ hHash,
+ (PUCHAR)source,
+ (ULONG)sourceLen,
+ 0);
+ if (!BCRYPT_SUCCESS(status))
+ {
+ goto cleanup;
+ }
+
+ // Finalize the hash computation and write the result.
+ status = BCryptFinishHash(
+ hHash,
+ result,
+ SHA512_DIGESTSIZE,
+ 0);
+ if (!BCRYPT_SUCCESS(status))
+ {
+ goto cleanup;
+ }
+
+cleanup:
+ if (hHash)
+ {
+ BCryptDestroyHash(hHash);
+ }
+ if (hAlg)
+ {
+ BCryptCloseAlgorithmProvider(hAlg, 0);
+ }
+}
+#endif
BOOL VerifyModuleSignature (const wchar_t* path)
@@ -1047,5 +1116,5 @@ BOOL IsOSVersionAtLeast (OSVersionEnum reqMinOS, int reqMinServicePack)
}
-BOOL IsWin10BuildAtLeast(DWORD minBuild)
+BOOL IsWin10BuildAtLeast(int minBuild)
{
// Must first be recognized as Windows 10 or higher
@@ -2179,5 +2248,5 @@ BOOL CALLBACK AboutDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
L"Portions of this software:\r\n"
- L"Copyright \xA9 2013-2024 IDRIX. All rights reserved.\r\n"
+ L"Copyright \xA9 2013-2025 IDRIX. All rights reserved.\r\n"
L"Copyright \xA9 2003-2012 TrueCrypt Developers Association. All Rights Reserved.\r\n"
L"Copyright \xA9 1998-2000 Paul Le Roux. All Rights Reserved.\r\n"
@@ -2192,5 +2261,5 @@ BOOL CALLBACK AboutDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
L"This software as a whole:\r\n"
- L"Copyright \xA9 2013-2024 IDRIX. All rights reserved.\r\n\r\n"
+ L"Copyright \xA9 2013-2025 IDRIX. All rights reserved.\r\n\r\n"
L"An IDRIX Release");
@@ -8221,5 +8290,5 @@ int DriverUnmountVolume (HWND hwndDlg, int nDosDriveNo, BOOL forced)
unmount.ignoreOpenFiles = forced;
- bResult = DeviceIoControl (hDriver, TC_IOCTL_DISMOUNT_VOLUME, &unmount,
+ bResult = DeviceIoControl (hDriver, TC_IOCTL_UNMOUNT_VOLUME, &unmount,
sizeof (unmount), &unmount, sizeof (unmount), &dwResult, NULL);
@@ -14884,4 +14953,5 @@ void GetAppRandomSeed (unsigned char* pbRandSeed, size_t cbRandSeed)
}
+#ifndef _M_ARM64
// use RDSEED or RDRAND from CPU as source of entropy if enabled
if ( IsCpuRngEnabled() &&
@@ -14892,4 +14962,5 @@ void GetAppRandomSeed (unsigned char* pbRandSeed, size_t cbRandSeed)
WHIRLPOOL_add (digest, sizeof(digest), &tctx);
}
+#endif
WHIRLPOOL_finalize (&tctx, digest);
@@ -15983,3 +16054,3 @@ cleanup:
return result;
}
-#endif \ No newline at end of file
+#endif
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index 9ffb5c9d..aaaad97e 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
@@ -504,5 +504,5 @@ void DebugMsgBox (char *format, ...);
BOOL IsOSAtLeast (OSVersionEnum reqMinOS);
BOOL IsOSVersionAtLeast (OSVersionEnum reqMinOS, int reqMinServicePack);
-BOOL IsWin10BuildAtLeast(DWORD minBuild);
+BOOL IsWin10BuildAtLeast(int minBuild);
BOOL IsSupportedOS ();
BOOL Is64BitOs ();
diff --git a/src/Common/EncryptionThreadPool.c b/src/Common/EncryptionThreadPool.c
index 8a0c6e78..5a31bb5b 100644
--- a/src/Common/EncryptionThreadPool.c
+++ b/src/Common/EncryptionThreadPool.c
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/EncryptionThreadPool.h b/src/Common/EncryptionThreadPool.h
index 2e727a74..95583165 100644
--- a/src/Common/EncryptionThreadPool.h
+++ b/src/Common/EncryptionThreadPool.h
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Endian.c b/src/Common/Endian.c
index cea24d09..7cdda679 100644
--- a/src/Common/Endian.c
+++ b/src/Common/Endian.c
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Endian.h b/src/Common/Endian.h
index 000395f4..a0cf03b2 100644
--- a/src/Common/Endian.h
+++ b/src/Common/Endian.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Exception.h b/src/Common/Exception.h
index cb4fefc5..f52484c7 100644
--- a/src/Common/Exception.h
+++ b/src/Common/Exception.h
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Fat.c b/src/Common/Fat.c
index dec2ccee..c40084a0 100644
--- a/src/Common/Fat.c
+++ b/src/Common/Fat.c
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Fat.h b/src/Common/Fat.h
index 19b5cebb..d6757aaa 100644
--- a/src/Common/Fat.h
+++ b/src/Common/Fat.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Format.c b/src/Common/Format.c
index f1550e6b..ee766d33 100644
--- a/src/Common/Format.c
+++ b/src/Common/Format.c
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
@@ -195,5 +195,5 @@ begin_format:
if ((dev = DismountDrive (devName, volParams->volumePath)) == INVALID_HANDLE_VALUE)
{
- Error ("FORMAT_CANT_DISMOUNT_FILESYS", hwndDlg);
+ Error ("FORMAT_CANT_UNMOUNT_FILESYS", hwndDlg);
nStatus = ERR_DONT_REPORT;
goto error;
@@ -333,5 +333,5 @@ begin_format:
if (DeviceIoControl (dev, FSCTL_IS_VOLUME_MOUNTED, NULL, 0, NULL, 0, &dwResult, NULL))
{
- Error ("FORMAT_CANT_DISMOUNT_FILESYS", hwndDlg);
+ Error ("FORMAT_CANT_UNMOUNT_FILESYS", hwndDlg);
nStatus = ERR_DONT_REPORT;
goto error;
@@ -851,5 +851,5 @@ error:
{
if (!UnmountVolumeAfterFormatExCall (volParams->hwndDlg, driveNo) && !Silent)
- MessageBoxW (volParams->hwndDlg, GetString ("CANT_DISMOUNT_VOLUME"), lpszTitle, ICON_HAND);
+ MessageBoxW (volParams->hwndDlg, GetString ("CANT_UNMOUNT_VOLUME"), lpszTitle, ICON_HAND);
if (dataAreaSize <= TC_MAX_FAT_SECTOR_COUNT * FormatSectorSize)
@@ -873,5 +873,5 @@ error:
if (!UnmountVolumeAfterFormatExCall (volParams->hwndDlg, driveNo) && !Silent)
- MessageBoxW (volParams->hwndDlg, GetString ("CANT_DISMOUNT_VOLUME"), lpszTitle, ICON_HAND);
+ MessageBoxW (volParams->hwndDlg, GetString ("CANT_UNMOUNT_VOLUME"), lpszTitle, ICON_HAND);
}
diff --git a/src/Common/Format.h b/src/Common/Format.h
index 0a42e5c8..8f1166ba 100644
--- a/src/Common/Format.h
+++ b/src/Common/Format.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Keyfiles.c b/src/Common/Keyfiles.c
index b21e371d..b31e335b 100644
--- a/src/Common/Keyfiles.c
+++ b/src/Common/Keyfiles.c
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Keyfiles.h b/src/Common/Keyfiles.h
index a13666fb..e01f6bc9 100644
--- a/src/Common/Keyfiles.h
+++ b/src/Common/Keyfiles.h
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Language.c b/src/Common/Language.c
index 11c791d8..3537d747 100644
--- a/src/Common/Language.c
+++ b/src/Common/Language.c
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Language.h b/src/Common/Language.h
index 4a87ceda..f4c57dae 100644
--- a/src/Common/Language.h
+++ b/src/Common/Language.h
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Language.xml b/src/Common/Language.xml
index 9821bbe9..eac69303 100644
--- a/src/Common/Language.xml
+++ b/src/Common/Language.xml
@@ -136,6 +136,6 @@
<entry lang="en" key="IDC_FAVORITE_USE_LABEL_IN_EXPLORER">Use favorite label as Explorer drive label</entry>
<entry lang="en" key="IDC_FAV_VOL_OPTIONS_GLOBAL_SETTINGS_BOX">Global Settings</entry>
- <entry lang="en" key="IDC_HK_DISMOUNT_BALLOON_TOOLTIP">Display balloon tooltip after successful hot-key dismount</entry>
- <entry lang="en" key="IDC_HK_DISMOUNT_PLAY_SOUND">Play system notification sound after successful hot-key dismount</entry>
+ <entry lang="en" key="IDC_HK_UNMOUNT_BALLOON_TOOLTIP">Display balloon tooltip after successful hot-key unmount</entry>
+ <entry lang="en" key="IDC_HK_UNMOUNT_PLAY_SOUND">Play system notification sound after successful hot-key unmount</entry>
<entry lang="en" key="IDC_HK_MOD_ALT">Alt</entry>
<entry lang="en" key="IDC_HK_MOD_CTRL">Ctrl</entry>
@@ -157,10 +157,10 @@
<entry lang="en" key="IDC_PREF_BKG_TASK_ENABLE">Enabled</entry>
<entry lang="en" key="IDC_PREF_CACHE_PASSWORDS">Cache passwords in driver memory</entry>
- <entry lang="en" key="IDC_PREF_DISMOUNT_INACTIVE">Auto-dismount volume after no data has been read/written to it for</entry>
- <entry lang="en" key="IDC_PREF_DISMOUNT_LOGOFF">User logs off</entry>
- <entry lang="en" key="IDC_PREF_DISMOUNT_SESSION_LOCKED">User session locked</entry>
- <entry lang="en" key="IDC_PREF_DISMOUNT_POWERSAVING">Entering power saving mode</entry>
- <entry lang="en" key="IDC_PREF_DISMOUNT_SCREENSAVER">Screen saver is launched</entry>
- <entry lang="en" key="IDC_PREF_FORCE_AUTO_DISMOUNT">Force auto-dismount even if volume contains open files or directories</entry>
+ <entry lang="en" key="IDC_PREF_UNMOUNT_INACTIVE">Auto-unmount volume after no data has been read/written to it for</entry>
+ <entry lang="en" key="IDC_PREF_UNMOUNT_LOGOFF">User logs off</entry>
+ <entry lang="en" key="IDC_PREF_UNMOUNT_SESSION_LOCKED">User session locked</entry>
+ <entry lang="en" key="IDC_PREF_UNMOUNT_POWERSAVING">Entering power saving mode</entry>
+ <entry lang="en" key="IDC_PREF_UNMOUNT_SCREENSAVER">Screen saver is launched</entry>
+ <entry lang="en" key="IDC_PREF_FORCE_AUTO_UNMOUNT">Force auto-unmount even if volume contains open files or directories</entry>
<entry lang="en" key="IDC_PREF_LOGON_MOUNT_DEVICES">Mount all device-hosted VeraCrypt volumes</entry>
<entry lang="en" key="IDC_PREF_LOGON_START">Start VeraCrypt Background Task</entry>
@@ -170,5 +170,5 @@
<entry lang="en" key="IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT">Temporarily cache password during "Mount Favorite Volumes" operations</entry>
<entry lang="en" key="IDC_PREF_USE_DIFF_TRAY_ICON_IF_VOL_MOUNTED">Use a different taskbar icon when there are mounted volumes</entry>
- <entry lang="en" key="IDC_PREF_WIPE_CACHE_ON_AUTODISMOUNT">Wipe cached passwords on auto-dismount</entry>
+ <entry lang="en" key="IDC_PREF_WIPE_CACHE_ON_AUTOUNMOUNT">Wipe cached passwords on auto-unmount</entry>
<entry lang="en" key="IDC_PREF_WIPE_CACHE_ON_EXIT">Wipe cached passwords on exit</entry>
<entry lang="en" key="IDC_PRESERVE_TIMESTAMPS">Preserve modification timestamp of file containers</entry>
@@ -182,5 +182,5 @@
<entry lang="en" key="IDC_TRAV_CACHE_PASSWORDS">&amp;Cache password in driver memory</entry>
<entry lang="en" key="IDC_TRUECRYPT_MODE">&amp;TrueCrypt Mode</entry>
- <entry lang="en" key="IDC_UNMOUNTALL">Di&amp;smount All</entry>
+ <entry lang="en" key="IDC_UNMOUNTALL">&amp;Unmount All</entry>
<entry lang="en" key="IDC_VOLUME_PROPERTIES">&amp;Volume Properties...</entry>
<entry lang="en" key="IDC_VOLUME_TOOLS">Volume &amp;Tools...</entry>
@@ -256,6 +256,6 @@
<entry lang="en" key="IDM_TOKEN_PREFERENCES">Security Tokens...</entry>
<entry lang="en" key="IDM_TRAVELER">Traveler Disk Setup...</entry>
- <entry lang="en" key="IDM_UNMOUNTALL">Dismount All Mounted Volumes</entry>
- <entry lang="en" key="IDM_UNMOUNT_VOLUME">Dismount Volume</entry>
+ <entry lang="en" key="IDM_UNMOUNTALL">Unmount All Mounted Volumes</entry>
+ <entry lang="en" key="IDM_UNMOUNT_VOLUME">Unmount Volume</entry>
<entry lang="en" key="IDM_VERIFY_RESCUE_DISK">Verify Rescue Disk</entry>
<entry lang="en" key="IDM_VERIFY_RESCUE_DISK_ISO">Verify Rescue Disk Image</entry>
@@ -270,6 +270,6 @@
<entry lang="en" key="IDT_ASSIGN_HOTKEY">Shortcut</entry>
<entry lang="en" key="IDT_AUTORUN">AutoRun Configuration (autorun.inf)</entry>
- <entry lang="en" key="IDT_AUTO_DISMOUNT">Auto-Dismount</entry>
- <entry lang="en" key="IDT_AUTO_DISMOUNT_ON">Dismount all when:</entry>
+ <entry lang="en" key="IDT_AUTO_UNMOUNT">Auto-Unmount</entry>
+ <entry lang="en" key="IDT_AUTO_UNMOUNT_ON">Unmount all when:</entry>
<entry lang="en" key="IDT_BOOT_LOADER_SCREEN_OPTIONS">Boot Loader Screen Options</entry>
<entry lang="en" key="IDT_CONFIRM_PASSWORD">Confirm Password:</entry>
@@ -277,5 +277,5 @@
<entry lang="en" key="IDT_CUSTOM_BOOT_LOADER_MESSAGE">Display this custom message in the pre-boot authentication screen (24 characters maximum):</entry>
<entry lang="en" key="IDT_DEFAULT_MOUNT_OPTIONS">Default Mount Options</entry>
- <entry lang="en" key="IDT_DISMOUNT_ACTION">Hot Key Options</entry>
+ <entry lang="en" key="IDT_UNMOUNT_ACTION">Hot Key Options</entry>
<entry lang="en" key="IDT_DRIVER_OPTIONS">Driver Configuration</entry>
<entry lang="en" key="IDC_ENABLE_EXTENDED_IOCTL_SUPPORT">Enable extended disk control codes support</entry>
@@ -424,6 +424,6 @@
<entry lang="en" key="DEVICE_IN_USE_FORMAT">WARNING: The device/partition is in use by the operating system or applications. Formatting the device/partition might cause data corruption and system instability.\n\nContinue?</entry>
<entry lang="en" key="DEVICE_IN_USE_INPLACE_ENC">Warning: The partition is in use by the operating system or applications. You should close any applications that might be using the partition (including antivirus software).\n\nContinue?</entry>
- <entry lang="en" key="FORMAT_CANT_DISMOUNT_FILESYS">Error: The device/partition contains a file system that could not be dismounted. The file system may be in use by the operating system. Formatting the device/partition would very likely cause data corruption and system instability.\n\nTo solve this issue, we recommend that you first delete the partition and then recreate it without formatting. To do so, follow these steps:\n1) Right-click the 'Computer' (or 'My Computer') icon in the 'Start Menu' and select 'Manage'. The 'Computer Management' window should appear.\n2) In the 'Computer Management' window, select 'Storage' > 'Disk Management'.\n3) Right-click the partition you want to encrypt and select either 'Delete Partition', or 'Delete Volume', or 'Delete Logical Drive'.\n4) Click 'Yes'. If Windows asks you to restart the computer, do so. Then repeat the steps 1 and 2 and continue from the step 5.\n5) Right-click the unallocated/free space area and select either 'New Partition', or 'New Simple Volume', or 'New Logical Drive'.\n6) The 'New Partition Wizard' or 'New Simple Volume Wizard' window should appear now; follow its instructions. On the wizard page entitled 'Format Partition', select either 'Do not format this partition' or 'Do not format this volume'. In the same wizard, click 'Next' and then 'Finish'.\n7) Note that the device path you have selected in VeraCrypt may be wrong now. Therefore, exit the VeraCrypt Volume Creation Wizard (if it is still running) and then start it again.\n8) Try encrypting the device/partition again.\n\nIf VeraCrypt repeatedly fails to encrypt the device/partition, you may want to consider creating a file container instead.</entry>
- <entry lang="en" key="INPLACE_ENC_CANT_LOCK_OR_DISMOUNT_FILESYS">Error: The filesystem could not be locked and/or dismounted. It may be in use by the operating system or applications (for example, antivirus software). Encrypting the partition might cause data corruption and system instability.\n\nPlease close any applications that might be using the filesystem (including antivirus software) and try again. If it does not help, please follow the below steps.</entry>
+ <entry lang="en" key="FORMAT_CANT_UNMOUNT_FILESYS">Error: The device/partition contains a file system that could not be unmounted. The file system may be in use by the operating system. Formatting the device/partition would very likely cause data corruption and system instability.\n\nTo solve this issue, we recommend that you first delete the partition and then recreate it without formatting. To do so, follow these steps:\n1) Right-click the 'Computer' (or 'My Computer') icon in the 'Start Menu' and select 'Manage'. The 'Computer Management' window should appear.\n2) In the 'Computer Management' window, select 'Storage' > 'Disk Management'.\n3) Right-click the partition you want to encrypt and select either 'Delete Partition', or 'Delete Volume', or 'Delete Logical Drive'.\n4) Click 'Yes'. If Windows asks you to restart the computer, do so. Then repeat the steps 1 and 2 and continue from the step 5.\n5) Right-click the unallocated/free space area and select either 'New Partition', or 'New Simple Volume', or 'New Logical Drive'.\n6) The 'New Partition Wizard' or 'New Simple Volume Wizard' window should appear now; follow its instructions. On the wizard page entitled 'Format Partition', select either 'Do not format this partition' or 'Do not format this volume'. In the same wizard, click 'Next' and then 'Finish'.\n7) Note that the device path you have selected in VeraCrypt may be wrong now. Therefore, exit the VeraCrypt Volume Creation Wizard (if it is still running) and then start it again.\n8) Try encrypting the device/partition again.\n\nIf VeraCrypt repeatedly fails to encrypt the device/partition, you may want to consider creating a file container instead.</entry>
+ <entry lang="en" key="INPLACE_ENC_CANT_LOCK_OR_UNMOUNT_FILESYS">Error: The filesystem could not be locked and/or unmounted. It may be in use by the operating system or applications (for example, antivirus software). Encrypting the partition might cause data corruption and system instability.\n\nPlease close any applications that might be using the filesystem (including antivirus software) and try again. If it does not help, please follow the below steps.</entry>
<entry lang="en" key="DEVICE_IN_USE_INFO">WARNING: Some of the mounted devices/partitions were already in use!\n\nIgnoring this can cause undesired results including system instability.\n\nWe strongly recommend that you close any application that might be using the devices/partitions.</entry>
<entry lang="en" key="DEVICE_PARTITIONS_ERR">The selected device contains partitions.\n\nFormatting the device might cause system instability and/or data corruption. Please either select a partition on the device, or remove all partitions on the device to enable VeraCrypt to format it safely.</entry>
@@ -526,6 +526,6 @@
<entry lang="en" key="HIDVOL_FORMAT_FINISHED_HELP">The hidden VeraCrypt volume has been successfully created and is ready for use. If all the instructions have been followed and if the precautions and requirements listed in the section "Security Requirements and Precautions Pertaining to Hidden Volumes" in the VeraCrypt User's Guide are followed, it should be impossible to prove that the hidden volume exists, even when the outer volume is mounted.\n\nWARNING: IF YOU DO NOT PROTECT THE HIDDEN VOLUME (FOR INFORMATION ON HOW TO DO SO, REFER TO THE SECTION "PROTECTION OF HIDDEN VOLUMES AGAINST DAMAGE" IN THE VERACRYPT USER'S GUIDE), DO NOT WRITE TO THE OUTER VOLUME. OTHERWISE, YOU MAY OVERWRITE AND DAMAGE THE HIDDEN VOLUME!</entry>
<entry lang="en" key="FIRST_HIDDEN_OS_BOOT_INFO">You have started the hidden operating system. As you may have noticed, the hidden operating system appears to be installed on the same partition as the original operating system. However, in reality, it is installed within the partition behind it (in the hidden volume). All read and write operations are being transparently redirected from the original system partition to the hidden volume.\n\nNeither the operating system nor applications will know that data written to and read from the system partition are actually written to and read from the partition behind it (from/to a hidden volume). Any such data is encrypted and decrypted on the fly as usual (with an encryption key different from the one that will be used for the decoy operating system).\n\n\nPlease click Next to continue.</entry>
- <entry lang="en" key="HIDVOL_HOST_FILLING_HELP_SYSENC">The outer volume has been created and mounted as drive %hc:. To this outer volume you should now copy some sensitive-looking files that you actually do NOT want to hide. They will be there for anyone forcing you to disclose the password for the first partition behind the system partition, where both the outer volume and the hidden volume (containing the hidden operating system) will reside. You will be able to reveal the password for this outer volume, and the existence of the hidden volume (and of the hidden operating system) will remain secret.\n\nIMPORTANT: The files you copy to the outer volume should not occupy more than %s. Otherwise, there may not be enough free space on the outer volume for the hidden volume (and you will not be able to continue). After you finish copying, click Next (do not dismount the volume).</entry>
- <entry lang="en" key="HIDVOL_HOST_FILLING_HELP">Outer volume has been successfully created and mounted as drive %hc:. To this volume you should now copy some sensitive-looking files that you actually do NOT want to hide. The files will be there for anyone forcing you to disclose your password. You will reveal only the password for this outer volume, not for the hidden one. The files that you really care about will be stored in the hidden volume, which will be created later on. When you finish copying, click Next. Do not dismount the volume.\n\nNote: After you click Next, cluster bitmap of the outer volume will be scanned to determine the size of uninterrupted area of free space whose end is aligned with the end of the volume. This area will accommodate the hidden volume, so it will limit its maximum possible size. Cluster bitmap scanning ensures that no data on the outer volume are overwritten by the hidden volume.</entry>
+ <entry lang="en" key="HIDVOL_HOST_FILLING_HELP_SYSENC">The outer volume has been created and mounted as drive %hc:. To this outer volume you should now copy some sensitive-looking files that you actually do NOT want to hide. They will be there for anyone forcing you to disclose the password for the first partition behind the system partition, where both the outer volume and the hidden volume (containing the hidden operating system) will reside. You will be able to reveal the password for this outer volume, and the existence of the hidden volume (and of the hidden operating system) will remain secret.\n\nIMPORTANT: The files you copy to the outer volume should not occupy more than %s. Otherwise, there may not be enough free space on the outer volume for the hidden volume (and you will not be able to continue). After you finish copying, click Next (do not unmount the volume).</entry>
+ <entry lang="en" key="HIDVOL_HOST_FILLING_HELP">Outer volume has been successfully created and mounted as drive %hc:. To this volume you should now copy some sensitive-looking files that you actually do NOT want to hide. The files will be there for anyone forcing you to disclose your password. You will reveal only the password for this outer volume, not for the hidden one. The files that you really care about will be stored in the hidden volume, which will be created later on. When you finish copying, click Next. Do not unmount the volume.\n\nNote: After you click Next, cluster bitmap of the outer volume will be scanned to determine the size of uninterrupted area of free space whose end is aligned with the end of the volume. This area will accommodate the hidden volume, so it will limit its maximum possible size. Cluster bitmap scanning ensures that no data on the outer volume are overwritten by the hidden volume.</entry>
<entry lang="en" key="HIDVOL_HOST_FILLING_TITLE">Outer Volume Contents</entry>
<entry lang="en" key="HIDVOL_HOST_PRE_CIPHER_HELP">\n\nIn the next steps, you will set the options for the outer volume (within which the hidden volume will be created later on).</entry>
@@ -536,7 +536,7 @@
<entry lang="en" key="HIDVOL_PRE_CIPHER_HELP">\n\nThe volume cluster bitmap has been scanned and the maximum possible size of the hidden volume has been determined. In the next steps you will set the options, the size, and the password for the hidden volume.</entry>
<entry lang="en" key="HIDVOL_PRE_CIPHER_TITLE">Hidden Volume</entry>
- <entry lang="en" key="HIDVOL_PROT_WARN_AFTER_MOUNT">The hidden volume is now protected against damage until the outer volume is dismounted.\n\nWARNING: If any data is attempted to be saved to the hidden volume area, VeraCrypt will start write-protecting the entire volume (both the outer and the hidden part) until it is dismounted. This may cause filesystem corruption on the outer volume, which (if repeated) might adversely affect plausible deniability of the hidden volume. Therefore, you should make every effort to avoid writing to the hidden volume area. Any data being saved to the hidden volume area will not be saved and will be lost. Windows may report this as a write error ("Delayed Write Failed" or "The parameter is incorrect").</entry>
- <entry lang="en" key="HIDVOL_PROT_WARN_AFTER_MOUNT_PLURAL">Each of the hidden volumes within the newly mounted volumes is now protected against damage until dismounted.\n\nWARNING: If any data is attempted to be saved to protected hidden volume area of any of these volumes, VeraCrypt will start write-protecting the entire volume (both the outer and the hidden part) until it is dismounted. This may cause filesystem corruption on the outer volume, which (if repeated) might adversely affect plausible deniability of the hidden volume. Therefore, you should make every effort to avoid writing to the hidden volume area. Any data being saved to protected hidden volume areas will not be saved and will be lost. Windows may report this as a write error ("Delayed Write Failed" or "The parameter is incorrect").</entry>
- <entry lang="en" key="DAMAGE_TO_HIDDEN_VOLUME_PREVENTED">WARNING: Data were attempted to be saved to the hidden volume area of the volume mounted as %c:! VeraCrypt prevented these data from being saved in order to protect the hidden volume. This may have caused filesystem corruption on the outer volume and Windows may have reported a write error ("Delayed Write Failed" or "The parameter is incorrect"). The entire volume (both the outer and the hidden part) will be write-protected until it is dismounted. If this is not the first time VeraCrypt has prevented data from being saved to the hidden volume area of this volume, plausible deniability of this hidden volume might be adversely affected (due to possible unusual correlated inconsistencies within the outer volume file system). Therefore, you should consider creating a new VeraCrypt volume (with Quick Format disabled) and moving files from this volume to the new volume; this volume should be securely erased (both the outer and the hidden part). We strongly recommend that you restart the operating system now.</entry>
+ <entry lang="en" key="HIDVOL_PROT_WARN_AFTER_MOUNT">The hidden volume is now protected against damage until the outer volume is unmounted.\n\nWARNING: If any data is attempted to be saved to the hidden volume area, VeraCrypt will start write-protecting the entire volume (both the outer and the hidden part) until it is unmounted. This may cause filesystem corruption on the outer volume, which (if repeated) might adversely affect plausible deniability of the hidden volume. Therefore, you should make every effort to avoid writing to the hidden volume area. Any data being saved to the hidden volume area will not be saved and will be lost. Windows may report this as a write error ("Delayed Write Failed" or "The parameter is incorrect").</entry>
+ <entry lang="en" key="HIDVOL_PROT_WARN_AFTER_MOUNT_PLURAL">Each of the hidden volumes within the newly mounted volumes is now protected against damage until unmounted.\n\nWARNING: If any data is attempted to be saved to protected hidden volume area of any of these volumes, VeraCrypt will start write-protecting the entire volume (both the outer and the hidden part) until it is unmounted. This may cause filesystem corruption on the outer volume, which (if repeated) might adversely affect plausible deniability of the hidden volume. Therefore, you should make every effort to avoid writing to the hidden volume area. Any data being saved to protected hidden volume areas will not be saved and will be lost. Windows may report this as a write error ("Delayed Write Failed" or "The parameter is incorrect").</entry>
+ <entry lang="en" key="DAMAGE_TO_HIDDEN_VOLUME_PREVENTED">WARNING: Data were attempted to be saved to the hidden volume area of the volume mounted as %c:! VeraCrypt prevented these data from being saved in order to protect the hidden volume. This may have caused filesystem corruption on the outer volume and Windows may have reported a write error ("Delayed Write Failed" or "The parameter is incorrect"). The entire volume (both the outer and the hidden part) will be write-protected until it is unmounted. If this is not the first time VeraCrypt has prevented data from being saved to the hidden volume area of this volume, plausible deniability of this hidden volume might be adversely affected (due to possible unusual correlated inconsistencies within the outer volume file system). Therefore, you should consider creating a new VeraCrypt volume (with Quick Format disabled) and moving files from this volume to the new volume; this volume should be securely erased (both the outer and the hidden part). We strongly recommend that you restart the operating system now.</entry>
<entry lang="en" key="CANNOT_SATISFY_OVER_4G_FILE_SIZE_REQ">You have indicated intent to store files larger than 4 GiB on the volume. This requires the volume to be formatted as NTFS/exFAT/ReFS, which, however, will not be possible.</entry>
<entry lang="en" key="CANNOT_CREATE_NON_HIDDEN_NTFS_VOLUMES_UNDER_HIDDEN_OS">Please note that when a hidden operating system is running, non-hidden VeraCrypt volumes cannot be formatted as NTFS/exFAT/ReFS. The reason is that the volume would need to be temporarily mounted without write protection in order to allow the operating system to format it as NTFS (whereas formatting as FAT is performed by VeraCrypt, not by the operating system, and without mounting the volume). For further technical details, see below. You can create a non-hidden NTFS/exFAT/ReFS volume from within the decoy operating system.</entry>
@@ -567,6 +567,6 @@
<entry lang="en" key="MAX_HIDVOL_SIZE_GB">Maximum possible hidden volume size for this volume is %.2f GiB.</entry>
<entry lang="en" key="MAX_HIDVOL_SIZE_TB">Maximum possible hidden volume size for this volume is %.2f TiB.</entry>
- <entry lang="en" key="MOUNTED_NOPWCHANGE">Volume password/keyfiles cannot be changed while the volume is mounted. Please dismount the volume first.</entry>
- <entry lang="en" key="MOUNTED_NO_PKCS5_PRF_CHANGE">The header key derivation algorithm cannot be changed while the volume is mounted. Please dismount the volume first.</entry>
+ <entry lang="en" key="MOUNTED_NOPWCHANGE">Volume password/keyfiles cannot be changed while the volume is mounted. Please unmount the volume first.</entry>
+ <entry lang="en" key="MOUNTED_NO_PKCS5_PRF_CHANGE">The header key derivation algorithm cannot be changed while the volume is mounted. Please unmount the volume first.</entry>
<entry lang="en" key="MOUNT_BUTTON">&amp;Mount</entry>
<entry lang="en" key="NEW_VERSION_REQUIRED">A newer version of VeraCrypt is required to mount this volume.</entry>
@@ -589,7 +589,7 @@
<entry lang="en" key="NO_SPACE_FOR_HIDDEN_VOL">Not enough free space for the hidden volume! Volume creation cannot continue.</entry>
<entry lang="en" key="HIDDEN_VOLUME_TOO_SMALL_FOR_OS_CLONE">Error: The files you copied to the outer volume occupy too much space. Therefore, there is not enough free space on the outer volume for the hidden volume.\n\nNote that the hidden volume must be as large as the system partition (the partition where the currently running operating system is installed). The reason is that the hidden operating system needs to be created by copying the content of the system partition to the hidden volume.\n\n\nThe process of creation of the hidden operating system cannot continue.</entry>
- <entry lang="en" key="OPENFILES_DRIVER">The driver is unable to dismount the volume. Some files located on the volume are probably still open.</entry>
- <entry lang="en" key="OPENFILES_LOCK">Unable to lock the volume. There are still open files on the volume. Therefore, it cannot be dismounted.</entry>
- <entry lang="en" key="VOL_LOCK_FAILED_OFFER_FORCED_DISMOUNT">VeraCrypt cannot lock the volume because it is in use by the system or applications (there may be open files on the volume).\n\nDo you want to force dismount on the volume?</entry>
+ <entry lang="en" key="OPENFILES_DRIVER">The driver is unable to unmount the volume. Some files located on the volume are probably still open.</entry>
+ <entry lang="en" key="OPENFILES_LOCK">Unable to lock the volume. There are still open files on the volume. Therefore, it cannot be unmounted.</entry>
+ <entry lang="en" key="VOL_LOCK_FAILED_OFFER_FORCED_UNMOUNT">VeraCrypt cannot lock the volume because it is in use by the system or applications (there may be open files on the volume).\n\nDo you want to force unmount on the volume?</entry>
<entry lang="en" key="OPEN_VOL_TITLE">Select a VeraCrypt Volume</entry>
<entry lang="en" key="OPEN_TITLE">Specify Path and File Name</entry>
@@ -695,8 +695,8 @@
<entry lang="en" key="UNKNOWN">Unknown</entry>
<entry lang="en" key="ERR_UNKNOWN">An unspecified or unknown error occurred (%d).</entry>
- <entry lang="en" key="UNMOUNTALL_LOCK_FAILED">Some volumes contain files or folders being used by applications or system.\n\nForce dismount?</entry>
- <entry lang="en" key="UNMOUNT_BUTTON">&amp;Dismount</entry>
- <entry lang="en" key="UNMOUNT_FAILED">Dismount failed!</entry>
- <entry lang="en" key="UNMOUNT_LOCK_FAILED">Volume contains files or folders being used by applications or system.\n\nForce dismount?</entry>
+ <entry lang="en" key="UNMOUNTALL_LOCK_FAILED">Some volumes contain files or folders being used by applications or system.\n\nForce unmount?</entry>
+ <entry lang="en" key="UNMOUNT_BUTTON">&amp;Unmount</entry>
+ <entry lang="en" key="UNMOUNT_FAILED">Unmount failed!</entry>
+ <entry lang="en" key="UNMOUNT_LOCK_FAILED">Volume contains files or folders being used by applications or system.\n\nForce unmount?</entry>
<entry lang="en" key="NO_VOLUME_MOUNTED_TO_DRIVE">No volume is mounted to the specified drive letter.</entry>
<entry lang="en" key="VOL_ALREADY_MOUNTED">The volume you are trying to mount is already mounted. </entry>
@@ -730,5 +730,5 @@
<entry lang="en" key="FORMAT_NTFS_STOP">NTFS/exFAT/ReFS formatting cannot continue.</entry>
<entry lang="en" key="CANT_MOUNT_VOLUME">Cannot mount volume.</entry>
- <entry lang="en" key="CANT_DISMOUNT_VOLUME">Cannot dismount volume.</entry>
+ <entry lang="en" key="CANT_UNMOUNT_VOLUME">Cannot unmount volume.</entry>
<entry lang="en" key="FORMAT_NTFS_FAILED">Windows failed to format the volume as NTFS/exFAT/ReFS.\n\nPlease select a different type of file system (if possible) and try again. Alternatively, you could leave the volume unformatted (select 'None' as the filesystem), exit this wizard, mount the volume, and then use either a system or a third-party tool to format the mounted volume (the volume will remain encrypted).</entry>
<entry lang="en" key="FORMAT_NTFS_FAILED_ASK_FAT">Windows failed to format the volume as NTFS/exFAT/ReFS.\n\nDo you want to format the volume as FAT instead?</entry>
@@ -772,5 +772,5 @@
<entry lang="en" key="INPLACE_ENC_GENERIC_ERR_RESUME">An error prevented VeraCrypt from resuming the process of encryption/decryption of the partition/volume.\n\nPlease try fixing any previously reported problems and then try resuming the process again if possible. Note that the volume cannot be mounted until it has been fully encrypted or fully decrypted.</entry>
<entry lang="en" key="INPLACE_DEC_GENERIC_ERR">An error prevented VeraCrypt from decrypting the volume. Please try fixing any previously reported problems and then try again if possible.</entry>
- <entry lang="en" key="CANT_DISMOUNT_OUTER_VOL">Error: Cannot dismount the outer volume!\n\nVolume cannot be dismounted if it contains files or folders being used by a program or the system.\n\nPlease close any program that might be using files or directories on the volume and click Retry.</entry>
+ <entry lang="en" key="CANT_UNMOUNT_OUTER_VOL">Error: Cannot unmount the outer volume!\n\nVolume cannot be unmounted if it contains files or folders being used by a program or the system.\n\nPlease close any program that might be using files or directories on the volume and click Retry.</entry>
<entry lang="en" key="CANT_GET_OUTER_VOL_INFO">Error: Cannot obtain information about the outer volume!\nVolume creation cannot continue.</entry>
<entry lang="en" key="CANT_ACCESS_OUTER_VOL">Error: Cannot access the outer volume! Volume creation cannot continue.</entry>
@@ -883,5 +883,5 @@
<entry lang="en" key="CANT_CREATE_FOLDER">The folder '%s' could not be created</entry>
<entry lang="en" key="CLOSE_TC_FIRST">The VeraCrypt device driver cannot be unloaded.\n\nPlease close all open VeraCrypt windows first. If it does not help, please restart Windows and then try again.</entry>
- <entry lang="en" key="DISMOUNT_ALL_FIRST">All VeraCrypt volumes must be dismounted before installing or uninstalling VeraCrypt.</entry>
+ <entry lang="en" key="UNMOUNT_ALL_FIRST">All VeraCrypt volumes must be unmounted before installing or uninstalling VeraCrypt.</entry>
<entry lang="en" key="UNINSTALL_OLD_VERSION_FIRST">An obsolete version of VeraCrypt is currently installed on this system. It needs to be uninstalled before you can install this new version of VeraCrypt.\n\nAs soon as you close this message box, the uninstaller of the old version will be launched. Note that no volume will be decrypted when you uninstall VeraCrypt. After you uninstall the old version of VeraCrypt, run the installer of the new version of VeraCrypt again.</entry>
<entry lang="en" key="REG_INSTALL_FAILED">The installation of the registry entries has failed</entry>
@@ -904,5 +904,5 @@
<entry lang="en" key="SECONDS">s</entry>
<entry lang="en" key="OPEN">Open</entry>
- <entry lang="en" key="DISMOUNT">Dismount</entry>
+ <entry lang="en" key="UNMOUNT">Unmount</entry>
<entry lang="en" key="SHOW_TC">Show VeraCrypt</entry>
<entry lang="en" key="HIDE_TC">Hide VeraCrypt</entry>
@@ -976,5 +976,5 @@
<entry lang="en" key="SYS_FAVORITES_HELP_LINK">What are system favorite volumes?</entry>
<entry lang="en" key="SYS_FAVORITES_REQUIRE_PBA">The system partition/drive does not appear to be encrypted.\n\nSystem favorite volumes can be mounted using only a pre-boot authentication password. Therefore, to enable use of system favorite volumes, you need to encrypt the system partition/drive first.</entry>
- <entry lang="en" key="DISMOUNT_FIRST">Please dismount the volume before proceeding.</entry>
+ <entry lang="en" key="UNMOUNT_FIRST">Please unmount the volume before proceeding.</entry>
<entry lang="en" key="CANNOT_SET_TIMER">Error: Cannot set timer.</entry>
<entry lang="en" key="IDPM_CHECK_FILESYS">Check Filesystem</entry>
@@ -998,5 +998,5 @@
<entry lang="en" key="UNSUPPORTED_CHARS_IN_PWD_RECOM">Warning: Password contains non-ASCII characters. This may cause the volume to be impossible to mount when your system configuration changes.\n\nYou should replace all non-ASCII characters in the password with ASCII characters. To do so, click 'Volumes' -&gt; 'Change Volume Password'.\n\nThe following are ASCII characters:\n\n ! " # $ % &amp; ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; &lt; = &gt; ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \\ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~</entry>
<entry lang="en" key="EXE_FILE_EXTENSION_CONFIRM">WARNING: We strongly recommend that you avoid file extensions that are used for executable files (such as .exe, .sys, or .dll) and other similarly problematic file extensions. Using such file extensions causes Windows and antivirus software to interfere with the container, which adversely affects the performance of the volume and may also cause other serious problems.\n\nWe strongly recommend that you remove the file extension or change it (e.g., to '.hc').\n\nAre you sure you want to use the problematic file extension?</entry>
- <entry lang="en" key="EXE_FILE_EXTENSION_MOUNT_WARNING">WARNING: This container has a file extension that is used for executable files (such as .exe, .sys, or .dll) or some other file extension that is similarly problematic. It will very likely cause Windows and antivirus software to interfere with the container, which will adversely affect the performance of the volume and may also cause other serious problems.\n\nWe strongly recommend that you remove the file extension of the container or change it (e.g., to '.hc') after you dismount the volume.</entry>
+ <entry lang="en" key="EXE_FILE_EXTENSION_MOUNT_WARNING">WARNING: This container has a file extension that is used for executable files (such as .exe, .sys, or .dll) or some other file extension that is similarly problematic. It will very likely cause Windows and antivirus software to interfere with the container, which will adversely affect the performance of the volume and may also cause other serious problems.\n\nWe strongly recommend that you remove the file extension of the container or change it (e.g., to '.hc') after you unmount the volume.</entry>
<entry lang="en" key="HOMEPAGE">Homepage</entry>
<entry lang="en" key="LARGE_IDE_WARNING_XP">WARNING: It appears that you have not applied any Service Pack to your Windows installation. You should not write to IDE disks larger than 128 GiB under Windows XP to which you did not apply Service Pack 1 or later! If you do, data on the disk (no matter if it is a VeraCrypt volume or not) may get corrupted. Note that this is a limitation of Windows, not a bug in VeraCrypt.</entry>
@@ -1007,12 +1007,12 @@
<entry lang="en" key="FREE_SPACE_FOR_WRITING_TO_OUTER_VOLUME">WARNING: If you want to be able to add more data/files to the outer volume in future, you should consider choosing a smaller size for the hidden volume.\n\nAre you sure you want to continue with the size you specified?</entry>
<entry lang="en" key="NO_VOLUME_SELECTED">No volume selected.\n\nClick 'Select Device' or 'Select File' to select a VeraCrypt volume.</entry>
- <entry lang="en" key="NO_SYSENC_PARTITION_SELECTED">No partition selected.\n\nClick 'Select Device' to select a dismounted partition that normally requires pre-boot authentication (for example, a partition located on the encrypted system drive of another operating system, which is not running, or the encrypted system partition of another operating system).\n\nNote: The selected partition will be mounted as a regular VeraCrypt volume without pre-boot authentication. This is useful e.g. for backup or repair operations.</entry>
+ <entry lang="en" key="NO_SYSENC_PARTITION_SELECTED">No partition selected.\n\nClick 'Select Device' to select a unmounted partition that normally requires pre-boot authentication (for example, a partition located on the encrypted system drive of another operating system, which is not running, or the encrypted system partition of another operating system).\n\nNote: The selected partition will be mounted as a regular VeraCrypt volume without pre-boot authentication. This is useful e.g. for backup or repair operations.</entry>
<entry lang="en" key="CONFIRM_SAVE_DEFAULT_KEYFILES">WARNING: If default keyfiles are set and enabled, volumes that are not using these keyfiles will be impossible to mount. Therefore, after you enable default keyfiles, keep in mind to uncheck the 'Use keyfiles' checkbox (below a password input field) whenever mounting such volumes.\n\nAre you sure you want to save the selected keyfiles/paths as default?</entry>
<entry lang="en" key="HK_AUTOMOUNT_DEVICES">Auto-Mount Devices</entry>
- <entry lang="en" key="HK_DISMOUNT_ALL">Dismount All</entry>
+ <entry lang="en" key="HK_UNMOUNT_ALL">Unmount All</entry>
<entry lang="en" key="HK_WIPE_CACHE">Wipe Cache</entry>
- <entry lang="en" key="HK_DISMOUNT_ALL_AND_WIPE">Dismount All &amp; Wipe Cache</entry>
- <entry lang="en" key="HK_FORCE_DISMOUNT_ALL_AND_WIPE">Force Dismount All &amp; Wipe Cache</entry>
- <entry lang="en" key="HK_FORCE_DISMOUNT_ALL_AND_WIPE_AND_EXIT">Force Dismount All, Wipe Cache &amp; Exit</entry>
+ <entry lang="en" key="HK_UNMOUNT_ALL_AND_WIPE">Unmount All &amp; Wipe Cache</entry>
+ <entry lang="en" key="HK_FORCE_UNMOUNT_ALL_AND_WIPE">Force Unmount All &amp; Wipe Cache</entry>
+ <entry lang="en" key="HK_FORCE_UNMOUNT_ALL_AND_WIPE_AND_EXIT">Force Unmount All, Wipe Cache &amp; Exit</entry>
<entry lang="en" key="HK_MOUNT_FAVORITE_VOLUMES">Mount Favorite Volumes</entry>
<entry lang="en" key="HK_SHOW_HIDE_MAIN_WINDOW">Show/Hide Main VeraCrypt Window</entry>
@@ -1026,12 +1026,12 @@
<entry lang="en" key="SYS_ENC_HIBERNATION_PREVENTED">An error or incompatibility prevents VeraCrypt from encrypting the hibernation file. Therefore, hibernation has been prevented.\n\nNote: When a computer hibernates (or enters a power-saving mode), the content of its system memory is written to a hibernation storage file residing on the system drive. VeraCrypt would not be able to prevent encryption keys and the contents of sensitive files opened in RAM from being saved unencrypted to the hibernation storage file.</entry>
<entry lang="en" key="HIDDEN_OS_HIBERNATION_PREVENTED">Hibernation has been prevented.\n\nVeraCrypt does not support hibernation on hidden operating systems that use an extra boot partition. Please note that the boot partition is shared by both the decoy and the hidden system. Therefore, in order to prevent data leaks and problems while resuming from hibernation, VeraCrypt has to prevent the hidden system from writing to the shared boot partition and from hibernating.</entry>
- <entry lang="en" key="VOLUME_MOUNTED_AS_DRIVE_LETTER_X_DISMOUNTED">VeraCrypt volume mounted as %c: has been dismounted.</entry>
- <entry lang="en" key="MOUNTED_VOLUMES_DISMOUNTED">VeraCrypt volumes have been dismounted.</entry>
- <entry lang="en" key="VOLUMES_DISMOUNTED_CACHE_WIPED">VeraCrypt volumes have been dismounted and password cache has been wiped.</entry>
- <entry lang="en" key="SUCCESSFULLY_DISMOUNTED">Successfully dismounted</entry>
- <entry lang="en" key="CONFIRM_BACKGROUND_TASK_DISABLED">WARNING: If the VeraCrypt Background Task is disabled, the following functions will be disabled:\n\n1) Hot keys\n2) Auto-dismount (e.g., upon logoff, inadvertent host device removal, time-out, etc.)\n3) Auto-mount of favorite volumes\n4) Notifications (e.g., when damage to hidden volume is prevented)\n5) Tray icon\n\nNote: You can shut down the Background Task anytime by right-clicking the VeraCrypt tray icon and selecting 'Exit'.\n\nAre you sure you want to permanently disable the VeraCrypt Background Task?</entry>
- <entry lang="en" key="CONFIRM_NO_FORCED_AUTODISMOUNT">WARNING: If this option is disabled, volumes containing open files/directories will not be possible to auto-dismount.\n\nAre you sure you want to disable this option?</entry>
- <entry lang="en" key="WARN_PREF_AUTO_DISMOUNT">WARNING: Volumes containing open files/directories will NOT be auto-dismounted.\n\nTo prevent this, enable the following option in this dialog window: 'Force auto-dismount even if volume contains open files or directories'</entry>
- <entry lang="en" key="WARN_PREF_AUTO_DISMOUNT_ON_POWER">WARNING: When the notebook battery power is low, Windows may omit sending the appropriate messages to running applications when the computer is entering power saving mode. Therefore, VeraCrypt may fail to auto-dismount volumes in such cases.</entry>
+ <entry lang="en" key="VOLUME_MOUNTED_AS_DRIVE_LETTER_X_UNMOUNTED">VeraCrypt volume mounted as %c: has been unmounted.</entry>
+ <entry lang="en" key="MOUNTED_VOLUMES_UNMOUNTED">VeraCrypt volumes have been unmounted.</entry>
+ <entry lang="en" key="VOLUMES_UNMOUNTED_CACHE_WIPED">VeraCrypt volumes have been unmounted and password cache has been wiped.</entry>
+ <entry lang="en" key="SUCCESSFULLY_UNMOUNTED">Successfully unmounted</entry>
+ <entry lang="en" key="CONFIRM_BACKGROUND_TASK_DISABLED">WARNING: If the VeraCrypt Background Task is disabled, the following functions will be disabled:\n\n1) Hot keys\n2) Auto-unmount (e.g., upon logoff, inadvertent host device removal, time-out, etc.)\n3) Auto-mount of favorite volumes\n4) Notifications (e.g., when damage to hidden volume is prevented)\n5) Tray icon\n\nNote: You can shut down the Background Task anytime by right-clicking the VeraCrypt tray icon and selecting 'Exit'.\n\nAre you sure you want to permanently disable the VeraCrypt Background Task?</entry>
+ <entry lang="en" key="CONFIRM_NO_FORCED_AUTOUNMOUNT">WARNING: If this option is disabled, volumes containing open files/directories will not be possible to auto-unmount.\n\nAre you sure you want to disable this option?</entry>
+ <entry lang="en" key="WARN_PREF_AUTO_UNMOUNT">WARNING: Volumes containing open files/directories will NOT be auto-unmounted.\n\nTo prevent this, enable the following option in this dialog window: 'Force auto-unmount even if volume contains open files or directories'</entry>
+ <entry lang="en" key="WARN_PREF_AUTO_UNMOUNT_ON_POWER">WARNING: When the notebook battery power is low, Windows may omit sending the appropriate messages to running applications when the computer is entering power saving mode. Therefore, VeraCrypt may fail to auto-unmount volumes in such cases.</entry>
<entry lang="en" key="NONSYS_INPLACE_ENC_RESUME_PROMPT">You have scheduled the process of encryption/decryption of a partition/volume. The process has not been completed yet.\n\nDo you want to resume the process now?</entry>
<entry lang="en" key="SYSTEM_ENCRYPTION_RESUME_PROMPT">You have scheduled the process of encryption or decryption of the system partition/drive. The process has not been completed yet.\n\nDo you want to start (resume) the process now?</entry>
@@ -1041,5 +1041,5 @@
<entry lang="en" key="NONSYS_INPLACE_ENC_NOTIFICATION_REMOVAL_NOTE">IMPORTANT: Keep in mind that you can resume the process of encryption/decryption of any non-system partition/volume by selecting 'Volumes' &gt; 'Resume Interrupted Process' from the menu bar of the main VeraCrypt window.</entry>
<entry lang="en" key="SYSTEM_ENCRYPTION_SCHEDULED_BUT_PBA_FAILED">You have scheduled the process of encryption or decryption of the system partition/drive. However, pre-boot authentication failed (or was bypassed).\n\nNote: If you decrypted the system partition/drive in the pre-boot environment, you may need to finalize the process by selecting 'System' &gt; 'Permanently Decrypt System Partition/Drive' from the menu bar of the main VeraCrypt window.</entry>
- <entry lang="en" key="CONFIRM_EXIT">WARNING: If VeraCrypt exits now, the following functions will be disabled:\n\n1) Hot keys\n2) Auto-dismount (e.g., upon logoff, inadvertent host device removal, time-out, etc.)\n3) Auto-mount of favorite volumes\n4) Notifications (e.g., when damage to hidden volume is prevented)\n\nNote: If you do not wish VeraCrypt to run in the background, disable the VeraCrypt Background Task in the Preferences (and, if necessary, disable the automatic start of VeraCrypt in the Preferences).\n\nAre you sure you want VeraCrypt to exit?</entry>
+ <entry lang="en" key="CONFIRM_EXIT">WARNING: If VeraCrypt exits now, the following functions will be disabled:\n\n1) Hot keys\n2) Auto-unmount (e.g., upon logoff, inadvertent host device removal, time-out, etc.)\n3) Auto-mount of favorite volumes\n4) Notifications (e.g., when damage to hidden volume is prevented)\n\nNote: If you do not wish VeraCrypt to run in the background, disable the VeraCrypt Background Task in the Preferences (and, if necessary, disable the automatic start of VeraCrypt in the Preferences).\n\nAre you sure you want VeraCrypt to exit?</entry>
<entry lang="en" key="CONFIRM_EXIT_UNIVERSAL">Exit?</entry>
<entry lang="en" key="CHOOSE_ENCRYPT_OR_DECRYPT">VeraCrypt does not have sufficient information to determine whether to encrypt or decrypt.</entry>
@@ -1064,5 +1064,5 @@
<entry lang="en" key="SYS_ASSIGN_DRIVE_LETTER">Please assign a drive letter to the partition/device before proceeding ('Control Panel' > 'System and Maintenance' > 'Administrative Tools' - 'Create and format hard disk partitions').\n\nNote that this is a requirement of the operating system.</entry>
<entry lang="en" key="MOUNT_TC_VOLUME">Mount VeraCrypt volume</entry>
- <entry lang="en" key="DISMOUNT_ALL_TC_VOLUMES">Dismount all VeraCrypt volumes</entry>
+ <entry lang="en" key="UNMOUNT_ALL_TC_VOLUMES">Unmount all VeraCrypt volumes</entry>
<entry lang="en" key="UAC_INIT_ERROR">VeraCrypt failed to obtain Administrator privileges.</entry>
<entry lang="en" key="ERR_ACCESS_DENIED">Access was denied by the operating system.\n\nPossible cause: The operating system requires that you have read/write permission (or administrator privileges) for certain folders, files, and devices, in order for you to be allowed to read and write data to/from them. Normally, a user without administrator privileges is allowed to create, read and modify files in his or her Documents folder.</entry>
@@ -1286,6 +1286,6 @@
<entry lang="en" key="BOOT_PASSWORD_CACHE_KEYBOARD_WARNING">IMPORTANT: Please note that pre-boot authentication passwords are always typed using the standard US keyboard layout. Therefore, a volume that uses a password typed using any other keyboard layout may be impossible to mount using a pre-boot authentication password (note that this is not a bug in VeraCrypt). To allow such a volume to be mounted using a pre-boot authentication password, follow these steps:\n\n1) Click 'Select File' or 'Select Device' and select the volume.\n2) Select 'Volumes' > 'Change Volume Password'.\n3) Enter the current password for the volume.\n4) Change the keyboard layout to English (US) by clicking the Language bar icon in the Windows taskbar and selecting 'EN English (United States)'.\n5) In VeraCrypt, in the field for the new password, type the pre-boot authentication password.\n6) Confirm the new password by retyping it in the confirmation field and click 'OK'.\nWARNING: Please keep in mind that if you follow these steps, the volume password will always have to be typed using the US keyboard layout (which is automatically ensured only in the pre-boot environment).</entry>
<entry lang="en" key="SYS_FAVORITES_KEYBOARD_WARNING">System favorite volumes will be mounted using the pre-boot authentication password. If any system favorite volume uses a different password, it will not be mounted.</entry>
- <entry lang="en" key="SYS_FAVORITES_ADMIN_ONLY_INFO">Please note that if you need to prevent normal VeraCrypt volume actions (such as 'Dismount All', auto-dismount, etc.) from affecting system favorite volumes, you should enable the option 'Allow only administrators to view and dismount system favorite volumes in VeraCrypt'. In addition, when VeraCrypt is run without administrator privileges (the default on Windows Vista and later), system favorite volumes will not be displayed in the drive letter list in the main VeraCrypt application window.</entry>
- <entry lang="en" key="SYS_FAVORITES_ADMIN_ONLY_WARNING">IMPORTANT: Please keep in mind that if this option is enabled and VeraCrypt does not have administrator privileges, mounted system favorite volumes are NOT displayed in the VeraCrypt application window and they cannot be dismounted. Therefore, if you need e.g. to dismount a system favorite volume, please right-click the VeraCrypt icon (in the Start menu) and select 'Run as administrator' first. The same limitation applies to the 'Dismount All' function, 'Auto-Dismount' functions, 'Dismount All' hot keys, etc.</entry>
+ <entry lang="en" key="SYS_FAVORITES_ADMIN_ONLY_INFO">Please note that if you need to prevent normal VeraCrypt volume actions (such as 'Unmount All', auto-unmount, etc.) from affecting system favorite volumes, you should enable the option 'Allow only administrators to view and unmount system favorite volumes in VeraCrypt'. In addition, when VeraCrypt is run without administrator privileges (the default on Windows Vista and later), system favorite volumes will not be displayed in the drive letter list in the main VeraCrypt application window.</entry>
+ <entry lang="en" key="SYS_FAVORITES_ADMIN_ONLY_WARNING">IMPORTANT: Please keep in mind that if this option is enabled and VeraCrypt does not have administrator privileges, mounted system favorite volumes are NOT displayed in the VeraCrypt application window and they cannot be unmounted. Therefore, if you need e.g. to unmount a system favorite volume, please right-click the VeraCrypt icon (in the Start menu) and select 'Run as administrator' first. The same limitation applies to the 'Unmount All' function, 'Auto-Unmount' functions, 'Unmount All' hot keys, etc.</entry>
<entry lang="en" key="SETTING_REQUIRES_REBOOT">Note that this setting takes effect only after the operating system is restarted.</entry>
<entry lang="en" key="COMMAND_LINE_ERROR">Error while parsing command line.</entry>
@@ -1293,8 +1293,8 @@
<entry lang="en" key="SELECT_FILE_AND_MOUNT">Select &amp;File and Mount...</entry>
<entry lang="en" key="SELECT_DEVICE_AND_MOUNT">Select &amp;Device and Mount...</entry>
- <entry lang="en" key="DISABLE_NONADMIN_SYS_FAVORITES_ACCESS">Allow only administrators to view and dismount system favorite volumes in VeraCrypt</entry>
+ <entry lang="en" key="DISABLE_NONADMIN_SYS_FAVORITES_ACCESS">Allow only administrators to view and unmount system favorite volumes in VeraCrypt</entry>
<entry lang="en" key="MOUNT_SYSTEM_FAVORITES_ON_BOOT">Mount system favorite volumes when Windows starts (in the initial phase of the startup procedure)</entry>
- <entry lang="en" key="MOUNTED_VOLUME_DIRTY">Warning: The filesystem on the volume mounted as '%s' was not cleanly dismounted and thus may contain errors. Using a corrupted filesystem can cause data loss or data corruption.\n\nNote: Before you physically remove or switch off a device (such as a USB flash drive or an external hard drive) where a mounted VeraCrypt volume resides, you should always dismount the VeraCrypt volume in VeraCrypt first.\n\n\nDo you want Windows to attempt to detect and fix errors (if any) on the filesystem?</entry>
- <entry lang="en" key="SYS_FAVORITE_VOLUME_DIRTY">Warning: One or more system favorite volumes were not cleanly dismounted and thus may contain filesystem errors. Please see the system event log for further details.\n\nUsing a corrupted filesystem can cause data loss or data corruption. You should check the affected system favorite volume(s) for errors (right-click each of them in VeraCrypt and select 'Repair Filesystem').</entry>
+ <entry lang="en" key="MOUNTED_VOLUME_DIRTY">Warning: The filesystem on the volume mounted as '%s' was not cleanly unmounted and thus may contain errors. Using a corrupted filesystem can cause data loss or data corruption.\n\nNote: Before you physically remove or switch off a device (such as a USB flash drive or an external hard drive) where a mounted VeraCrypt volume resides, you should always unmount the VeraCrypt volume in VeraCrypt first.\n\n\nDo you want Windows to attempt to detect and fix errors (if any) on the filesystem?</entry>
+ <entry lang="en" key="SYS_FAVORITE_VOLUME_DIRTY">Warning: One or more system favorite volumes were not cleanly unmounted and thus may contain filesystem errors. Please see the system event log for further details.\n\nUsing a corrupted filesystem can cause data loss or data corruption. You should check the affected system favorite volume(s) for errors (right-click each of them in VeraCrypt and select 'Repair Filesystem').</entry>
<entry lang="en" key="FILESYS_REPAIR_CONFIRM_BACKUP">Warning: Repairing a damaged filesystem using the Microsoft 'chkdsk' tool might cause loss of files in damaged areas. Therefore, it is recommended that you first back up the files stored on the VeraCrypt volume to another, healthy, VeraCrypt volume.\n\nDo you want to repair the filesystem now?</entry>
<entry lang="en" key="MOUNTED_CONTAINER_FORCED_READ_ONLY">Volume '%s' has been mounted as read-only because write access was denied.\n\nPlease make sure the security permissions of the file container allow you to write to it (right-click the container and select Properties > Security).\n\nNote that, due to a Windows issue, you may see this warning even after setting the appropriate security permissions. This is not caused by a bug in VeraCrypt. A possible solution is to move your container to, e.g., your 'Documents' folder.\n\nIf you intend to keep your volume read-only, set the read-only attribute of the container (right-click the container and select Properties > Read-only), which will suppress this warning.</entry>
@@ -1307,6 +1307,6 @@
<entry lang="en" key="ASK_REMOVE_DEVICE_WRITE_PROTECTION">Do you want VeraCrypt to attempt to disable write protection of the partition/drive?</entry>
<entry lang="en" key="CONFIRM_SETTING_DEGRADES_PERFORMANCE">WARNING: This setting may degrade performance.\n\nAre you sure you want to use this setting?</entry>
- <entry lang="en" key="HOST_DEVICE_REMOVAL_DISMOUNT_WARN_TITLE">Warning: VeraCrypt volume auto-dismounted</entry>
- <entry lang="en" key="HOST_DEVICE_REMOVAL_DISMOUNT_WARN">Before you physically remove or turn off a device containing a mounted volume, you should always dismount the volume in VeraCrypt first.\n\nUnexpected spontaneous dismount is usually caused by an intermittently failing cable, drive (enclosure), etc.</entry>
+ <entry lang="en" key="HOST_DEVICE_REMOVAL_UNMOUNT_WARN_TITLE">Warning: VeraCrypt volume auto-unmounted</entry>
+ <entry lang="en" key="HOST_DEVICE_REMOVAL_UNMOUNT_WARN">Before you physically remove or turn off a device containing a mounted volume, you should always unmount the volume in VeraCrypt first.\n\nUnexpected spontaneous unmount is usually caused by an intermittently failing cable, drive (enclosure), etc.</entry>
<entry lang="en" key="UNSUPPORTED_TRUECRYPT_FORMAT">This volume was created with TrueCrypt %x.%x but VeraCrypt supports only TrueCrypt volumes created with TrueCrypt 6.x/7.x series</entry>
<entry lang="en" key="TEST">Test</entry>
@@ -1454,5 +1454,5 @@
<entry lang="en" key="TASKICON_PREF_MENU_ITEMS">Task Icon Menu Items</entry>
<entry lang="en" key="TASKICON_PREF_OPEN_VOL">Open Mounted Volumes</entry>
- <entry lang="en" key="TASKICON_PREF_DISMOUNT_VOL">Dismount Mounted Volumes</entry>
+ <entry lang="en" key="TASKICON_PREF_UNMOUNT_VOL">Unmount Mounted Volumes</entry>
<entry lang="en" key="DISK_FREE">Free space available: {0}</entry>
<entry lang="en" key="VOLUME_SIZE_HELP">Please specify the size of the container to create. Note that the minimum possible size of a volume is 292 KiB.</entry>
@@ -1484,12 +1484,12 @@
<entry lang="en" key="LINUX_MOUNT_AT_DIR">Mount at directory:</entry>
<entry lang="en" key="LINUX_SELECT">Se&amp;lect...</entry>
- <entry lang="en" key="LINUX_DISMOUNT_ALL_WHEN">Dismount All Volumes When</entry>
+ <entry lang="en" key="LINUX_UNMOUNT_ALL_WHEN">Unmount All Volumes When</entry>
<entry lang="en" key="LINUX_ENTERING_POWERSAVING">System is entering power saving mode</entry>
<entry lang="en" key="LINUX_LOGIN_ACTION">Actions to Perform when User Logs On</entry>
- <entry lang="en" key="LINUX_CLOSE_EXPL_ON_DISMOUNT">Close all Explorer windows of volume being dismounted</entry>
+ <entry lang="en" key="LINUX_CLOSE_EXPL_ON_UNMOUNT">Close all Explorer windows of volume being unmounted</entry>
<entry lang="en" key="LINUX_HOTKEYS">Hotkeys</entry>
<entry lang="en" key="LINUX_SYSTEM_HOTKEYS">System-Wide Hotkeys</entry>
- <entry lang="en" key="LINUX_SOUND_NOTIFICATION">Play system notification sound after mount/dismount</entry>
- <entry lang="en" key="LINUX_CONFIRM_AFTER_DISMOUNT">Display confirmation message box after dismount</entry>
+ <entry lang="en" key="LINUX_SOUND_NOTIFICATION">Play system notification sound after mount/unmount</entry>
+ <entry lang="en" key="LINUX_CONFIRM_AFTER_UNMOUNT">Display confirmation message box after unmount</entry>
<entry lang="en" key="LINUX_VC_QUITS">VeraCrypt quits</entry>
<entry lang="en" key="LINUX_OPEN_FINDER">Open Finder window for successfully mounted volume</entry>
@@ -1511,9 +1511,9 @@
<entry lang="en" key="LINUX_MAX_HIDDEN_SIZE">Maximum possible hidden volume size for this volume is {0}.</entry>
<entry lang="en" key="LINUX_OPEN_OUTER_VOL">Open Outer Volume</entry>
- <entry lang="en" key="LINUX_OUTER_VOL_IS_MOUNTED">Outer volume has been successfully created and mounted as '{0}'. To this volume you should now copy some sensitive-looking files that you actually do NOT want to hide. The files will be there for anyone forcing you to disclose your password. You will reveal only the password for this outer volume, not for the hidden one. The files that you really care about will be stored in the hidden volume, which will be created later on. When you finish copying, click Next. Do not dismount the volume.\n\nNote: After you click Next, the outer volume will be analyzed to determine the size of uninterrupted area of free space whose end is aligned with the end of the volume. This area will accommodate the hidden volume, so it will limit its maximum possible size. The procedure ensures no data on the outer volume are overwritten by the hidden volume.</entry>
+ <entry lang="en" key="LINUX_OUTER_VOL_IS_MOUNTED">Outer volume has been successfully created and mounted as '{0}'. To this volume you should now copy some sensitive-looking files that you actually do NOT want to hide. The files will be there for anyone forcing you to disclose your password. You will reveal only the password for this outer volume, not for the hidden one. The files that you really care about will be stored in the hidden volume, which will be created later on. When you finish copying, click Next. Do not unmount the volume.\n\nNote: After you click Next, the outer volume will be analyzed to determine the size of uninterrupted area of free space whose end is aligned with the end of the volume. This area will accommodate the hidden volume, so it will limit its maximum possible size. The procedure ensures no data on the outer volume are overwritten by the hidden volume.</entry>
<entry lang="en" key="LINUX_ERROR_TRY_ENCRYPT_SYSTEM_DRIVE">Error: You are trying to encrypt a system drive.\n\nVeraCrypt can encrypt a system drive only under Windows.</entry>
<entry lang="en" key="LINUX_ERROR_TRY_ENCRYPT_SYSTEM_PARTITION">Error: You are trying to encrypt a system partition.\n\nVeraCrypt can encrypt system partitions only under Windows.</entry>
<entry lang="en" key="LINUX_WARNING_FORMAT_DESTROY_FS">WARNING: Formatting of the device will destroy all data on filesystem '{0}'.\n\nDo you want to continue?</entry>
- <entry lang="en" key="LINUX_MOUNTET_HINT">The filesystem of the selected device is currently mounted. Please dismount '{0}' before proceeding.</entry>
+ <entry lang="en" key="LINUX_MOUNTET_HINT">The filesystem of the selected device is currently mounted. Please unmount '{0}' before proceeding.</entry>
<entry lang="en" key="LINUX_HIDDEN_PASS_NO_DIFF">The Hidden volume can't have the same password, PIM and keyfiles as the Outer volume</entry>
<entry lang="en" key="LINUX_NOT_FAT_HINT">Please note that the volume will not be formatted with a FAT filesystem and, therefore, you may be required to install additional filesystem drivers on platforms other than {0}, which will enable you to mount the volume.</entry>
@@ -1523,5 +1523,5 @@
<entry lang="en" key="LINUX_NOT_SUPPORTED"> (not supported by components available on this platform).\n</entry>
<entry lang="en" key="LINUX_KERNEL_OLD">Your system uses an old version of the Linux kernel.\n\nDue to a bug in the Linux kernel, your system may stop responding when writing data to a VeraCrypt volume. This problem can be solved by upgrading the kernel to version 2.6.24 or later.</entry>
- <entry lang="en" key="LINUX_VOL_DISMOUNTED">Volume {0} has been dismounted.</entry>
+ <entry lang="en" key="LINUX_VOL_UNMOUNTED">Volume {0} has been unmounted.</entry>
<entry lang="en" key="LINUX_VOL_MOUNTED">Volume {0} has been mounted.</entry>
<entry lang="en" key="LINUX_OOM">Out of memory.</entry>
@@ -1642,4 +1642,7 @@
<entry lang="en" key="ERR_SYSENC_XTS_MASTERKEY_VULNERABLE">WARNING: The encrypted system's master key is vulnerable to an attack that compromises data security.\nPlease decrypt the system partition/drive and then re-encrypt it.</entry>
<entry lang="en" key="ERR_XTS_MASTERKEY_VULNERABLE_SHORT">WARNING: The volume's master key has a security vulnerability.</entry>
+ <entry lang="en" key="MOUNTPOINT_BLOCKED">ERROR: The volume mount point is blocked because it overrides a protected system directory.\n\nPlease choose a different mount point.</entry>
+ <entry lang="en" key="MOUNTPOINT_NOTALLOWED">ERROR: The volume mount point is not allowed because it overrides a directory that is part of the PATH environment variable.\n\nPlease choose a different mount point.</entry>
+ <entry lang="en" key="INSECURE_MODE">[INSECURE MODE]</entry>
</localization>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
diff --git a/src/Common/Password.c b/src/Common/Password.c
index aed7cfb9..ed662a88 100644
--- a/src/Common/Password.c
+++ b/src/Common/Password.c
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Password.h b/src/Common/Password.h
index dd3fbed6..9f2f0145 100644
--- a/src/Common/Password.h
+++ b/src/Common/Password.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Pkcs5.c b/src/Common/Pkcs5.c
index 6d8ce08a..fbe22275 100644
--- a/src/Common/Pkcs5.c
+++ b/src/Common/Pkcs5.c
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Pkcs5.h b/src/Common/Pkcs5.h
index 65fad038..41679fe7 100644
--- a/src/Common/Pkcs5.h
+++ b/src/Common/Pkcs5.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Progress.c b/src/Common/Progress.c
index 24efcad5..2abf782c 100644
--- a/src/Common/Progress.c
+++ b/src/Common/Progress.c
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Progress.h b/src/Common/Progress.h
index d86e51ac..6642bb35 100644
--- a/src/Common/Progress.h
+++ b/src/Common/Progress.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Random.c b/src/Common/Random.c
index 00a00729..4c6382b4 100644
--- a/src/Common/Random.c
+++ b/src/Common/Random.c
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
@@ -21,6 +21,4 @@
#include <Strsafe.h>
#include <bcrypt.h>
-#include <pdh.h>
-#include <pdhmsg.h>
static unsigned __int8 buffer[RNG_POOL_SIZE];
@@ -85,4 +83,7 @@ CRITICAL_SECTION critRandProt; /* The critical section */
BOOL volatile bThreadTerminate = FALSE; /* This variable is shared among thread's so its made volatile */
+/* Network library handle for the SlowPoll function */
+HANDLE hNetAPI32 = NULL;
+
// CryptoAPI
DWORD CryptoAPILastError = ERROR_SUCCESS;
@@ -91,37 +92,4 @@ typedef DWORD (WINAPI *RtlNtStatusToDosError_t)(NTSTATUS);
RtlNtStatusToDosError_t pRtlNtStatusToDosError = NULL;
-static HMODULE hPdhLib = NULL;
-
-typedef PDH_STATUS (WINAPI *PfnPdhOpenQueryW)(LPCWSTR, DWORD_PTR, PDH_HQUERY *);
-typedef PDH_STATUS (WINAPI *PfnPdhAddCounterW)(PDH_HQUERY, LPCWSTR, DWORD_PTR, PDH_HCOUNTER *);
-typedef PDH_STATUS (WINAPI *PfnPdhCollectQueryData)(PDH_HQUERY);
-typedef PDH_STATUS (WINAPI *PfnPdhGetFormattedCounterValue)(PDH_HCOUNTER, DWORD, LPDWORD, PPDH_FMT_COUNTERVALUE);
-typedef PDH_STATUS (WINAPI *PfnPdhCloseQuery)(PDH_HQUERY);
-
-static PfnPdhOpenQueryW pfnPdhOpenQuery = NULL;
-static PfnPdhAddCounterW pfnPdhAddCounter = NULL;
-static PfnPdhCollectQueryData pfnPdhCollectQueryData = NULL;
-static PfnPdhGetFormattedCounterValue pfnPdhGetFormattedCounterValue = NULL;
-static PfnPdhCloseQuery pfnPdhCloseQuery = NULL;
-
-static BOOL LoadPdhDll()
-{
- if (!hPdhLib)
- {
- hPdhLib = LoadLibraryExW(L"pdh.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
- if (!hPdhLib)
- return FALSE;
-
- pfnPdhOpenQuery = (PfnPdhOpenQueryW) GetProcAddress(hPdhLib, "PdhOpenQueryW");
- pfnPdhAddCounter = (PfnPdhAddCounterW) GetProcAddress(hPdhLib, "PdhAddCounterW");
- pfnPdhCollectQueryData = (PfnPdhCollectQueryData) GetProcAddress(hPdhLib, "PdhCollectQueryData");
- pfnPdhGetFormattedCounterValue = (PfnPdhGetFormattedCounterValue) GetProcAddress(hPdhLib, "PdhGetFormattedCounterValue");
- pfnPdhCloseQuery = (PfnPdhCloseQuery) GetProcAddress(hPdhLib, "PdhCloseQuery");
- }
-
- return (pfnPdhOpenQuery && pfnPdhAddCounter && pfnPdhCollectQueryData &&
- pfnPdhGetFormattedCounterValue && pfnPdhCloseQuery);
-}
-
/* Init the random number generator, setup the hooks, and start the thread */
int RandinitWithCheck ( int* pAlreadyInitialized)
@@ -224,4 +192,10 @@ void RandStop (BOOL freePool)
WaitForSingleObject (PeriodicFastPollThreadHandle, INFINITE);
+ if (hNetAPI32 != 0)
+ {
+ FreeLibrary (hNetAPI32);
+ hNetAPI32 = NULL;
+ }
+
hMouse = NULL;
@@ -281,5 +255,5 @@ BOOL Randmix ()
{
unsigned char hashOutputBuffer [MAX_DIGESTSIZE];
- #ifndef WOLFCRYPT_BACKEND
+ #ifndef WOLFCRYPT_BACKEND
WHIRLPOOL_CTX wctx;
blake2s_state bctx;
@@ -300,9 +274,9 @@ BOOL Randmix ()
break;
- #ifndef WOLFCRYPT_BACKEND
+ #ifndef WOLFCRYPT_BACKEND
case BLAKE2S:
digestSize = BLAKE2S_DIGESTSIZE;
break;
-
+
case WHIRLPOOL:
digestSize = WHIRLPOOL_DIGESTSIZE;
@@ -667,190 +641,140 @@ static unsigned __stdcall PeriodicFastPollThreadProc (void *dummy)
}
+/* Type definitions for function pointers to call NetAPI32 functions */
-/* -------------------------------------------------------------------------------------
- GetDiskStatistics: This function uses the Windows Performance Data Helper (PDH) API
- to collect disk statistics. The function collects the number of disk reads and writes
- per second for all physical disks. The function also collects high-resolution
- timestamps before and after the PDH query. The function then adds the collected data
- to the random pool.
- The code waits a short random interval between the two PDH samples to ensures that
- the performance counters have time to accumulate measurable changes and produce more
- varied data.
- -------------------------------------------------------------------------------------
+typedef
+ DWORD (WINAPI * NETSTATISTICSGET) (LPWSTR szServer, LPWSTR szService,
+ DWORD dwLevel, DWORD dwOptions,
+ LPBYTE * lpBuffer);
+typedef
+ DWORD (WINAPI * NETAPIBUFFERSIZE) (LPVOID lpBuffer, LPDWORD cbBuffer);
+typedef
+ DWORD (WINAPI * NETAPIBUFFERFREE) (LPVOID lpBuffer);
-*/
-void GetDiskStatistics()
-{
- if (!LoadPdhDll())
- return;
- PDH_STATUS status;
- PDH_HQUERY query = NULL;
- PDH_HCOUNTER counterReads = NULL, counterWrites = NULL;
- PDH_FMT_COUNTERVALUE counterValue;
- DWORD dwType;
- LONGLONG llReads = 0, llWrites = 0;
- DWORDLONG tstampBefore = 0, tstampAfter = 0;
- LARGE_INTEGER perfCounterBefore, perfCounterAfter;
-
- // High-resolution timestamps
- if (!QueryPerformanceCounter(&perfCounterBefore))
- return;
- tstampBefore = GetTickCount64();
-
- // Open PDH query
- status = pfnPdhOpenQuery(NULL, 0, &query);
- if (status != ERROR_SUCCESS)
- goto error;
-
- // Add counters for disk reads and writes (all physical disks).
- status = pfnPdhAddCounter(query, L"\\PhysicalDisk(*)\\Disk Reads/sec", 0, &counterReads);
- if (status != ERROR_SUCCESS)
- goto error;
-
- status = pfnPdhAddCounter(query, L"\\PhysicalDisk(*)\\Disk Writes/sec", 0, &counterWrites);
- if (status != ERROR_SUCCESS)
- goto error;
-
- // First sample
- status = pfnPdhCollectQueryData(query);
- if (status != ERROR_SUCCESS)
- goto error;
-
- // Wait a short random interval
- Sleep(10 + (GetCurrentProcessId() % 40));
-
- // Second sample
- status = pfnPdhCollectQueryData(query);
- if (status != ERROR_SUCCESS)
- goto error;
-
- // Format counters in PDH_FMT_LARGE
- status = pfnPdhGetFormattedCounterValue(counterReads, PDH_FMT_LARGE, &dwType, &counterValue);
- if (status == ERROR_SUCCESS)
- llReads = counterValue.largeValue;
-
- status = pfnPdhGetFormattedCounterValue(counterWrites, PDH_FMT_LARGE, &dwType, &counterValue);
- if (status == ERROR_SUCCESS)
- llWrites = counterValue.largeValue;
-
- // Another high-resolution timestamp
- if (!QueryPerformanceCounter(&perfCounterAfter))
- goto error;
- tstampAfter = GetTickCount64();
-
- // Close PDH query
- pfnPdhCloseQuery(query);
- query = NULL;
-
- // Collect results into the random pool
- RandaddBuf(&llReads, sizeof(llReads));
- RandaddBuf(&llWrites, sizeof(llWrites));
- RandaddBuf(&tstampBefore, sizeof(tstampBefore));
- RandaddBuf(&tstampAfter, sizeof(tstampAfter));
- RandaddBuf(&perfCounterBefore.QuadPart, sizeof(perfCounterBefore.QuadPart));
- RandaddBuf(&perfCounterAfter.QuadPart, sizeof(perfCounterAfter.QuadPart));
-
-error:
- if (query)
- pfnPdhCloseQuery(query);
-}
+NETSTATISTICSGET pNetStatisticsGet = NULL;
+NETAPIBUFFERSIZE pNetApiBufferSize = NULL;
+NETAPIBUFFERFREE pNetApiBufferFree = NULL;
-/* -------------------------------------------------------------------------------------
- GetNetworkStatistics: This function uses the Windows Performance Data Helper (PDH) API
- to collect network statistics. The function collects the number of bytes sent and
- received per second for all network interfaces. The function also collects
- high-resolution timestamps before and after the PDH query. The function then adds the
- collected data to the random pool.
- The code waits a short random interval between the two PDH samples to ensures that
- the performance counters have time to accumulate measurable changes and produce more
- varied data.
-*/
-void GetNetworkStatistics()
+/* This is the slowpoll function which gathers up network/hard drive
+ performance data for the random pool */
+BOOL SlowPoll (void)
{
- if (!LoadPdhDll())
- return;
- PDH_STATUS status;
- PDH_HQUERY query = NULL;
- PDH_HCOUNTER counterBytesSent = NULL, counterBytesReceived = NULL;
- PDH_FMT_COUNTERVALUE counterValue;
- DWORD dwType;
- LONGLONG llBytesSent = 0, llBytesReceived = 0;
- DWORDLONG tstampBefore = 0, tstampAfter = 0;
- LARGE_INTEGER perfCounterBefore, perfCounterAfter;
-
- // High-resolution timestamps
- if (!QueryPerformanceCounter(&perfCounterBefore))
- return;
- tstampBefore = GetTickCount64();
-
- // Open PDH query
- status = pfnPdhOpenQuery(NULL, 0, &query);
- if (status != ERROR_SUCCESS)
- goto error;
-
- // Add counters for network bytes sent and received
- status = pfnPdhAddCounter(query, L"\\Network Interface(*)\\Bytes Sent/sec", 0, &counterBytesSent);
- if (status != ERROR_SUCCESS)
- goto error;
-
- status = pfnPdhAddCounter(query, L"\\Network Interface(*)\\Bytes Received/sec", 0, &counterBytesReceived);
- if (status != ERROR_SUCCESS)
- goto error;
+ static int isWorkstation = -1;
+ static int cbPerfData = 0x10000;
+ HANDLE hDevice;
+ LPBYTE lpBuffer;
+ DWORD dwSize, status;
+ LPWSTR lpszLanW, lpszLanS;
+ int nDrive;
+ NTSTATUS bStatus = 0;
- // First sample
- status = pfnPdhCollectQueryData(query);
- if (status != ERROR_SUCCESS)
- goto error;
+ /* Find out whether this is an NT server or workstation if necessary */
+ if (isWorkstation == -1)
+ {
+ HKEY hKey;
- // Wait short, dynamic interval
- Sleep(10 + (GetCurrentProcessId() % 40));
+ if (RegOpenKeyEx (HKEY_LOCAL_MACHINE,
+ L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
+ 0, KEY_READ, &hKey) == ERROR_SUCCESS)
+ {
+ wchar_t szValue[32];
+ dwSize = sizeof (szValue);
- // Second sample
- status = pfnPdhCollectQueryData(query);
- if (status != ERROR_SUCCESS)
- goto error;
+ isWorkstation = TRUE;
+ status = RegQueryValueEx (hKey, L"ProductType", 0, NULL,
+ (LPBYTE) szValue, &dwSize);
- // Format counters
- status = pfnPdhGetFormattedCounterValue(counterBytesSent, PDH_FMT_LARGE, &dwType, &counterValue);
- if (status == ERROR_SUCCESS)
- llBytesSent = counterValue.largeValue;
+ if (status == ERROR_SUCCESS && _wcsicmp (szValue, L"WinNT"))
+ /* Note: There are (at least) three cases for
+ ProductType: WinNT = NT Workstation,
+ ServerNT = NT Server, LanmanNT = NT Server
+ acting as a Domain Controller */
+ isWorkstation = FALSE;
- status = pfnPdhGetFormattedCounterValue(counterBytesReceived, PDH_FMT_LARGE, &dwType, &counterValue);
- if (status == ERROR_SUCCESS)
- llBytesReceived = counterValue.largeValue;
+ RegCloseKey (hKey);
+ }
+ }
+ /* Initialize the NetAPI32 function pointers if necessary */
+ if (hNetAPI32 == NULL)
+ {
+ /* Obtain a handle to the module containing the Lan Manager
+ functions */
+ wchar_t dllPath[MAX_PATH];
+ if (GetSystemDirectory (dllPath, MAX_PATH))
+ {
+ StringCchCatW(dllPath, ARRAYSIZE(dllPath), L"\\NETAPI32.DLL");
+ }
+ else
+ StringCchCopyW(dllPath, ARRAYSIZE(dllPath), L"C:\\Windows\\System32\\NETAPI32.DLL");
- if (!QueryPerformanceCounter(&perfCounterAfter))
- goto error;
- tstampAfter = GetTickCount64();
+ hNetAPI32 = LoadLibrary (dllPath);
+ if (hNetAPI32 != NULL)
+ {
+ /* Now get pointers to the functions */
+ pNetStatisticsGet = (NETSTATISTICSGET) GetProcAddress (hNetAPI32,
+ "NetStatisticsGet");
+ pNetApiBufferSize = (NETAPIBUFFERSIZE) GetProcAddress (hNetAPI32,
+ "NetApiBufferSize");
+ pNetApiBufferFree = (NETAPIBUFFERFREE) GetProcAddress (hNetAPI32,
+ "NetApiBufferFree");
+
+ /* Make sure we got valid pointers for every NetAPI32
+ function */
+ if (pNetStatisticsGet == NULL ||
+ pNetApiBufferSize == NULL ||
+ pNetApiBufferFree == NULL)
+ {
+ /* Free the library reference and reset the
+ static handle */
+ FreeLibrary (hNetAPI32);
+ hNetAPI32 = NULL;
+ }
+ }
+ }
- // Close PDH query
- pfnPdhCloseQuery(query);
- query = NULL;
+ /* Get network statistics. Note: Both NT Workstation and NT Server
+ by default will be running both the workstation and server
+ services. The heuristic below is probably useful though on the
+ assumption that the majority of the network traffic will be via
+ the appropriate service */
+ lpszLanW = (LPWSTR) WIDE ("LanmanWorkstation");
+ lpszLanS = (LPWSTR) WIDE ("LanmanServer");
+ if (hNetAPI32 &&
+ pNetStatisticsGet (NULL,
+ isWorkstation ? lpszLanW : lpszLanS,
+ 0, 0, &lpBuffer) == 0)
+ {
+ pNetApiBufferSize (lpBuffer, &dwSize);
+ RandaddBuf ((unsigned char *) lpBuffer, dwSize);
+ pNetApiBufferFree (lpBuffer);
+ }
- // Collect results into our random pool
- RandaddBuf(&llBytesSent, sizeof(llBytesSent));
- RandaddBuf(&llBytesReceived, sizeof(llBytesReceived));
- RandaddBuf(&tstampBefore, sizeof(tstampBefore));
- RandaddBuf(&tstampAfter, sizeof(tstampAfter));
- RandaddBuf(&perfCounterBefore.QuadPart, sizeof(perfCounterBefore.QuadPart));
- RandaddBuf(&perfCounterAfter.QuadPart, sizeof(perfCounterAfter.QuadPart));
+ /* Get disk I/O statistics for all the hard drives */
+ for (nDrive = 0;; nDrive++)
+ {
+ DISK_PERFORMANCE diskPerformance;
+ wchar_t szDevice[24];
+
+ /* Check whether we can access this device */
+ StringCchPrintfW (szDevice, ARRAYSIZE(szDevice), L"\\\\.\\PhysicalDrive%d", nDrive);
+ hDevice = CreateFile (szDevice, 0, FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL, OPEN_EXISTING, 0, NULL);
+ if (hDevice == INVALID_HANDLE_VALUE)
+ break;
-error:
- if (query)
- pfnPdhCloseQuery(query);
-}
-/* This is the slowpoll function which gathers up network/hard drive
- performance data for the random pool */
-BOOL SlowPoll (void)
-{
- NTSTATUS bStatus = 0;
+ /* Note: This only works if you have turned on the disk
+ performance counters with 'diskperf -y'. These counters
+ are off by default */
+ if (DeviceIoControl (hDevice, IOCTL_DISK_PERFORMANCE, NULL, 0,
+ &diskPerformance, sizeof (DISK_PERFORMANCE),
+ &dwSize, NULL))
+ {
+ RandaddBuf ((unsigned char *) &diskPerformance, dwSize);
+ }
+ CloseHandle (hDevice);
+ }
- // Gather disk stats via PDH
- GetDiskStatistics();
-
- // Gather network stats via PDH
- GetNetworkStatistics();
bStatus = BCryptGenRandom(NULL, buffer, sizeof(buffer), BCRYPT_USE_SYSTEM_PREFERRED_RNG);
@@ -879,6 +803,7 @@ BOOL SlowPoll (void)
}
+#ifndef _M_ARM64
// use RDSEED or RDRAND from CPU as source of entropy if present
- if ( IsCpuRngEnabled() &&
+ if ( IsCpuRngEnabled() &&
( (HasRDSEED() && RDSEED_getBytes (buffer, sizeof (buffer)))
|| (HasRDRAND() && RDRAND_getBytes (buffer, sizeof (buffer)))
@@ -887,8 +812,7 @@ BOOL SlowPoll (void)
RandaddBuf (buffer, sizeof (buffer));
}
+#endif
burn(buffer, sizeof (buffer));
-
- /* Mix the pool */
Randmix();
@@ -1012,6 +936,7 @@ BOOL FastPoll (void)
}
+#ifndef _M_ARM64
// use RDSEED or RDRAND from CPU as source of entropy if enabled
- if ( IsCpuRngEnabled() &&
+ if ( IsCpuRngEnabled() &&
( (HasRDSEED() && RDSEED_getBytes (buffer, sizeof (buffer)))
|| (HasRDRAND() && RDRAND_getBytes (buffer, sizeof (buffer)))
@@ -1020,4 +945,5 @@ BOOL FastPoll (void)
RandaddBuf (buffer, sizeof (buffer));
}
+#endif
burn (buffer, sizeof(buffer));
diff --git a/src/Common/Random.h b/src/Common/Random.h
index 68758782..9d7e345a 100644
--- a/src/Common/Random.h
+++ b/src/Common/Random.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Registry.c b/src/Common/Registry.c
index b04bbf60..f5aa4053 100644
--- a/src/Common/Registry.c
+++ b/src/Common/Registry.c
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Registry.h b/src/Common/Registry.h
index ea449d3e..0e869281 100644
--- a/src/Common/Registry.h
+++ b/src/Common/Registry.h
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/SecurityToken.cpp b/src/Common/SecurityToken.cpp
index cd4926a0..85219395 100644
--- a/src/Common/SecurityToken.cpp
+++ b/src/Common/SecurityToken.cpp
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/SecurityToken.h b/src/Common/SecurityToken.h
index 6c454def..9f024b36 100644
--- a/src/Common/SecurityToken.h
+++ b/src/Common/SecurityToken.h
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Tcdefs.h b/src/Common/Tcdefs.h
index 48fc12b6..ee5751b7 100644
--- a/src/Common/Tcdefs.h
+++ b/src/Common/Tcdefs.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
@@ -60,5 +60,5 @@ extern unsigned short _rotl16(unsigned short value, unsigned char shift);
// Version displayed to user
-#define VERSION_STRING "1.26.17"
+#define VERSION_STRING "1.26.20"
#ifdef VC_EFI_CUSTOM_MODE
@@ -74,7 +74,7 @@ extern unsigned short _rotl16(unsigned short value, unsigned char shift);
// Release date
-#define TC_STR_RELEASE_DATE L"November 24, 2024"
-#define TC_RELEASE_DATE_YEAR 2024
-#define TC_RELEASE_DATE_MONTH 11
+#define TC_STR_RELEASE_DATE L"February 3, 2025"
+#define TC_RELEASE_DATE_YEAR 2025
+#define TC_RELEASE_DATE_MONTH 2
#define BYTES_PER_KB 1024LL
diff --git a/src/Common/Tests.c b/src/Common/Tests.c
index 1f4178c6..89af24f1 100644
--- a/src/Common/Tests.c
+++ b/src/Common/Tests.c
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
@@ -1491,5 +1491,7 @@ BOOL AutoTestAlgorithms (void)
/* unexepected exception raised. Disable all CPU extended feature and try again */
EnableHwEncryption (hwEncryptionEnabled);
+#ifndef _M_ARM64
DisableCPUExtendedFeatures ();
+#endif
__try
{
diff --git a/src/Common/Tests.h b/src/Common/Tests.h
index bfdf7c40..9b9d09e4 100644
--- a/src/Common/Tests.h
+++ b/src/Common/Tests.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Volumes.c b/src/Common/Volumes.c
index 60d1b417..10f03636 100644
--- a/src/Common/Volumes.c
+++ b/src/Common/Volumes.c
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Volumes.h b/src/Common/Volumes.h
index 07ed0fe8..98b2f8d6 100644
--- a/src/Common/Volumes.h
+++ b/src/Common/Volumes.h
@@ -7,5 +7,5 @@
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Wipe.c b/src/Common/Wipe.c
index af3d15db..66d633b8 100644
--- a/src/Common/Wipe.c
+++ b/src/Common/Wipe.c
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Wipe.h b/src/Common/Wipe.h
index 09b9d71e..b8bd0fac 100644
--- a/src/Common/Wipe.h
+++ b/src/Common/Wipe.h
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Xml.c b/src/Common/Xml.c
index 9f77b3ba..d48940ed 100644
--- a/src/Common/Xml.c
+++ b/src/Common/Xml.c
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Xml.h b/src/Common/Xml.h
index 09b8543a..d442f187 100644
--- a/src/Common/Xml.h
+++ b/src/Common/Xml.h
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Xts.c b/src/Common/Xts.c
index 4a62aaf3..99999f11 100644
--- a/src/Common/Xts.c
+++ b/src/Common/Xts.c
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Xts.h b/src/Common/Xts.h
index b4b4058e..0cc3a99f 100644
--- a/src/Common/Xts.h
+++ b/src/Common/Xts.h
@@ -5,5 +5,5 @@
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
diff --git a/src/Common/Zip.vcxproj b/src/Common/Zip.vcxproj
index 6674ef34..a8fbf1eb 100644
--- a/src/Common/Zip.vcxproj
+++ b/src/Common/Zip.vcxproj
@@ -115,4 +115,5 @@
<ClCompile Include="libzip\zip_source_free.c" />
<ClCompile Include="libzip\zip_source_function.c" />
+ <ClCompile Include="libzip\zip_source_get_dostime.c" />
<ClCompile Include="libzip\zip_source_get_file_attributes.c" />
<ClCompile Include="libzip\zip_source_is_deleted.c" />
diff --git a/src/Common/Zip.vcxproj.filters b/src/Common/Zip.vcxproj.filters
index 92bcf493..eb88a358 100644
--- a/src/Common/Zip.vcxproj.filters
+++ b/src/Common/Zip.vcxproj.filters
@@ -400,4 +400,7 @@
<Filter>zlib</Filter>
</ClCompile>
+ <ClCompile Include="libzip\zip_source_get_dostime.c">
+ <Filter>libzip</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
diff --git a/src/Common/libzip/NEWS.md b/src/Common/libzip/NEWS.md
index e117422d..d2b1e73d 100644
--- a/src/Common/libzip/NEWS.md
+++ b/src/Common/libzip/NEWS.md
@@ -1,2 +1,19 @@
+# 1.11.2 [2024-10-31]
+
+* Fix performance regression in `zip_stat` introduced in 1.11.
+
+# 1.11.1 [2024-09-19]
+
+* Fix zipconf.h for version number with missing third component.
+
+# 1.11 [2024-09-19]
+
+* Stop searching after finding acceptable central directory, even if it contains inconsistencies.
+* Only write Zip64 EOCD if fields don't fit in normal EOCD. Previously libzip also wrote it when any directory entry required Zip64.
+* Allow bytes from 0x00-0x1F as UTF-8.
+* Add new error code `ZIP_ER_TRUNCATED_ZIP` for files that start with a valid local header signature.
+* `zipcmp`: add `-T` option for comparing timestamps.
+* `zip_file_replace` now removes the target's extra field information.
+
# 1.10.1 [2023-08-23]
diff --git a/src/Common/libzip/compat.h b/src/Common/libzip/compat.h
index 296ee59e..2cbc19f8 100644
--- a/src/Common/libzip/compat.h
+++ b/src/Common/libzip/compat.h
@@ -4,5 +4,5 @@
/*
compat.h -- compatibility defines.
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -127,6 +127,56 @@ typedef char bool;
#endif
-#ifndef HAVE_FSEEKO
-#define fseeko(s, o, w) (fseek((s), (long int)(o), (w)))
+
+#if defined(HAVE__FSEEKI64) && defined(HAVE__FSTAT64) && defined(HAVE__FTELLI64)
+/* Windows API using int64 */
+typedef zip_int64_t zip_off_t;
+typedef struct _stat64 zip_os_stat_t;
+#define zip_os_stat _stat64
+#define zip_os_fstat _fstat64
+#define zip_os_fseek _fseeki64
+#define zip_os_ftell _ftelli64
+#define ZIP_FSEEK_MAX ZIP_INT64_MAX
+#define ZIP_FSEEK_MIN ZIP_INT64_MIN
+#else
+
+/* Normal API */
+#include <sys/stat.h>
+typedef struct stat zip_os_stat_t;
+#define zip_os_fstat fstat
+#define zip_os_stat stat
+
+#if defined(HAVE_FTELLO) && defined(HAVE_FSEEKO)
+/* Using off_t */
+typedef off_t zip_off_t;
+#if SIZEOF_OFF_T == 8
+#define ZIP_OFF_MAX ZIP_INT64_MAX
+#define ZIP_OFF_MIN ZIP_INT64_MIN
+#elif SIZEOF_OFF_T == 4
+#define ZIP_OFF_MAX ZIP_INT32_MAX
+#define ZIP_OFF_MIN ZIP_INT32_MIN
+#elif SIZEOF_OFF_T == 2
+#define ZIP_OFF_MAX ZIP_INT16_MAX
+#define ZIP_OFF_MIN ZIP_INT16_MIN
+#else
+#error unsupported size of off_t
+#endif
+
+#define ZIP_FSEEK_MAX ZIP_OFF_MAX
+#define ZIP_FSEEK_MIN ZIP_OFF_MIN
+
+#define zip_os_fseek fseeko
+#define zip_os_ftell ftello
+#else
+
+/* Using long */
+typedef long zip_off_t;
+#include <limits.h>
+#define ZIP_FSEEK_MAX LONG_MAX
+#define ZIP_FSEEK_MIN LONG_MIN
+
+#define zip_os_fseek fseek
+#define zip_os_ftell ftell
+#endif
+
#endif
@@ -135,4 +185,5 @@ typedef char bool;
#endif
+
#ifdef HAVE_LOCALTIME_S
#ifdef _WIN32
@@ -183,25 +234,4 @@ typedef char bool;
#endif
-#if SIZEOF_OFF_T == 8
-#define ZIP_OFF_MAX ZIP_INT64_MAX
-#define ZIP_OFF_MIN ZIP_INT64_MIN
-#elif SIZEOF_OFF_T == 4
-#define ZIP_OFF_MAX ZIP_INT32_MAX
-#define ZIP_OFF_MIN ZIP_INT32_MIN
-#elif SIZEOF_OFF_T == 2
-#define ZIP_OFF_MAX ZIP_INT16_MAX
-#define ZIP_OFF_MIN ZIP_INT16_MIN
-#else
-#error unsupported size of off_t
-#endif
-
-#if defined(HAVE_FTELLO) && defined(HAVE_FSEEKO)
-#define ZIP_FSEEK_MAX ZIP_OFF_MAX
-#define ZIP_FSEEK_MIN ZIP_OFF_MIN
-#else
-#include <limits.h>
-#define ZIP_FSEEK_MAX LONG_MAX
-#define ZIP_FSEEK_MIN LONG_MIN
-#endif
#ifndef SIZE_MAX
diff --git a/src/Common/libzip/config.h b/src/Common/libzip/config.h
index 2976249c..5edc625f 100644
--- a/src/Common/libzip/config.h
+++ b/src/Common/libzip/config.h
@@ -11,4 +11,7 @@
#define HAVE__FDOPEN
#define HAVE__FILENO
+#define HAVE__FSEEKI64
+#define HAVE__FSTAT64
+#define HAVE__FTELLI64
#define HAVE__SETMODE
#if defined(_MSC_VER) && _MSC_VER < 1900
@@ -19,4 +22,5 @@
#define HAVE__SNPRINTF_S
#define HAVE__SNWPRINTF_S
+#define HAVE__STAT64
#define HAVE__STRDUP
#define HAVE__STRICMP
@@ -89,5 +93,5 @@
/* END DEFINES */
#define PACKAGE "libzip"
-#define VERSION "1.10.1"
+#define VERSION "1.11.2"
#endif /* HAD_CONFIG_H */
diff --git a/src/Common/libzip/zip.h b/src/Common/libzip/zip.h
index dc3751c8..da57ea56 100644
--- a/src/Common/libzip/zip.h
+++ b/src/Common/libzip/zip.h
@@ -4,5 +4,5 @@
/*
zip.h -- exported declarations.
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -159,4 +159,5 @@ extern "C" {
#define ZIP_ER_DATA_LENGTH 33 /* N Unexpected length of data */
#define ZIP_ER_NOT_ALLOWED 34 /* N Not allowed in torrentzip */
+#define ZIP_ER_TRUNCATED_ZIP 35 /* N Possibly truncated or corrupted zip archive */
/* type of system error value */
@@ -261,5 +262,6 @@ enum zip_source_cmd {
ZIP_SOURCE_ACCEPT_EMPTY, /* whether empty files are valid archives */
ZIP_SOURCE_GET_FILE_ATTRIBUTES, /* get additional file attributes */
- ZIP_SOURCE_SUPPORTS_REOPEN /* allow reading from changed entry */
+ ZIP_SOURCE_SUPPORTS_REOPEN, /* allow reading from changed entry */
+ ZIP_SOURCE_GET_DOS_TIME /* get last modification time in DOS format */
};
typedef enum zip_source_cmd zip_source_cmd_t;
diff --git a/src/Common/libzip/zip_add.c b/src/Common/libzip/zip_add.c
index 9770139d..a426a579 100644
--- a/src/Common/libzip/zip_add.c
+++ b/src/Common/libzip/zip_add.c
@@ -1,5 +1,5 @@
/*
zip_add.c -- add file via callback function
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_add_dir.c b/src/Common/libzip/zip_add_dir.c
index c31fea36..2faaa1a6 100644
--- a/src/Common/libzip/zip_add_dir.c
+++ b/src/Common/libzip/zip_add_dir.c
@@ -1,5 +1,5 @@
/*
zip_add_dir.c -- add directory
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_add_entry.c b/src/Common/libzip/zip_add_entry.c
index bf12dd54..e8beaa81 100644
--- a/src/Common/libzip/zip_add_entry.c
+++ b/src/Common/libzip/zip_add_entry.c
@@ -1,5 +1,5 @@
/*
zip_add_entry.c -- create and init struct zip_entry
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -65,5 +65,5 @@ _zip_add_entry(zip_t *za) {
}
rentries = (zip_entry_t *)realloc(za->entry, sizeof(struct zip_entry) * (size_t)nalloc);
- if (!rentries) {
+ if (rentries == NULL) {
zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
return -1;
diff --git a/src/Common/libzip/zip_algorithm_bzip2.c b/src/Common/libzip/zip_algorithm_bzip2.c
index f25be143..1818039e 100644
--- a/src/Common/libzip/zip_algorithm_bzip2.c
+++ b/src/Common/libzip/zip_algorithm_bzip2.c
@@ -1,5 +1,5 @@
/*
zip_algorithm_bzip2.c -- bzip2 (de)compression routines
- Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2017-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_algorithm_deflate.c b/src/Common/libzip/zip_algorithm_deflate.c
index 3c85e204..5ab879df 100644
--- a/src/Common/libzip/zip_algorithm_deflate.c
+++ b/src/Common/libzip/zip_algorithm_deflate.c
@@ -1,5 +1,5 @@
/*
zip_algorithm_deflate.c -- deflate (de)compression routines
- Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2017-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_algorithm_xz.c b/src/Common/libzip/zip_algorithm_xz.c
index d7a7142d..b0413e01 100644
--- a/src/Common/libzip/zip_algorithm_xz.c
+++ b/src/Common/libzip/zip_algorithm_xz.c
@@ -2,5 +2,5 @@
zip_algorithm_xz.c -- LZMA/XZ (de)compression routines
Bazed on zip_algorithm_deflate.c -- deflate (de)compression routines
- Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2017-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_algorithm_zstd.c b/src/Common/libzip/zip_algorithm_zstd.c
index d005da9d..b2aa2132 100644
--- a/src/Common/libzip/zip_algorithm_zstd.c
+++ b/src/Common/libzip/zip_algorithm_zstd.c
@@ -1,5 +1,5 @@
/*
zip_algorithm_zstd.c -- zstd (de)compression routines
- Copyright (C) 2020-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2020-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_buffer.c b/src/Common/libzip/zip_buffer.c
index e2103f04..de22bab1 100644
--- a/src/Common/libzip/zip_buffer.c
+++ b/src/Common/libzip/zip_buffer.c
@@ -1,5 +1,5 @@
/*
zip_buffer.c -- bounds checked access to memory buffer
- Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -307,6 +307,5 @@ _zip_buffer_put_8(zip_buffer_t *buffer, zip_uint8_t i) {
-int
-_zip_buffer_set_offset(zip_buffer_t *buffer, zip_uint64_t offset) {
+int _zip_buffer_set_offset(zip_buffer_t *buffer, zip_uint64_t offset) {
if (offset > buffer->size) {
buffer->ok = false;
diff --git a/src/Common/libzip/zip_close.c b/src/Common/libzip/zip_close.c
index ddc2c245..4313592c 100644
--- a/src/Common/libzip/zip_close.c
+++ b/src/Common/libzip/zip_close.c
@@ -1,5 +1,5 @@
/*
zip_close.c -- close zip archive and update changes
- Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -45,5 +45,5 @@
static int add_data(zip_t *, zip_source_t *, zip_dirent_t *, zip_uint32_t);
static int copy_data(zip_t *, zip_uint64_t);
-static int copy_source(zip_t *, zip_source_t *, zip_int64_t);
+static int copy_source(zip_t *, zip_source_t *, zip_source_t *, zip_int64_t);
static int torrentzip_compare_names(const void *a, const void *b);
static int write_cdir(zip_t *, const zip_filelist_t *, zip_uint64_t);
@@ -469,9 +469,5 @@ add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de, zip_uint32_t changed) {
/* PKWare encryption uses last_mod, make sure it gets the right value. */
if (de->changed & ZIP_DIRENT_LAST_MOD) {
- zip_stat_t st_mtime;
- zip_stat_init(&st_mtime);
- st_mtime.valid = ZIP_STAT_MTIME;
- st_mtime.mtime = de->last_mod;
- if ((src_tmp = _zip_source_window_new(src_final, 0, -1, &st_mtime, 0, NULL, NULL, 0, true, &za->error)) == NULL) {
+ if ((src_tmp = _zip_source_window_new(src_final, 0, -1, NULL, 0, NULL, &de->last_mod, NULL, 0, true, &za->error)) == NULL) {
zip_source_free(src_final);
return -1;
@@ -496,5 +492,5 @@ add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de, zip_uint32_t changed) {
}
- ret = copy_source(za, src_final, data_length);
+ ret = copy_source(za, src_final, src, data_length);
if (zip_source_stat(src_final, &st) < 0) {
@@ -530,8 +526,21 @@ add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de, zip_uint32_t changed) {
if ((de->changed & ZIP_DIRENT_LAST_MOD) == 0) {
- if (st.valid & ZIP_STAT_MTIME)
- de->last_mod = st.mtime;
- else
- time(&de->last_mod);
+ int ret2 = zip_source_get_dos_time(src, &de->last_mod);
+ if (ret2 < 0) {
+ zip_error_set_from_source(&za->error, src);
+ return -1;
+ }
+ if (ret2 == 0) {
+ time_t mtime;
+ if (st.valid & ZIP_STAT_MTIME) {
+ mtime = st.mtime;
+ }
+ else {
+ time(&mtime);
+ }
+ if (_zip_u2d_time(mtime, &de->last_mod, &za->error) < 0) {
+ return -1;
+ }
+ }
}
de->comp_method = st.comp_method;
@@ -606,5 +615,5 @@ copy_data(zip_t *za, zip_uint64_t len) {
static int
-copy_source(zip_t *za, zip_source_t *src, zip_int64_t data_length) {
+copy_source(zip_t *za, zip_source_t *src, zip_source_t *src_for_length, zip_int64_t data_length) {
DEFINE_BYTE_ARRAY(buf, BUFSIZE);
zip_int64_t n, current;
@@ -629,5 +638,11 @@ copy_source(zip_t *za, zip_source_t *src, zip_int64_t data_length) {
}
if (n == BUFSIZE && za->progress && data_length > 0) {
- current += n;
+ zip_int64_t t;
+ t = zip_source_tell(src_for_length);
+ if (t >= 0) {
+ current = t;
+ } else {
+ current += n;
+ }
if (_zip_progress_update(za->progress, (double)current / (double)data_length) != 0) {
zip_error_set(&za->error, ZIP_ER_CANCELLED, 0);
@@ -743,3 +758,3 @@ static int torrentzip_compare_names(const void *a, const void *b) {
return strcasecmp(aname, bname);
-} \ No newline at end of file
+}
diff --git a/src/Common/libzip/zip_crypto.h b/src/Common/libzip/zip_crypto.h
index 0d74d1a4..805af52f 100644
--- a/src/Common/libzip/zip_crypto.h
+++ b/src/Common/libzip/zip_crypto.h
@@ -1,5 +1,5 @@
/*
zip_crypto.h -- crypto definitions
- Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2017-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_crypto_commoncrypto.c b/src/Common/libzip/zip_crypto_commoncrypto.c
index b198be56..e6cb72d3 100644
--- a/src/Common/libzip/zip_crypto_commoncrypto.c
+++ b/src/Common/libzip/zip_crypto_commoncrypto.c
@@ -1,5 +1,5 @@
/*
zip_crypto_commoncrypto.c -- CommonCrypto wrapper.
- Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2018-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_crypto_commoncrypto.h b/src/Common/libzip/zip_crypto_commoncrypto.h
index 01828cc6..82dafdb4 100644
--- a/src/Common/libzip/zip_crypto_commoncrypto.h
+++ b/src/Common/libzip/zip_crypto_commoncrypto.h
@@ -1,5 +1,5 @@
/*
zip_crypto_commoncrypto.h -- definitions for CommonCrypto wrapper.
- Copyright (C) 2018 Dieter Baron and Thomas Klausner
+ Copyright (C) 2018-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_crypto_gnutls.c b/src/Common/libzip/zip_crypto_gnutls.c
index 1a25aa12..fcc7fdfd 100644
--- a/src/Common/libzip/zip_crypto_gnutls.c
+++ b/src/Common/libzip/zip_crypto_gnutls.c
@@ -1,5 +1,5 @@
/*
zip_crypto_gnutls.c -- GnuTLS wrapper.
- Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2018-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_crypto_gnutls.h b/src/Common/libzip/zip_crypto_gnutls.h
index dc8b97a4..a6fa508a 100644
--- a/src/Common/libzip/zip_crypto_gnutls.h
+++ b/src/Common/libzip/zip_crypto_gnutls.h
@@ -1,5 +1,5 @@
/*
zip_crypto_gnutls.h -- definitions for GnuTLS wrapper.
- Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2018-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_crypto_mbedtls.c b/src/Common/libzip/zip_crypto_mbedtls.c
index 84544a82..0ed66c0d 100644
--- a/src/Common/libzip/zip_crypto_mbedtls.c
+++ b/src/Common/libzip/zip_crypto_mbedtls.c
@@ -1,5 +1,5 @@
/*
zip_crypto_mbedtls.c -- mbed TLS wrapper
- Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2018-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_crypto_mbedtls.h b/src/Common/libzip/zip_crypto_mbedtls.h
index 1151fff7..30ce21c9 100644
--- a/src/Common/libzip/zip_crypto_mbedtls.h
+++ b/src/Common/libzip/zip_crypto_mbedtls.h
@@ -1,5 +1,5 @@
/*
zip_crypto_mbedtls.h -- definitions for mbedtls wrapper
- Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2018-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_crypto_openssl.c b/src/Common/libzip/zip_crypto_openssl.c
index 7f1da10e..9e9e8e7c 100644
--- a/src/Common/libzip/zip_crypto_openssl.c
+++ b/src/Common/libzip/zip_crypto_openssl.c
@@ -1,5 +1,5 @@
/*
zip_crypto_openssl.c -- OpenSSL wrapper.
- Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2018-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -127,6 +127,7 @@ _zip_crypto_aes_free(_zip_crypto_aes_t *aes) {
bool
_zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out) {
- int len;
- if (EVP_EncryptUpdate(aes, out, &len, in, ZIP_CRYPTO_AES_BLOCK_LENGTH) != 1) {
+ int len = 0;
+ if (EVP_EncryptUpdate(aes, out, &len, in, ZIP_CRYPTO_AES_BLOCK_LENGTH) != 1
+ || len != ZIP_CRYPTO_AES_BLOCK_LENGTH) {
return false;
}
@@ -215,9 +216,9 @@ bool
_zip_crypto_hmac_output(_zip_crypto_hmac_t *hmac, zip_uint8_t *data) {
#ifdef USE_OPENSSL_3_API
- size_t length;
+ size_t length = 0;
return EVP_MAC_final(hmac->ctx, data, &length, ZIP_CRYPTO_SHA1_LENGTH) == 1 && length == ZIP_CRYPTO_SHA1_LENGTH;
#else
- unsigned int length;
- return HMAC_Final(hmac, data, &length) == 1;
+ unsigned int length = 0;
+ return HMAC_Final(hmac, data, &length) == 1 && length == ZIP_CRYPTO_SHA1_LENGTH;
#endif
}
diff --git a/src/Common/libzip/zip_crypto_openssl.h b/src/Common/libzip/zip_crypto_openssl.h
index 198a9071..e593ec55 100644
--- a/src/Common/libzip/zip_crypto_openssl.h
+++ b/src/Common/libzip/zip_crypto_openssl.h
@@ -1,5 +1,5 @@
/*
zip_crypto_openssl.h -- definitions for OpenSSL wrapper.
- Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2018-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_crypto_win.c b/src/Common/libzip/zip_crypto_win.c
index ee3ccc30..6d923038 100644
--- a/src/Common/libzip/zip_crypto_win.c
+++ b/src/Common/libzip/zip_crypto_win.c
@@ -1,5 +1,5 @@
/*
zip_crypto_win.c -- Windows Crypto API wrapper.
- Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2018-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -38,7 +38,4 @@
#include "zip_crypto.h"
-#define WIN32_LEAN_AND_MEAN
-#define NOCRYPT
-
#include <windows.h>
diff --git a/src/Common/libzip/zip_crypto_win.h b/src/Common/libzip/zip_crypto_win.h
index a533fe2d..3f05b621 100644
--- a/src/Common/libzip/zip_crypto_win.h
+++ b/src/Common/libzip/zip_crypto_win.h
@@ -1,5 +1,5 @@
/*
zip_crypto_win.h -- Windows Crypto API wrapper.
- Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2018-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_delete.c b/src/Common/libzip/zip_delete.c
index 676c16bf..4eefdd97 100644
--- a/src/Common/libzip/zip_delete.c
+++ b/src/Common/libzip/zip_delete.c
@@ -1,5 +1,5 @@
/*
zip_delete.c -- delete file from zip archive
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_dir_add.c b/src/Common/libzip/zip_dir_add.c
index c0108191..01d8ec9d 100644
--- a/src/Common/libzip/zip_dir_add.c
+++ b/src/Common/libzip/zip_dir_add.c
@@ -1,5 +1,5 @@
/*
zip_dir_add.c -- add directory
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_dirent.c b/src/Common/libzip/zip_dirent.c
index 45a2a6a2..24bc6abf 100644
--- a/src/Common/libzip/zip_dirent.c
+++ b/src/Common/libzip/zip_dirent.c
@@ -1,5 +1,5 @@
/*
zip_dirent.c -- read directory entry (local or central), clean dirent
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -42,5 +42,5 @@
#include "zipint.h"
-static zip_string_t *_zip_dirent_process_ef_utf_8(const zip_dirent_t *de, zip_uint16_t id, zip_string_t *str);
+static zip_string_t *_zip_dirent_process_ef_utf_8(const zip_dirent_t *de, zip_uint16_t id, zip_string_t *str, bool check_consistency);
static zip_extra_field_t *_zip_ef_utf8(zip_uint16_t, zip_string_t *, zip_error_t *);
static bool _zip_dirent_process_winzip_aes(zip_dirent_t *de, zip_error_t *error);
@@ -51,6 +51,7 @@ _zip_cdir_free(zip_cdir_t *cd) {
zip_uint64_t i;
- if (!cd)
+ if (cd == NULL) {
return;
+ }
for (i = 0; i < cd->nentry; i++)
@@ -63,5 +64,5 @@ _zip_cdir_free(zip_cdir_t *cd) {
zip_cdir_t *
-_zip_cdir_new(zip_uint64_t nentry, zip_error_t *error) {
+_zip_cdir_new(zip_error_t *error) {
zip_cdir_t *cd;
@@ -77,9 +78,4 @@ _zip_cdir_new(zip_uint64_t nentry, zip_error_t *error) {
cd->is_zip64 = false;
- if (!_zip_cdir_grow(cd, nentry, error)) {
- _zip_cdir_free(cd);
- return NULL;
- }
-
return cd;
}
@@ -127,6 +123,4 @@ _zip_cdir_write(zip_t *za, const zip_filelist_t *filelist, zip_uint64_t survivor
zip_int64_t off;
zip_uint64_t i;
- bool is_zip64;
- int ret;
zip_uint32_t cdir_crc;
@@ -137,6 +131,4 @@ _zip_cdir_write(zip_t *za, const zip_filelist_t *filelist, zip_uint64_t survivor
offset = (zip_uint64_t)off;
- is_zip64 = false;
-
if (ZIP_WANT_TORRENTZIP(za)) {
cdir_crc = (zip_uint32_t)crc32(0, NULL, 0);
@@ -147,8 +139,8 @@ _zip_cdir_write(zip_t *za, const zip_filelist_t *filelist, zip_uint64_t survivor
zip_entry_t *entry = za->entry + filelist[i].idx;
- if ((ret = _zip_dirent_write(za, entry->changes ? entry->changes : entry->orig, ZIP_FL_CENTRAL)) < 0)
+ if (_zip_dirent_write(za, entry->changes ? entry->changes : entry->orig, ZIP_FL_CENTRAL) < 0) {
+ za->write_crc = NULL;
return -1;
- if (ret)
- is_zip64 = true;
+ }
}
@@ -161,8 +153,4 @@ _zip_cdir_write(zip_t *za, const zip_filelist_t *filelist, zip_uint64_t survivor
size = (zip_uint64_t)off - offset;
- if (offset > ZIP_UINT32_MAX || survivors > ZIP_UINT16_MAX) {
- is_zip64 = true;
- }
-
if ((buffer = _zip_buffer_new(buf, sizeof(buf))) == NULL) {
zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
@@ -170,5 +158,5 @@ _zip_cdir_write(zip_t *za, const zip_filelist_t *filelist, zip_uint64_t survivor
}
- if (is_zip64) {
+ if (survivors > ZIP_UINT16_MAX || offset > ZIP_UINT32_MAX || size > ZIP_UINT32_MAX) {
_zip_buffer_put(buffer, EOCD64_MAGIC, 4);
_zip_buffer_put_64(buffer, EOCD64LEN - 12);
@@ -295,9 +283,11 @@ _zip_dirent_init(zip_dirent_t *de) {
de->crc_valid = true;
+ de->last_mod_mtime_valid = false;
de->version_madeby = 63 | (ZIP_OPSYS_DEFAULT << 8);
de->version_needed = 10; /* 1.0 */
de->bitflags = 0;
de->comp_method = ZIP_CM_DEFAULT;
- de->last_mod = 0;
+ de->last_mod.date = 0;
+ de->last_mod.time = 0;
de->crc = 0;
de->comp_size = 0;
@@ -337,5 +327,5 @@ _zip_dirent_new(void) {
-/* _zip_dirent_read(zde, fp, bufp, left, localp, error):
+/*
Fills the zip directory entry zde.
@@ -348,9 +338,10 @@ _zip_dirent_new(void) {
zip_int64_t
-_zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, bool local, zip_error_t *error) {
+_zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, bool local, zip_uint64_t central_compressed_size, bool check_consistency, zip_error_t *error) {
zip_uint8_t buf[CDENTRYSIZE];
- zip_uint16_t dostime, dosdate;
zip_uint32_t size, variable_size;
zip_uint16_t filename_len, comment_len, ef_len;
+ zip_string_t *utf8_string;
+ bool is_zip64 = false;
bool from_buffer = (buffer != NULL);
@@ -390,7 +381,6 @@ _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, boo
/* convert to time_t */
- dostime = _zip_buffer_get_16(buffer);
- dosdate = _zip_buffer_get_16(buffer);
- zde->last_mod = _zip_d2u_time(dostime, dosdate);
+ zde->last_mod.time = _zip_buffer_get_16(buffer);
+ zde->last_mod.date = _zip_buffer_get_16(buffer);
zde->crc = _zip_buffer_get_32(buffer);
@@ -459,5 +449,5 @@ _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, boo
if (filename_len) {
zde->filename = _zip_read_string(buffer, src, filename_len, 1, error);
- if (!zde->filename) {
+ if (zde->filename == NULL) {
if (zip_error_code_zip(error) == ZIP_ER_EOF) {
zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_VARIABLE_SIZE_OVERFLOW);
@@ -503,5 +493,5 @@ _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, boo
if (comment_len) {
zde->comment = _zip_read_string(buffer, src, comment_len, 0, error);
- if (!zde->comment) {
+ if (zde->comment == NULL) {
if (!from_buffer) {
_zip_buffer_free(buffer);
@@ -520,6 +510,22 @@ _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, boo
}
- zde->filename = _zip_dirent_process_ef_utf_8(zde, ZIP_EF_UTF_8_NAME, zde->filename);
- zde->comment = _zip_dirent_process_ef_utf_8(zde, ZIP_EF_UTF_8_COMMENT, zde->comment);
+ if ((utf8_string = _zip_dirent_process_ef_utf_8(zde, ZIP_EF_UTF_8_NAME, zde->filename, check_consistency)) == NULL && zde->filename != NULL) {
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_UTF8_FILENAME_MISMATCH);
+ if (!from_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return -1;
+ }
+ zde->filename = utf8_string;
+ if (!local) {
+ if ((utf8_string = _zip_dirent_process_ef_utf_8(zde, ZIP_EF_UTF_8_COMMENT, zde->comment, check_consistency)) == NULL && zde->comment != NULL) {
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_UTF8_COMMENT_MISMATCH);
+ if (!from_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return -1;
+ }
+ zde->comment = utf8_string;
+ }
/* Zip64 */
@@ -536,4 +542,5 @@ _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, boo
}
}
+ is_zip64 = true;
}
@@ -546,8 +553,38 @@ _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, boo
return -1;
}
+
if (!from_buffer) {
_zip_buffer_free(buffer);
}
+ if (local && zde->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) {
+ zip_uint32_t df_crc;
+ zip_uint64_t df_comp_size, df_uncomp_size;
+ if (zip_source_seek(src, central_compressed_size, SEEK_CUR) != 0 || (buffer = _zip_buffer_new_from_source(src, MAX_DATA_DESCRIPTOR_LENGTH, buf, error)) == NULL) {
+ return -1;
+ }
+ if (memcmp(_zip_buffer_peek(buffer, MAGIC_LEN), DATADES_MAGIC, MAGIC_LEN) == 0) {
+ _zip_buffer_skip(buffer, MAGIC_LEN);
+ }
+ df_crc = _zip_buffer_get_32(buffer);
+ df_comp_size = is_zip64 ? _zip_buffer_get_64(buffer) : _zip_buffer_get_32(buffer);
+ df_uncomp_size = is_zip64 ? _zip_buffer_get_64(buffer) : _zip_buffer_get_32(buffer);
+
+ if (!_zip_buffer_ok(buffer)) {
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ _zip_buffer_free(buffer);
+ return -1;
+ }
+ _zip_buffer_free(buffer);
+
+ if ((zde->crc != 0 && zde->crc != df_crc) || (zde->comp_size != 0 && zde->comp_size != df_comp_size) || (zde->uncomp_size != 0 && zde->uncomp_size != df_uncomp_size)) {
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_DATA_DESCRIPTOR_MISMATCH);
+ return -1;
+ }
+ zde->crc = df_crc;
+ zde->comp_size = df_comp_size;
+ zde->uncomp_size = df_uncomp_size;
+ }
+
/* zip_source_seek / zip_source_tell don't support values > ZIP_INT64_MAX */
if (zde->offset > ZIP_INT64_MAX) {
@@ -565,5 +602,6 @@ _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, boo
}
-bool zip_dirent_process_ef_zip64(zip_dirent_t* zde, const zip_uint8_t* ef, zip_uint64_t got_len, bool local, zip_error_t* error) {
+bool
+zip_dirent_process_ef_zip64(zip_dirent_t *zde, const zip_uint8_t *ef, zip_uint64_t got_len, bool local, zip_error_t *error) {
zip_buffer_t *ef_buffer;
@@ -626,5 +664,5 @@ bool zip_dirent_process_ef_zip64(zip_dirent_t* zde, const zip_uint8_t* ef, zip_u
static zip_string_t *
-_zip_dirent_process_ef_utf_8(const zip_dirent_t *de, zip_uint16_t id, zip_string_t *str) {
+_zip_dirent_process_ef_utf_8(const zip_dirent_t *de, zip_uint16_t id, zip_string_t *str, bool check_consistency) {
zip_uint16_t ef_len;
zip_uint32_t ef_crc;
@@ -649,4 +687,12 @@ _zip_dirent_process_ef_utf_8(const zip_dirent_t *de, zip_uint16_t id, zip_string
if (ef_str != NULL) {
+ if (check_consistency) {
+ if (!_zip_string_equal(str, ef_str) && _zip_string_is_ascii(ef_str)) {
+ _zip_string_free(ef_str);
+ _zip_buffer_free(buffer);
+ return NULL;
+ }
+ }
+
_zip_string_free(str);
str = ef_str;
@@ -689,16 +735,16 @@ _zip_dirent_process_winzip_aes(zip_dirent_t *de, zip_error_t *error) {
crc_valid = true;
switch (_zip_buffer_get_16(buffer)) {
- case 1:
- break;
+ case 1:
+ break;
- case 2:
- crc_valid = false;
- /* TODO: When checking consistency, check that crc is 0. */
- break;
-
- default:
- zip_error_set(error, ZIP_ER_ENCRNOTSUPP, 0);
- _zip_buffer_free(buffer);
- return false;
+ case 2:
+ crc_valid = false;
+ /* TODO: When checking consistency, check that crc is 0. */
+ break;
+
+ default:
+ zip_error_set(error, ZIP_ER_ENCRNOTSUPP, 0);
+ _zip_buffer_free(buffer);
+ return false;
}
@@ -788,5 +834,5 @@ _zip_dirent_size(zip_source_t *src, zip_uint16_t flags, zip_error_t *error) {
int
_zip_dirent_write(zip_t *za, zip_dirent_t *de, zip_flags_t flags) {
- zip_uint16_t dostime, dosdate;
+ zip_dostime_t dostime;
zip_encoding_type_t com_enc, name_enc;
zip_extra_field_t *ef;
@@ -927,12 +973,12 @@ _zip_dirent_write(zip_t *za, zip_dirent_t *de, zip_flags_t flags) {
if (ZIP_WANT_TORRENTZIP(za)) {
- dostime = 0xbc00;
- dosdate = 0x2198;
+ dostime.time = 0xbc00;
+ dostime.date = 0x2198;
}
else {
- _zip_u2d_time(de->last_mod, &dostime, &dosdate);
+ dostime = de->last_mod;
}
- _zip_buffer_put_16(buffer, dostime);
- _zip_buffer_put_16(buffer, dosdate);
+ _zip_buffer_put_16(buffer, dostime.time);
+ _zip_buffer_put_16(buffer, dostime.date);
if (is_winzip_aes && de->uncomp_size < 20) {
@@ -1035,5 +1081,5 @@ _zip_dirent_write(zip_t *za, zip_dirent_t *de, zip_flags_t flags) {
time_t
-_zip_d2u_time(zip_uint16_t dtime, zip_uint16_t ddate) {
+_zip_d2u_time(const zip_dostime_t *dtime) {
struct tm tm;
@@ -1043,11 +1089,11 @@ _zip_d2u_time(zip_uint16_t dtime, zip_uint16_t ddate) {
tm.tm_isdst = -1;
- tm.tm_year = ((ddate >> 9) & 127) + 1980 - 1900;
- tm.tm_mon = ((ddate >> 5) & 15) - 1;
- tm.tm_mday = ddate & 31;
+ tm.tm_year = ((dtime->date >> 9) & 127) + 1980 - 1900;
+ tm.tm_mon = ((dtime->date >> 5) & 15) - 1;
+ tm.tm_mday = dtime->date & 31;
- tm.tm_hour = (dtime >> 11) & 31;
- tm.tm_min = (dtime >> 5) & 63;
- tm.tm_sec = (dtime << 1) & 62;
+ tm.tm_hour = (dtime->time >> 11) & 31;
+ tm.tm_min = (dtime->time >> 5) & 63;
+ tm.tm_sec = (dtime->time << 1) & 62;
return mktime(&tm);
@@ -1120,6 +1166,6 @@ _zip_get_dirent(zip_t *za, zip_uint64_t idx, zip_flags_t flags, zip_error_t *err
-void
-_zip_u2d_time(time_t intime, zip_uint16_t *dtime, zip_uint16_t *ddate) {
+int
+_zip_u2d_time(time_t intime, zip_dostime_t *dtime, zip_error_t *ze) {
struct tm *tpm;
struct tm tm;
@@ -1127,7 +1173,10 @@ _zip_u2d_time(time_t intime, zip_uint16_t *dtime, zip_uint16_t *ddate) {
if (tpm == NULL) {
/* if localtime fails, return an arbitrary date (1980-01-01 00:00:00) */
- *ddate = (1 << 5) + 1;
- *dtime = 0;
- return;
+ dtime->date = (1 << 5) + 1;
+ dtime->time = 0;
+ if (ze) {
+ zip_error_set(ze, ZIP_ER_INVAL, errno);
+ }
+ return -1;
}
if (tpm->tm_year < 80) {
@@ -1135,6 +1184,8 @@ _zip_u2d_time(time_t intime, zip_uint16_t *dtime, zip_uint16_t *ddate) {
}
- *ddate = (zip_uint16_t)(((tpm->tm_year + 1900 - 1980) << 9) + ((tpm->tm_mon + 1) << 5) + tpm->tm_mday);
- *dtime = (zip_uint16_t)(((tpm->tm_hour) << 11) + ((tpm->tm_min) << 5) + ((tpm->tm_sec) >> 1));
+ dtime->date = (zip_uint16_t)(((tpm->tm_year + 1900 - 1980) << 9) + ((tpm->tm_mon + 1) << 5) + tpm->tm_mday);
+ dtime->time = (zip_uint16_t)(((tpm->tm_hour) << 11) + ((tpm->tm_min) << 5) + ((tpm->tm_sec) >> 1));
+
+ return 0;
}
@@ -1193,8 +1244,9 @@ _zip_dirent_apply_attributes(zip_dirent_t *de, zip_file_attributes_t *attributes
*/
-void zip_dirent_torrentzip_normalize(zip_dirent_t *de) {
+void
+zip_dirent_torrentzip_normalize(zip_dirent_t *de) {
de->version_madeby = 0;
de->version_needed = 20; /* 2.0 */
- de->bitflags = 2; /* maximum compression */
+ de->bitflags = 2; /* maximum compression */
de->comp_method = ZIP_CM_DEFLATE;
de->compression_level = TORRENTZIP_COMPRESSION_FLAGS;
@@ -1204,4 +1256,20 @@ void zip_dirent_torrentzip_normalize(zip_dirent_t *de) {
/* last_mod, extra_fields, and comment are normalized in zip_dirent_write() directly */
+}
+int
+zip_dirent_check_consistency(zip_dirent_t *dirent) {
+ if (dirent->comp_method == ZIP_CM_STORE && dirent->comp_size != dirent->uncomp_size) {
+ return ZIP_ER_DETAIL_STORED_SIZE_MISMATCH;
+ }
+ return 0;
}
+
+time_t zip_dirent_get_last_mod_mtime(zip_dirent_t *de) {
+ if (!de->last_mod_mtime_valid) {
+ de->last_mod_mtime = _zip_d2u_time(&de->last_mod);
+ de->last_mod_mtime_valid = true;
+ }
+
+ return de->last_mod_mtime;
+} \ No newline at end of file
diff --git a/src/Common/libzip/zip_discard.c b/src/Common/libzip/zip_discard.c
index d1dc4f8b..841a80e2 100644
--- a/src/Common/libzip/zip_discard.c
+++ b/src/Common/libzip/zip_discard.c
@@ -1,5 +1,5 @@
/*
zip_discard.c -- discard and free struct zip
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_entry.c b/src/Common/libzip/zip_entry.c
index 35a36e4a..dd25e61f 100644
--- a/src/Common/libzip/zip_entry.c
+++ b/src/Common/libzip/zip_entry.c
@@ -1,5 +1,5 @@
/*
zip_entry.c -- struct zip_entry helper functions
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_err_str.c b/src/Common/libzip/zip_err_str.c
index 28af773b..fb4b69fa 100644
--- a/src/Common/libzip/zip_err_str.c
+++ b/src/Common/libzip/zip_err_str.c
@@ -50,4 +50,5 @@ const struct _zip_err_info _zip_err_str[] = {
{ N, "Unexpected length of data" },
{ N, "Not allowed in torrentzip" },
+ { N, "Possibly truncated or corrupted zip archive" },
};
@@ -75,4 +76,9 @@ const struct _zip_err_info _zip_err_details[] = {
{ E, "extra field length is invalid" },
{ E, "file length in header doesn't match actual file length" },
+ { E, "compressed and uncompressed sizes don't match for stored file" },
+ { E, "local header and data descriptor do not match" },
+ { G, "EOCD64 and EOCD64 locator do not match" },
+ { E, "UTF-8 filename is ASCII and doesn't match filename" },
+ { E, "UTF-8 comment is ASCII and doesn't match comment" },
};
diff --git a/src/Common/libzip/zip_error.c b/src/Common/libzip/zip_error.c
index c498e086..da910d44 100644
--- a/src/Common/libzip/zip_error.c
+++ b/src/Common/libzip/zip_error.c
@@ -1,5 +1,5 @@
/*
zip_error.c -- zip_error_t helper functions
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_error_clear.c b/src/Common/libzip/zip_error_clear.c
index 94ff5062..04062719 100644
--- a/src/Common/libzip/zip_error_clear.c
+++ b/src/Common/libzip/zip_error_clear.c
@@ -1,5 +1,5 @@
/*
zip_error_clear.c -- clear zip error
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_error_get.c b/src/Common/libzip/zip_error_get.c
index c0418f0d..2a5b3eaf 100644
--- a/src/Common/libzip/zip_error_get.c
+++ b/src/Common/libzip/zip_error_get.c
@@ -1,5 +1,5 @@
/*
zip_error_get.c -- get zip error
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_error_get_sys_type.c b/src/Common/libzip/zip_error_get_sys_type.c
index a22ffb03..973d26c0 100644
--- a/src/Common/libzip/zip_error_get_sys_type.c
+++ b/src/Common/libzip/zip_error_get_sys_type.c
@@ -1,5 +1,5 @@
/*
zip_error_get_sys_type.c -- return type of system error code
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_error_strerror.c b/src/Common/libzip/zip_error_strerror.c
index fe04cbb4..5be54b38 100644
--- a/src/Common/libzip/zip_error_strerror.c
+++ b/src/Common/libzip/zip_error_strerror.c
@@ -1,5 +1,5 @@
/*
zip_error_sterror.c -- get string representation of struct zip_error
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -50,4 +50,7 @@ zip_error_strerror(zip_error_t *err) {
if (err->zip_err < 0 || err->zip_err >= _zip_err_str_count) {
system_error_buffer = (char *)malloc(128);
+ if (system_error_buffer == NULL) {
+ return _zip_err_str[ZIP_ER_MEMORY].description;
+ }
snprintf_s(system_error_buffer, 128, "Unknown error %d", err->zip_err);
system_error_buffer[128 - 1] = '\0'; /* make sure string is NUL-terminated */
@@ -62,4 +65,7 @@ zip_error_strerror(zip_error_t *err) {
size_t len = strerrorlen_s(err->sys_err) + 1;
system_error_buffer = malloc(len);
+ if (system_error_buffer == NULL) {
+ return _zip_err_str[ZIP_ER_MEMORY].description;
+ }
strerror_s(system_error_buffer, len, err->sys_err);
system_error_string = system_error_buffer;
@@ -80,4 +86,7 @@ zip_error_strerror(zip_error_t *err) {
else if (error >= _zip_err_details_count) {
system_error_buffer = (char *)malloc(128);
+ if (system_error_buffer == NULL) {
+ return _zip_err_str[ZIP_ER_MEMORY].description;
+ }
snprintf_s(system_error_buffer, 128, "invalid detail error %u", error);
system_error_buffer[128 - 1] = '\0'; /* make sure string is NUL-terminated */
@@ -86,4 +95,7 @@ zip_error_strerror(zip_error_t *err) {
else if (_zip_err_details[error].type == ZIP_DETAIL_ET_ENTRY && index < MAX_DETAIL_INDEX) {
system_error_buffer = (char *)malloc(128);
+ if (system_error_buffer == NULL) {
+ return _zip_err_str[ZIP_ER_MEMORY].description;
+ }
snprintf_s(system_error_buffer, 128, "entry %d: %s", index, _zip_err_details[error].description);
system_error_buffer[128 - 1] = '\0'; /* make sure string is NUL-terminated */
diff --git a/src/Common/libzip/zip_error_to_str.c b/src/Common/libzip/zip_error_to_str.c
index b60b7881..4186e3a4 100644
--- a/src/Common/libzip/zip_error_to_str.c
+++ b/src/Common/libzip/zip_error_to_str.c
@@ -1,5 +1,5 @@
/*
zip_error_to_str.c -- get string representation of zip error code
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_extra_field.c b/src/Common/libzip/zip_extra_field.c
index 7aed12ad..52837046 100644
--- a/src/Common/libzip/zip_extra_field.c
+++ b/src/Common/libzip/zip_extra_field.c
@@ -1,5 +1,5 @@
/*
zip_extra_field.c -- manipulate extra fields
- Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2012-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_extra_field_api.c b/src/Common/libzip/zip_extra_field_api.c
index 560c71bb..6f2b4596 100644
--- a/src/Common/libzip/zip_extra_field_api.c
+++ b/src/Common/libzip/zip_extra_field_api.c
@@ -1,5 +1,5 @@
/*
zip_extra_field_api.c -- public extra fields API functions
- Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2012-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -57,8 +57,4 @@ zip_file_extra_field_delete(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_idx, zi
return -1;
}
- if (ZIP_WANT_TORRENTZIP(za)) {
- zip_error_set(&za->error, ZIP_ER_NOT_ALLOWED, 0);
- return -1;
- }
if (_zip_file_extra_field_prepare_for_change(za, idx) < 0)
diff --git a/src/Common/libzip/zip_fclose.c b/src/Common/libzip/zip_fclose.c
index b820d98b..2ef579a0 100644
--- a/src/Common/libzip/zip_fclose.c
+++ b/src/Common/libzip/zip_fclose.c
@@ -1,5 +1,5 @@
/*
zip_fclose.c -- close file in zip archive
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_fdopen.c b/src/Common/libzip/zip_fdopen.c
index e72c55dc..94fe6c7c 100644
--- a/src/Common/libzip/zip_fdopen.c
+++ b/src/Common/libzip/zip_fdopen.c
@@ -1,5 +1,5 @@
/*
zip_fdopen.c -- open read-only archive from file descriptor
- Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_file_add.c b/src/Common/libzip/zip_file_add.c
index c2c41e15..5959d504 100644
--- a/src/Common/libzip/zip_file_add.c
+++ b/src/Common/libzip/zip_file_add.c
@@ -1,5 +1,5 @@
/*
zip_file_add.c -- add file via callback function
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_file_error_clear.c b/src/Common/libzip/zip_file_error_clear.c
index a10bff80..eb9a614e 100644
--- a/src/Common/libzip/zip_file_error_clear.c
+++ b/src/Common/libzip/zip_file_error_clear.c
@@ -1,5 +1,5 @@
/*
zip_file_error_clear.c -- clear zip file error
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_file_error_get.c b/src/Common/libzip/zip_file_error_get.c
index b93117bb..679aeefb 100644
--- a/src/Common/libzip/zip_file_error_get.c
+++ b/src/Common/libzip/zip_file_error_get.c
@@ -1,5 +1,5 @@
/*
zip_file_error_get.c -- get zip file error
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_file_get_comment.c b/src/Common/libzip/zip_file_get_comment.c
index fa998f02..ca04042a 100644
--- a/src/Common/libzip/zip_file_get_comment.c
+++ b/src/Common/libzip/zip_file_get_comment.c
@@ -1,5 +1,5 @@
/*
zip_file_get_comment.c -- get file comment
- Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2006-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_file_get_external_attributes.c b/src/Common/libzip/zip_file_get_external_attributes.c
index a79bb3ed..483557f0 100644
--- a/src/Common/libzip/zip_file_get_external_attributes.c
+++ b/src/Common/libzip/zip_file_get_external_attributes.c
@@ -1,5 +1,5 @@
/*
zip_file_get_external_attributes.c -- get opsys/external attributes
- Copyright (C) 2013-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2013-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_file_get_offset.c b/src/Common/libzip/zip_file_get_offset.c
index 72f4880e..c50def54 100644
--- a/src/Common/libzip/zip_file_get_offset.c
+++ b/src/Common/libzip/zip_file_get_offset.c
@@ -1,5 +1,5 @@
/*
zip_file_get_offset.c -- get offset of file data in archive.
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_file_rename.c b/src/Common/libzip/zip_file_rename.c
index 9ac25814..03101e43 100644
--- a/src/Common/libzip/zip_file_rename.c
+++ b/src/Common/libzip/zip_file_rename.c
@@ -1,5 +1,5 @@
/*
zip_file_rename.c -- rename file in zip archive
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_file_replace.c b/src/Common/libzip/zip_file_replace.c
index 4262d453..ce457ed1 100644
--- a/src/Common/libzip/zip_file_replace.c
+++ b/src/Common/libzip/zip_file_replace.c
@@ -1,5 +1,5 @@
/*
zip_file_replace.c -- replace file via callback function
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -84,4 +84,10 @@ _zip_file_replace(zip_t *za, zip_uint64_t idx, const char *name, zip_source_t *s
}
+ /* delete all extra fields - these are usually data that are
+ * strongly coupled with the original data */
+ if (zip_file_extra_field_delete(za, idx, ZIP_EXTRA_FIELD_ALL, ZIP_FL_CENTRAL | ZIP_FL_LOCAL) < 0) {
+ return -1;
+ }
+
/* does not change any name related data, so we can do it here;
* needed for a double add of the same file name */
diff --git a/src/Common/libzip/zip_file_set_comment.c b/src/Common/libzip/zip_file_set_comment.c
index 570f8e82..fb7b9edd 100644
--- a/src/Common/libzip/zip_file_set_comment.c
+++ b/src/Common/libzip/zip_file_set_comment.c
@@ -1,5 +1,5 @@
/*
zip_file_set_comment.c -- set comment for file in archive
- Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2006-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_file_set_encryption.c b/src/Common/libzip/zip_file_set_encryption.c
index 1cdcd4ab..7bb6cdc7 100644
--- a/src/Common/libzip/zip_file_set_encryption.c
+++ b/src/Common/libzip/zip_file_set_encryption.c
@@ -1,5 +1,5 @@
/*
zip_file_set_encryption.c -- set encryption for file in archive
- Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2016-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_file_set_external_attributes.c b/src/Common/libzip/zip_file_set_external_attributes.c
index 2e0429b8..2f9d30f9 100644
--- a/src/Common/libzip/zip_file_set_external_attributes.c
+++ b/src/Common/libzip/zip_file_set_external_attributes.c
@@ -1,5 +1,5 @@
/*
zip_file_set_external_attributes.c -- set external attributes for entry
- Copyright (C) 2013-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2013-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_file_set_mtime.c b/src/Common/libzip/zip_file_set_mtime.c
index 4126f5a1..e60f7a9a 100644
--- a/src/Common/libzip/zip_file_set_mtime.c
+++ b/src/Common/libzip/zip_file_set_mtime.c
@@ -1,5 +1,5 @@
/*
zip_file_set_mtime.c -- set modification time of entry.
- Copyright (C) 2014-2022 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -34,17 +34,10 @@
#include "zipint.h"
-ZIP_EXTERN int
-zip_file_set_dostime(zip_t *za, zip_uint64_t idx, zip_uint16_t dtime, zip_uint16_t ddate, zip_flags_t flags) {
- time_t mtime;
- mtime = _zip_d2u_time(dtime, ddate);
- return zip_file_set_mtime(za, idx, mtime, flags);
-}
-
-ZIP_EXTERN int
-zip_file_set_mtime(zip_t *za, zip_uint64_t idx, time_t mtime, zip_flags_t flags) {
+static int zip_file_set_time(zip_t *za, zip_uint64_t idx, zip_uint16_t dtime, zip_uint16_t ddate, zip_flags_t flags, time_t *mtime) {
zip_entry_t *e;
- if (_zip_get_dirent(za, idx, 0, NULL) == NULL)
+ if (_zip_get_dirent(za, idx, 0, NULL) == NULL) {
return -1;
+ }
if (ZIP_IS_RDONLY(za)) {
@@ -71,7 +64,30 @@ zip_file_set_mtime(zip_t *za, zip_uint64_t idx, time_t mtime, zip_flags_t flags)
}
- e->changes->last_mod = mtime;
+ e->changes->last_mod.time = dtime;
+ e->changes->last_mod.date = ddate;
+ if (mtime != NULL) {
+ e->changes->last_mod_mtime = *mtime;
+ e->changes->last_mod_mtime_valid = true;
+ }
+ else {
+ e->changes->last_mod_mtime_valid = false;
+ }
e->changes->changed |= ZIP_DIRENT_LAST_MOD;
return 0;
}
+
+ZIP_EXTERN int zip_file_set_dostime(zip_t *za, zip_uint64_t idx, zip_uint16_t dtime, zip_uint16_t ddate, zip_flags_t flags) {
+ return zip_file_set_time(za, idx, dtime, ddate, flags, NULL);
+}
+
+
+ZIP_EXTERN int zip_file_set_mtime(zip_t *za, zip_uint64_t idx, time_t mtime, zip_flags_t flags) {
+ zip_dostime_t dostime;
+
+ if (_zip_u2d_time(mtime, &dostime, &za->error) < 0) {
+ return -1;
+ }
+
+ return zip_file_set_time(za, idx, dostime.time, dostime.date, flags, &mtime);
+}
diff --git a/src/Common/libzip/zip_file_strerror.c b/src/Common/libzip/zip_file_strerror.c
index 5b5a0092..5e896b4c 100644
--- a/src/Common/libzip/zip_file_strerror.c
+++ b/src/Common/libzip/zip_file_strerror.c
@@ -1,5 +1,5 @@
/*
zip_file_sterror.c -- get string representation of zip file error
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_fopen.c b/src/Common/libzip/zip_fopen.c
index e3cde9be..93217f3d 100644
--- a/src/Common/libzip/zip_fopen.c
+++ b/src/Common/libzip/zip_fopen.c
@@ -1,5 +1,5 @@
/*
zip_fopen.c -- open file in zip archive for reading
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_fopen_encrypted.c b/src/Common/libzip/zip_fopen_encrypted.c
index d5880dcb..78143afe 100644
--- a/src/Common/libzip/zip_fopen_encrypted.c
+++ b/src/Common/libzip/zip_fopen_encrypted.c
@@ -1,5 +1,5 @@
/*
zip_fopen_encrypted.c -- open file for reading with password
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_fopen_index.c b/src/Common/libzip/zip_fopen_index.c
index a449b83a..b6676b7d 100644
--- a/src/Common/libzip/zip_fopen_index.c
+++ b/src/Common/libzip/zip_fopen_index.c
@@ -1,5 +1,5 @@
/*
zip_fopen_index.c -- open file in zip archive for reading by index
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_fopen_index_encrypted.c b/src/Common/libzip/zip_fopen_index_encrypted.c
index 40483709..86d69774 100644
--- a/src/Common/libzip/zip_fopen_index_encrypted.c
+++ b/src/Common/libzip/zip_fopen_index_encrypted.c
@@ -1,5 +1,5 @@
/*
zip_fopen_index_encrypted.c -- open file for reading by index w/ password
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_fread.c b/src/Common/libzip/zip_fread.c
index 5b7da46a..17cec4fb 100644
--- a/src/Common/libzip/zip_fread.c
+++ b/src/Common/libzip/zip_fread.c
@@ -1,5 +1,5 @@
/*
zip_fread.c -- read from file
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -40,9 +40,11 @@ zip_fread(zip_file_t *zf, void *outbuf, zip_uint64_t toread) {
zip_int64_t n;
- if (!zf)
+ if (zf == NULL) {
return -1;
+ }
- if (zf->error.zip_err != 0)
+ if (zf->error.zip_err != 0) {
return -1;
+ }
if (toread > ZIP_INT64_MAX) {
diff --git a/src/Common/libzip/zip_fseek.c b/src/Common/libzip/zip_fseek.c
index e68ffd36..107a6f73 100644
--- a/src/Common/libzip/zip_fseek.c
+++ b/src/Common/libzip/zip_fseek.c
@@ -1,5 +1,5 @@
/*
zip_fseek.c -- seek in file
- Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2016-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -37,9 +37,11 @@
ZIP_EXTERN zip_int8_t
zip_fseek(zip_file_t *zf, zip_int64_t offset, int whence) {
- if (!zf)
+ if (zf == NULL) {
return -1;
+ }
- if (zf->error.zip_err != 0)
+ if (zf->error.zip_err != 0) {
return -1;
+ }
if (zip_source_seek(zf->src, offset, whence) < 0) {
@@ -54,5 +56,5 @@ zip_fseek(zip_file_t *zf, zip_int64_t offset, int whence) {
ZIP_EXTERN int
zip_file_is_seekable(zip_file_t *zfile) {
- if (!zfile) {
+ if (zfile == NULL) {
return -1;
}
diff --git a/src/Common/libzip/zip_ftell.c b/src/Common/libzip/zip_ftell.c
index bf3b03d3..6299b2da 100644
--- a/src/Common/libzip/zip_ftell.c
+++ b/src/Common/libzip/zip_ftell.c
@@ -1,5 +1,5 @@
/*
zip_ftell.c -- tell position in file
- Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2016-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -39,9 +39,11 @@ zip_ftell(zip_file_t *zf) {
zip_int64_t res;
- if (!zf)
+ if (zf == NULL) {
return -1;
+ }
- if (zf->error.zip_err != 0)
+ if (zf->error.zip_err != 0) {
return -1;
+ }
res = zip_source_tell(zf->src);
diff --git a/src/Common/libzip/zip_get_archive_comment.c b/src/Common/libzip/zip_get_archive_comment.c
index ea9a00ab..b83e6bcf 100644
--- a/src/Common/libzip/zip_get_archive_comment.c
+++ b/src/Common/libzip/zip_get_archive_comment.c
@@ -1,5 +1,5 @@
/*
zip_get_archive_comment.c -- get archive comment
- Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2006-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_get_archive_flag.c b/src/Common/libzip/zip_get_archive_flag.c
index fc200bdc..80d59914 100644
--- a/src/Common/libzip/zip_get_archive_flag.c
+++ b/src/Common/libzip/zip_get_archive_flag.c
@@ -1,5 +1,5 @@
/*
zip_get_archive_flag.c -- get archive global flag
- Copyright (C) 2008-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2008-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_get_encryption_implementation.c b/src/Common/libzip/zip_get_encryption_implementation.c
index 72e48fe8..28ad3297 100644
--- a/src/Common/libzip/zip_get_encryption_implementation.c
+++ b/src/Common/libzip/zip_get_encryption_implementation.c
@@ -1,5 +1,5 @@
/*
zip_get_encryption_implementation.c -- get encryption implementation
- Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_get_file_comment.c b/src/Common/libzip/zip_get_file_comment.c
index d58e22ba..0284aecd 100644
--- a/src/Common/libzip/zip_get_file_comment.c
+++ b/src/Common/libzip/zip_get_file_comment.c
@@ -1,5 +1,5 @@
/*
zip_get_file_comment.c -- get file comment
- Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2006-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_get_name.c b/src/Common/libzip/zip_get_name.c
index 4828d781..d1c94532 100644
--- a/src/Common/libzip/zip_get_name.c
+++ b/src/Common/libzip/zip_get_name.c
@@ -1,5 +1,5 @@
/*
zip_get_name.c -- get filename for a file in zip file
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_get_num_entries.c b/src/Common/libzip/zip_get_num_entries.c
index 667dc511..b2595dec 100644
--- a/src/Common/libzip/zip_get_num_entries.c
+++ b/src/Common/libzip/zip_get_num_entries.c
@@ -1,5 +1,5 @@
/*
zip_get_num_entries.c -- get number of entries in archive
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_get_num_files.c b/src/Common/libzip/zip_get_num_files.c
index 140e34f9..16d7754b 100644
--- a/src/Common/libzip/zip_get_num_files.c
+++ b/src/Common/libzip/zip_get_num_files.c
@@ -1,5 +1,5 @@
/*
zip_get_num_files.c -- get number of files in archive
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_hash.c b/src/Common/libzip/zip_hash.c
index d3a954ec..8479bec1 100644
--- a/src/Common/libzip/zip_hash.c
+++ b/src/Common/libzip/zip_hash.c
@@ -1,5 +1,5 @@
/*
zip_hash.c -- hash table string -> uint64
- Copyright (C) 2015-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2015-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_io_util.c b/src/Common/libzip/zip_io_util.c
index 9fcd10b4..6ae8aac6 100644
--- a/src/Common/libzip/zip_io_util.c
+++ b/src/Common/libzip/zip_io_util.c
@@ -1,5 +1,5 @@
/*
zip_io_util.c -- I/O helper functions
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -70,6 +70,12 @@ _zip_read_data(zip_buffer_t *buffer, zip_source_t *src, size_t length, bool nulp
}
+// VS2022: Workaround an Internal compiler error for Release ARM (32-bit) build.
+#if _MSC_VER >= 1940 && _MSC_VER < 1950 && defined(_M_ARM) && defined(NDEBUG)
+ size_t l = length + (nulp ? 1 : 0);
+ r = (zip_uint8_t *)malloc(l);
+#else
r = (zip_uint8_t *)malloc(length + (nulp ? 1 : 0));
- if (!r) {
+#endif
+ if (r == NULL) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
return NULL;
diff --git a/src/Common/libzip/zip_libzip_version.c b/src/Common/libzip/zip_libzip_version.c
index 4200727f..139b250f 100644
--- a/src/Common/libzip/zip_libzip_version.c
+++ b/src/Common/libzip/zip_libzip_version.c
@@ -1,5 +1,5 @@
/*
zip_libzip_version.c -- return run-time version of library
- Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2017-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_memdup.c b/src/Common/libzip/zip_memdup.c
index 75d72c61..6ac9a5a2 100644
--- a/src/Common/libzip/zip_memdup.c
+++ b/src/Common/libzip/zip_memdup.c
@@ -1,5 +1,5 @@
/*
zip_memdup.c -- internal zip function, "strdup" with len
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -46,5 +46,5 @@ _zip_memdup(const void *mem, size_t len, zip_error_t *error) {
ret = malloc(len);
- if (!ret) {
+ if (ret == NULL) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
return NULL;
diff --git a/src/Common/libzip/zip_new.c b/src/Common/libzip/zip_new.c
index 4f69c8a2..68e1588f 100644
--- a/src/Common/libzip/zip_new.c
+++ b/src/Common/libzip/zip_new.c
@@ -1,5 +1,5 @@
/*
zip_new.c -- create and init struct zip
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -47,5 +47,5 @@ _zip_new(zip_error_t *error) {
za = (zip_t *)malloc(sizeof(struct zip));
- if (!za) {
+ if (za == NULL) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
return NULL;
@@ -69,4 +69,5 @@ _zip_new(zip_error_t *error) {
za->open_source = NULL;
za->progress = NULL;
+ za->torrent_mtime = 0;
return za;
diff --git a/src/Common/libzip/zip_open.c b/src/Common/libzip/zip_open.c
index ee7e9dec..9dccad61 100644
--- a/src/Common/libzip/zip_open.c
+++ b/src/Common/libzip/zip_open.c
@@ -1,5 +1,5 @@
/*
zip_open.c -- open zip archive by name
- Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -32,5 +32,4 @@
*/
-
#include <limits.h>
#include <stdio.h>
@@ -40,5 +39,18 @@
#include "zipint.h"
-typedef enum { EXISTS_ERROR = -1, EXISTS_NOT = 0, EXISTS_OK } exists_t;
+typedef enum {
+ EXISTS_ERROR = -1,
+ EXISTS_NOT = 0,
+ EXISTS_OK
+} exists_t;
+typedef enum {
+ CDIR_OK,
+ CDIR_INVALID,
+ CDIR_NOT_FOUND
+
+} cdir_status_t;
+
+static bool check_eocd(zip_cdir_t *cd, unsigned int flags, zip_error_t *error);
+static bool check_magic(zip_uint64_t offset, zip_buffer_t *buffer, zip_uint64_t buffer_offset, zip_source_t *src, const char* magic);
static zip_t *_zip_allocate_new(zip_source_t *src, unsigned int flags, zip_error_t *error);
static zip_int64_t _zip_checkcons(zip_t *za, zip_cdir_t *cdir, zip_error_t *error);
@@ -47,8 +59,8 @@ static zip_cdir_t *_zip_find_central_dir(zip_t *za, zip_uint64_t len);
static exists_t _zip_file_exists(zip_source_t *src, zip_error_t *error);
static int _zip_headercomp(const zip_dirent_t *, const zip_dirent_t *);
-static const unsigned char *_zip_memmem(const unsigned char *, size_t, const unsigned char *, size_t);
-static zip_cdir_t *_zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_error_t *error);
-static zip_cdir_t *_zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *error);
-static zip_cdir_t *_zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *error);
+static bool _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_cdir_t **cdirp, zip_error_t *error);
+static zip_cdir_t *_zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_error_t *error);
+static cdir_status_t _zip_read_eocd64(zip_cdir_t *cdir, zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *error);
+static const unsigned char *find_eocd(zip_buffer_t *buffer, const unsigned char *last);
@@ -145,4 +157,25 @@ zip_open_from_source(zip_source_t *src, int _flags, zip_error_t *error) {
+static bool
+_is_truncated_zip(zip_source_t *src) {
+ unsigned char data[4];
+ /* check if the source is a truncated zip archive: true if yes, no
+ if not or can't be determined */
+ if (zip_source_seek(src, 0, SEEK_SET) < 0) {
+ return false;
+ }
+
+ if (zip_source_read(src, data, 4) != 4) {
+ return false;
+ }
+
+ if (memcmp(data, LOCAL_MAGIC, 4) == 0) {
+ /* file starts with a ZIP local header signature */
+ return true;
+ }
+ return false;
+}
+
+
zip_t *
_zip_open(zip_source_t *src, unsigned int flags, zip_error_t *error) {
@@ -175,4 +208,10 @@ _zip_open(zip_source_t *src, unsigned int flags, zip_error_t *error) {
if ((cdir = _zip_find_central_dir(za, len)) == NULL) {
_zip_error_copy(error, &za->error);
+ if (zip_error_code_zip(error) == ZIP_ER_NOZIP) {
+ /* not a zip - find out if it's truncated */
+ if (_is_truncated_zip(src)) {
+ zip_error_set(error, ZIP_ER_TRUNCATED_ZIP, 0);
+ }
+ }
/* keep src so discard does not get rid of it */
zip_source_keep(src);
@@ -229,12 +268,12 @@ _zip_set_open_error(int *zep, const zip_error_t *err, int ze) {
if (err) {
ze = zip_error_code_zip(err);
- switch (zip_error_system_type(err)) {
- case ZIP_ET_SYS:
- case ZIP_ET_LIBZIP:
- errno = zip_error_code_system(err);
- break;
-
- default:
- break;
+ switch (zip_error_system_type(err)) {
+ case ZIP_ET_SYS:
+ case ZIP_ET_LIBZIP:
+ errno = zip_error_code_system(err);
+ break;
+
+ default:
+ break;
}
}
@@ -251,6 +290,5 @@ _zip_set_open_error(int *zep, const zip_error_t *err, int ze) {
entries, or NULL if unsuccessful. */
-static zip_cdir_t *
-_zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_error_t *error) {
+static bool _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_cdir_t **cdirp, zip_error_t *error) {
zip_cdir_t *cd;
zip_uint16_t comment_len;
@@ -258,28 +296,59 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err
zip_uint64_t eocd_offset = _zip_buffer_offset(buffer);
zip_buffer_t *cd_buffer;
+ bool eocd64_found = false;
- if (_zip_buffer_left(buffer) < EOCDLEN) {
- /* not enough bytes left for comment */
- zip_error_set(error, ZIP_ER_NOZIP, 0);
- return NULL;
- }
+ *cdirp = NULL;
- /* check for end-of-central-dir magic */
- if (memcmp(_zip_buffer_get(buffer, 4), EOCD_MAGIC, 4) != 0) {
- zip_error_set(error, ZIP_ER_NOZIP, 0);
- return NULL;
+ if ((cd = _zip_read_eocd(buffer, buf_offset, error)) == NULL) {
+ return false;
}
if (eocd_offset >= EOCD64LOCLEN && memcmp(_zip_buffer_data(buffer) + eocd_offset - EOCD64LOCLEN, EOCD64LOC_MAGIC, 4) == 0) {
+ eocd64_found = true;
_zip_buffer_set_offset(buffer, eocd_offset - EOCD64LOCLEN);
- cd = _zip_read_eocd64(za->src, buffer, buf_offset, za->flags, error);
+ switch (_zip_read_eocd64(cd, za->src, buffer, buf_offset, za->flags, error)) {
+ case CDIR_OK:
+ break;
+
+ case CDIR_INVALID:
+ _zip_cdir_free(cd);
+ return true;
+
+ case CDIR_NOT_FOUND:
+ _zip_cdir_free(cd);
+ return false;
+ }
}
- else {
- _zip_buffer_set_offset(buffer, eocd_offset);
- cd = _zip_read_eocd(buffer, buf_offset, za->flags, error);
+
+ if ((cd->eocd_disk != 0 || cd->this_disk != 0) && !eocd64_found && cd->eocd_disk != cd->this_disk) {
+ /* If the central directory doesn't start on this disk, we can't check that offset is valid. Check as much as we can instead. */
+ if (cd->this_disk < cd->eocd_disk) {
+ /* Disks before the start of the central directory don't contain an EOCD. */
+ _zip_cdir_free(cd);
+ return false;
+ }
+ if (cd->size <= cd->eocd_offset) {
+ /* The complete central directory would fit on this disk. */
+ _zip_cdir_free(cd);
+ return false;
+ }
}
- if (cd == NULL)
- return NULL;
+ if (!eocd64_found) {
+ if (cd->this_disk == 0 && cd->eocd_disk == 0 && cd->eocd_offset == 0 && cd->offset == 0 && cd->num_entries == 0) {
+ /* An empty archive doesn't contain central directory entries. */
+ }
+ else if (!check_magic(cd->offset, buffer, buf_offset, za->src, CENTRAL_MAGIC)) {
+ _zip_cdir_free(cd);
+ return false;
+ }
+ }
+
+ /* We accept this EOCD as valid and won't search for an earlier one if it is unusable. */
+
+ if (!check_eocd(cd, za->flags, error)) {
+ _zip_cdir_free(cd);
+ return true;
+ }
_zip_buffer_set_offset(buffer, eocd_offset + 20);
@@ -290,5 +359,5 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err
zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_OVERLAPS_EOCD);
_zip_cdir_free(cd);
- return NULL;
+ return true;
}
@@ -299,8 +368,13 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err
tail_len = _zip_buffer_left(buffer);
- if (tail_len < comment_len || ((za->open_flags & ZIP_CHECKCONS) && tail_len != comment_len)) {
- zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_COMMENT_LENGTH_INVALID);
- _zip_cdir_free(cd);
- return NULL;
+ if (tail_len != comment_len) {
+ if (za->open_flags & ZIP_CHECKCONS) {
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_COMMENT_LENGTH_INVALID);
+ _zip_cdir_free(cd);
+ return true;
+ }
+ if (tail_len < comment_len) {
+ comment_len = tail_len;
+ }
}
@@ -308,5 +382,5 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err
if ((cd->comment = _zip_string_new(_zip_buffer_get(buffer, comment_len), comment_len, ZIP_FL_ENC_GUESS, error)) == NULL) {
_zip_cdir_free(cd);
- return NULL;
+ return true;
}
}
@@ -321,10 +395,10 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err
zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_LENGTH_INVALID);
_zip_cdir_free(cd);
- return NULL;
+ return true;
}
if ((cd_buffer = _zip_buffer_new(data, cd->size)) == NULL) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
_zip_cdir_free(cd);
- return NULL;
+ return true;
}
}
@@ -335,5 +409,5 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err
zip_error_set_from_source(error, za->src);
_zip_cdir_free(cd);
- return NULL;
+ return true;
}
@@ -342,8 +416,13 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err
zip_error_set(error, ZIP_ER_NOZIP, 0);
_zip_cdir_free(cd);
- return NULL;
+ return true;
}
}
+ if (!_zip_cdir_grow(cd, cd->num_entries, error)) {
+ _zip_cdir_free(cd);
+ _zip_buffer_free(cd_buffer);
+ return true;
+ }
left = (zip_uint64_t)cd->size;
i = 0;
@@ -363,19 +442,19 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err
_zip_cdir_free(cd);
_zip_buffer_free(cd_buffer);
- return NULL;
+ return true;
}
grown = true;
}
- if ((cd->entry[i].orig = _zip_dirent_new()) == NULL || (entry_size = _zip_dirent_read(cd->entry[i].orig, za->src, cd_buffer, false, error)) < 0) {
- if (zip_error_code_zip(error) == ZIP_ER_INCONS) {
- zip_error_set(error, ZIP_ER_INCONS, ADD_INDEX_TO_DETAIL(zip_error_code_system(error), i));
- }
- else if (grown && zip_error_code_zip(error) == ZIP_ER_NOZIP) {
+ if ((cd->entry[i].orig = _zip_dirent_new()) == NULL || (entry_size = _zip_dirent_read(cd->entry[i].orig, za->src, cd_buffer, false, 0, za->open_flags & ZIP_CHECKCONS, error)) < 0) {
+ if (zip_error_code_zip(error) == ZIP_ER_INCONS) {
+ zip_error_set(error, ZIP_ER_INCONS, ADD_INDEX_TO_DETAIL(zip_error_code_system(error), i));
+ }
+ else if (grown && zip_error_code_zip(error) == ZIP_ER_NOZIP) {
zip_error_set(error, ZIP_ER_INCONS, MAKE_DETAIL_WITH_INDEX(ZIP_ER_DETAIL_CDIR_ENTRY_INVALID, i));
}
_zip_cdir_free(cd);
_zip_buffer_free(cd_buffer);
- return NULL;
+ return true;
}
i++;
@@ -383,9 +462,10 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err
}
+ /* If we didn't fill all we grew, cd->num_entries was wrong. */
if (i != cd->nentry || left > 0) {
zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_WRONG_ENTRIES_COUNT);
_zip_buffer_free(cd_buffer);
_zip_cdir_free(cd);
- return NULL;
+ return true;
}
@@ -402,5 +482,5 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err
zip_error_set_from_source(error, za->src);
_zip_cdir_free(cd);
- return NULL;
+ return true;
}
ok = ((zip_uint64_t)offset == cd->offset + cd->size);
@@ -411,10 +491,30 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err
_zip_buffer_free(cd_buffer);
_zip_cdir_free(cd);
- return NULL;
+ return true;
}
}
_zip_buffer_free(cd_buffer);
- return cd;
+ *cdirp = cd;
+ return true;
+}
+
+
+static bool check_magic(zip_uint64_t offset, zip_buffer_t *buffer, zip_uint64_t buffer_offset, zip_source_t *src, const char* magic) {
+ if (buffer_offset <= offset) {
+ zip_uint8_t* data;
+ if (_zip_buffer_set_offset(buffer, offset - buffer_offset) < 0 || (data = _zip_buffer_get(buffer, MAGIC_LEN)) == NULL) {
+ return false;
+ }
+ return memcmp(data, magic, MAGIC_LEN) == 0;
+ }
+ else {
+ zip_uint8_t data[MAGIC_LEN];
+
+ if (zip_source_seek(src, offset, SEEK_SET) < 0 || zip_source_read(src, data, MAGIC_LEN) != MAGIC_LEN) {
+ return false;
+ }
+ return memcmp(data, magic, MAGIC_LEN) == 0;
+ }
}
@@ -431,4 +531,5 @@ _zip_checkcons(zip_t *za, zip_cdir_t *cd, zip_error_t *error) {
zip_uint64_t min, max, j;
struct zip_dirent temp;
+ int detail;
_zip_dirent_init(&temp);
@@ -461,8 +562,8 @@ _zip_checkcons(zip_t *za, zip_cdir_t *cd, zip_error_t *error) {
}
- if (_zip_dirent_read(&temp, za->src, NULL, true, error) == -1) {
- if (zip_error_code_zip(error) == ZIP_ER_INCONS) {
- zip_error_set(error, ZIP_ER_INCONS, ADD_INDEX_TO_DETAIL(zip_error_code_system(error), i));
- }
+ if (_zip_dirent_read(&temp, za->src, NULL, true, cd->entry[i].orig->comp_size, true, error) == -1) {
+ if (zip_error_code_zip(error) == ZIP_ER_INCONS) {
+ zip_error_set(error, ZIP_ER_INCONS, ADD_INDEX_TO_DETAIL(zip_error_code_system(error), i));
+ }
_zip_dirent_finalize(&temp);
return -1;
@@ -480,4 +581,9 @@ _zip_checkcons(zip_t *za, zip_cdir_t *cd, zip_error_t *error) {
_zip_dirent_finalize(&temp);
+
+ if ((detail = zip_dirent_check_consistency(cd->entry[i].orig)) != 0) {
+ zip_error_set(error, ZIP_ER_INCONS, MAKE_DETAIL_WITH_INDEX(detail, i));
+ return -1;
+ }
}
@@ -498,5 +604,5 @@ _zip_headercomp(const zip_dirent_t *central, const zip_dirent_t *local) {
|| (central->bitflags != local->bitflags)
#endif
- || (central->comp_method != local->comp_method) || (central->last_mod != local->last_mod) || !_zip_string_equal(central->filename, local->filename))
+ || (central->comp_method != local->comp_method) || (central->last_mod.time != local->last_mod.time) || (central->last_mod.date != local->last_mod.date) || !_zip_string_equal(central->filename, local->filename))
return -1;
@@ -504,17 +610,15 @@ _zip_headercomp(const zip_dirent_t *central, const zip_dirent_t *local) {
/* InfoZip stores valid values in local header even when data descriptor is used.
This is in violation of the appnote.
- macOS Archive sets the compressed size even when data descriptor is used ( but not the others),
- also in violation of the appnote.
- */
- /* if data descriptor is not used, the values must match */
+ macOS Archive sets the compressed size even when data descriptor is used ( but not the others),
+ also in violation of the appnote.
+ */
+ /* if data descriptor is not used, the values must match */
if ((local->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) == 0) {
return -1;
- }
- /* when using a data descriptor, the local header value must be zero or match */
- if ((local->crc != 0 && central->crc != local->crc) ||
- (local->comp_size != 0 && central->comp_size != local->comp_size) ||
- (local->uncomp_size != 0 && central->uncomp_size != local->uncomp_size)) {
- return -1;
- }
+ }
+ /* when using a data descriptor, the local header value must be zero or match */
+ if ((local->crc != 0 && central->crc != local->crc) || (local->comp_size != 0 && central->comp_size != local->comp_size) || (local->uncomp_size != 0 && central->uncomp_size != local->uncomp_size)) {
+ return -1;
+ }
}
@@ -569,10 +673,8 @@ _zip_file_exists(zip_source_t *src, zip_error_t *error) {
static zip_cdir_t *
_zip_find_central_dir(zip_t *za, zip_uint64_t len) {
- zip_cdir_t *cdir, *cdirnew;
+ zip_cdir_t *cdir;
const zip_uint8_t *match;
zip_int64_t buf_offset;
zip_uint64_t buflen;
- zip_int64_t a;
- zip_int64_t best;
zip_error_t error;
zip_buffer_t *buffer;
@@ -601,5 +703,4 @@ _zip_find_central_dir(zip_t *za, zip_uint64_t len) {
}
- best = -1;
cdir = NULL;
if (buflen >= CDBUFSIZE) {
@@ -609,80 +710,55 @@ _zip_find_central_dir(zip_t *za, zip_uint64_t len) {
zip_error_set(&error, ZIP_ER_NOZIP, 0);
- match = _zip_buffer_get(buffer, 0);
- /* The size of buffer never greater than CDBUFSIZE. */
- while (_zip_buffer_left(buffer) >= EOCDLEN && (match = _zip_memmem(match, (size_t)_zip_buffer_left(buffer) - (EOCDLEN - 4), (const unsigned char *)EOCD_MAGIC, 4)) != NULL) {
+ match = NULL;
+ while ((match = find_eocd(buffer, match)) != NULL) {
_zip_buffer_set_offset(buffer, (zip_uint64_t)(match - _zip_buffer_data(buffer)));
- if ((cdirnew = _zip_read_cdir(za, buffer, (zip_uint64_t)buf_offset, &error)) != NULL) {
- if (cdir) {
- if (best <= 0) {
- best = _zip_checkcons(za, cdir, &error);
- }
-
- a = _zip_checkcons(za, cdirnew, &error);
- if (best < a) {
- _zip_cdir_free(cdir);
- cdir = cdirnew;
- best = a;
- }
- else {
- _zip_cdir_free(cdirnew);
- }
+ if (_zip_read_cdir(za, buffer, (zip_uint64_t)buf_offset, &cdir, &error)) {
+ if (cdir != NULL && (za->open_flags & ZIP_CHECKCONS) && _zip_checkcons(za, cdir, &error) < 0) {
+ _zip_cdir_free(cdir);
+ cdir = NULL;
}
- else {
- cdir = cdirnew;
- if (za->open_flags & ZIP_CHECKCONS)
- best = _zip_checkcons(za, cdir, &error);
- else {
- best = 0;
- }
- }
- cdirnew = NULL;
+ break;
}
-
- match++;
- _zip_buffer_set_offset(buffer, (zip_uint64_t)(match - _zip_buffer_data(buffer)));
}
_zip_buffer_free(buffer);
- if (best < 0) {
+ if (cdir == NULL) {
_zip_error_copy(&za->error, &error);
- _zip_cdir_free(cdir);
- return NULL;
}
-
return cdir;
}
-static const unsigned char *_zip_memmem(const unsigned char *big, size_t biglen, const unsigned char *little, size_t littlelen) {
+static const unsigned char *
+find_eocd(zip_buffer_t *buffer, const unsigned char *last) {
+ const unsigned char *data = _zip_buffer_data(buffer);
const unsigned char *p;
- if (littlelen == 0) {
- return big;
+ if (last == NULL) {
+ last = data + _zip_buffer_size(buffer) - MAGIC_LEN;
}
-
- if (biglen < littlelen) {
+ else if (last == _zip_buffer_data(buffer)) {
return NULL;
}
+ else {
+ last -= 1;
+ }
- p = big;
- while (true) {
- p = (const unsigned char *)memchr(p, little[0], biglen - (littlelen - 1) - (size_t)(p - big));
- if (p == NULL) {
- return NULL;
- }
- if (memcmp(p + 1, little + 1, littlelen - 1) == 0) {
- return p;
+ for (p = last; p >= data; p -= 1) {
+ if (*p == EOCD_MAGIC[0]) {
+ if (memcmp(p, EOCD_MAGIC, MAGIC_LEN) == 0) {
+ return p;
+ }
}
- p += 1;
}
+
+ return NULL;
}
static zip_cdir_t *
-_zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *error) {
+_zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_error_t *error) {
zip_cdir_t *cd;
- zip_uint64_t i, nentry, size, offset, eocd_offset;
if (_zip_buffer_left(buffer) < EOCDLEN) {
@@ -691,56 +767,46 @@ _zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags
}
- eocd_offset = _zip_buffer_offset(buffer);
-
- _zip_buffer_get(buffer, 4); /* magic already verified */
-
- if (_zip_buffer_get_32(buffer) != 0) {
- zip_error_set(error, ZIP_ER_MULTIDISK, 0);
+ if ((cd = _zip_cdir_new(error)) == NULL) {
return NULL;
}
+ cd->eocd_offset = buf_offset + _zip_buffer_offset(buffer);
+ /* This function is only called where EOCD magic was found, so no need to check that here. */
+ _zip_buffer_skip(buffer, MAGIC_LEN);
+ cd->is_zip64 = false;
+ cd->this_disk = _zip_buffer_get_16(buffer);
+ cd->eocd_disk = _zip_buffer_get_16(buffer);
+
/* number of cdir-entries on this disk */
- i = _zip_buffer_get_16(buffer);
+ cd->disk_entries = _zip_buffer_get_16(buffer);
/* number of cdir-entries */
- nentry = _zip_buffer_get_16(buffer);
-
- if (nentry != i) {
- zip_error_set(error, ZIP_ER_NOZIP, 0);
- return NULL;
- }
+ cd->num_entries = _zip_buffer_get_16(buffer);
+ cd->size = _zip_buffer_get_32(buffer);
+ cd->offset = _zip_buffer_get_32(buffer);
- size = _zip_buffer_get_32(buffer);
- offset = _zip_buffer_get_32(buffer);
+ return cd;
+}
- if (offset + size < offset) {
- zip_error_set(error, ZIP_ER_SEEK, EFBIG);
- return NULL;
+static bool
+check_eocd(zip_cdir_t *cd, unsigned int flags, zip_error_t *error) {
+ if (cd->disk_entries != cd->num_entries || cd->this_disk != 0 || cd->eocd_disk != 0) {
+ zip_error_set(error, ZIP_ER_MULTIDISK, 0);
+ return false;
}
- if (offset + size > buf_offset + eocd_offset) {
- /* cdir spans past EOCD record */
- zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_OVERLAPS_EOCD);
- return NULL;
+ if (cd->offset + cd->size < cd->offset) {
+ zip_error_set(error, ZIP_ER_SEEK, EFBIG);
+ return false;
}
-
- if ((flags & ZIP_CHECKCONS) && offset + size != buf_offset + eocd_offset) {
+ if ((flags & ZIP_CHECKCONS) && cd->offset + cd->size != cd->eocd_offset) {
zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_LENGTH_INVALID);
- return NULL;
+ return false;
}
- if ((cd = _zip_cdir_new(nentry, error)) == NULL)
- return NULL;
-
- cd->is_zip64 = false;
- cd->size = size;
- cd->offset = offset;
-
- return cd;
+ return true;
}
-static zip_cdir_t *
-_zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *error) {
- zip_cdir_t *cd;
+cdir_status_t _zip_read_eocd64(zip_cdir_t *cdir, zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *error) {
zip_uint64_t offset;
zip_uint8_t eocd[EOCD64LEN];
@@ -748,5 +814,5 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
zip_uint64_t size, nentry, i, eocdloc_offset;
bool free_buffer;
- zip_uint32_t num_disks, num_disks64, eocd_disk, eocd_disk64;
+ zip_uint32_t num_disks, eocd_disk, this_disk;
eocdloc_offset = _zip_buffer_offset(buffer);
@@ -754,12 +820,21 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
_zip_buffer_get(buffer, 4); /* magic already verified */
- num_disks = _zip_buffer_get_16(buffer);
- eocd_disk = _zip_buffer_get_16(buffer);
+ eocd_disk = _zip_buffer_get_32(buffer);
eocd_offset = _zip_buffer_get_64(buffer);
+ num_disks = _zip_buffer_get_32(buffer);
+
+ if (!check_magic(eocd_offset, buffer, buf_offset, src, EOCD64_MAGIC)) {
+ return CDIR_NOT_FOUND;
+ }
+
+ if (num_disks != 1) {
+ zip_error_set(error, ZIP_ER_MULTIDISK, 0);
+ return CDIR_INVALID;
+ }
/* valid seek value for start of EOCD */
if (eocd_offset > ZIP_INT64_MAX) {
zip_error_set(error, ZIP_ER_SEEK, EFBIG);
- return NULL;
+ return CDIR_INVALID;
}
@@ -767,5 +842,5 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
if (eocd_offset + EOCD64LEN > eocdloc_offset + buf_offset) {
zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_EOCD64_OVERLAPS_EOCD);
- return NULL;
+ return CDIR_INVALID;
}
@@ -778,8 +853,8 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
if (zip_source_seek(src, (zip_int64_t)eocd_offset, SEEK_SET) < 0) {
zip_error_set_from_source(error, src);
- return NULL;
+ return CDIR_INVALID;
}
if ((buffer = _zip_buffer_new_from_source(src, EOCD64LEN, eocd, error)) == NULL) {
- return NULL;
+ return CDIR_INVALID;
}
free_buffer = true;
@@ -791,5 +866,5 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
_zip_buffer_free(buffer);
}
- return NULL;
+ return CDIR_INVALID;
}
@@ -803,38 +878,20 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
_zip_buffer_free(buffer);
}
- return NULL;
+ return CDIR_INVALID;
}
_zip_buffer_get(buffer, 4); /* skip version made by/needed */
- num_disks64 = _zip_buffer_get_32(buffer);
- eocd_disk64 = _zip_buffer_get_32(buffer);
-
- /* if eocd values are 0xffff, we have to use eocd64 values.
- otherwise, if the values are not the same, it's inconsistent;
- in any case, if the value is not 0, we don't support it */
- if (num_disks == 0xffff) {
- num_disks = num_disks64;
- }
- if (eocd_disk == 0xffff) {
- eocd_disk = eocd_disk64;
- }
- if ((flags & ZIP_CHECKCONS) && (eocd_disk != eocd_disk64 || num_disks != num_disks64)) {
- zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_EOCD64_MISMATCH);
+ this_disk = _zip_buffer_get_32(buffer);
+ if (_zip_buffer_get_32(buffer) != eocd_disk) {
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_EOCD64_LOCATOR_MISMATCH);
if (free_buffer) {
_zip_buffer_free(buffer);
}
- return NULL;
- }
- if (num_disks != 0 || eocd_disk != 0) {
- zip_error_set(error, ZIP_ER_MULTIDISK, 0);
- if (free_buffer) {
- _zip_buffer_free(buffer);
- }
- return NULL;
+ return CDIR_INVALID;
}
- nentry = _zip_buffer_get_64(buffer);
i = _zip_buffer_get_64(buffer);
+ nentry = _zip_buffer_get_64(buffer);
if (nentry != i) {
@@ -843,5 +900,5 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
_zip_buffer_free(buffer);
}
- return NULL;
+ return CDIR_INVALID;
}
@@ -855,5 +912,5 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
_zip_buffer_free(buffer);
}
- return NULL;
+ return CDIR_INVALID;
}
@@ -864,33 +921,31 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
if (offset > ZIP_INT64_MAX || offset + size < offset) {
zip_error_set(error, ZIP_ER_SEEK, EFBIG);
- return NULL;
- }
- if (offset + size > buf_offset + eocd_offset) {
- /* cdir spans past EOCD record */
- zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_OVERLAPS_EOCD);
- return NULL;
- }
- if ((flags & ZIP_CHECKCONS) && offset + size != buf_offset + eocd_offset) {
- zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_OVERLAPS_EOCD);
- return NULL;
+ return CDIR_INVALID;
}
if (nentry > size / CDENTRYSIZE) {
zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_INVALID);
- return NULL;
+ return CDIR_INVALID;
}
- if ((cd = _zip_cdir_new(nentry, error)) == NULL)
- return NULL;
+ if ((cdir->size != 0xffffffff && cdir->size != size) || (cdir->offset != 0xffffffff && cdir->offset != offset) || (cdir->num_entries != 0xffff && cdir->num_entries != nentry) || (cdir->disk_entries != 0xffff && cdir->disk_entries != i) || (cdir->this_disk != 0xffff && cdir->this_disk != this_disk) || (cdir->eocd_disk != 0xffff && cdir->eocd_disk != eocd_disk)) {
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_EOCD64_MISMATCH);
+ return CDIR_INVALID;
+ }
- cd->is_zip64 = true;
- cd->size = size;
- cd->offset = offset;
+ cdir->is_zip64 = true;
+ cdir->size = size;
+ cdir->offset = offset;
+ cdir->disk_entries = i;
+ cdir->num_entries = nentry;
+ cdir->this_disk = this_disk;
+ cdir->eocd_disk = eocd_disk;
- return cd;
+ return CDIR_OK;
}
-static int decode_hex(char c) {
+static int
+decode_hex(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
@@ -907,7 +962,8 @@ static int decode_hex(char c) {
check whether ZA has a valid TORRENTZIP comment, i.e. is torrentzipped */
-static void zip_check_torrentzip(zip_t *za, const zip_cdir_t *cdir) {
+static void
+zip_check_torrentzip(zip_t *za, const zip_cdir_t *cdir) {
zip_uint32_t crc_should;
- char buf[8+1];
+ char buf[8 + 1];
size_t i;
@@ -916,6 +972,5 @@ static void zip_check_torrentzip(zip_t *za, const zip_cdir_t *cdir) {
}
- if (_zip_string_length(cdir->comment) != TORRENTZIP_SIGNATURE_LENGTH + TORRENTZIP_CRC_LENGTH
- || strncmp((const char *)cdir->comment->raw, TORRENTZIP_SIGNATURE, TORRENTZIP_SIGNATURE_LENGTH) != 0)
+ if (_zip_string_length(cdir->comment) != TORRENTZIP_SIGNATURE_LENGTH + TORRENTZIP_CRC_LENGTH || strncmp((const char *)cdir->comment->raw, TORRENTZIP_SIGNATURE, TORRENTZIP_SIGNATURE_LENGTH) != 0)
return;
@@ -935,6 +990,6 @@ static void zip_check_torrentzip(zip_t *za, const zip_cdir_t *cdir) {
{
zip_stat_t st;
- zip_source_t* src_window;
- zip_source_t* src_crc;
+ zip_source_t *src_window;
+ zip_source_t *src_crc;
zip_uint8_t buffer[512];
zip_int64_t ret;
@@ -944,5 +999,5 @@ static void zip_check_torrentzip(zip_t *za, const zip_cdir_t *cdir) {
st.size = cdir->size;
st.crc = crc_should;
- if ((src_window = _zip_source_window_new(za->src, cdir->offset, cdir->size, &st, 0, NULL, NULL, 0, false, NULL)) == NULL) {
+ if ((src_window = _zip_source_window_new(za->src, cdir->offset, cdir->size, &st, 0, NULL, NULL, NULL, 0, false, NULL)) == NULL) {
return;
}
diff --git a/src/Common/libzip/zip_pkware.c b/src/Common/libzip/zip_pkware.c
index 6a8c9fcd..ef3a30bb 100644
--- a/src/Common/libzip/zip_pkware.c
+++ b/src/Common/libzip/zip_pkware.c
@@ -1,5 +1,5 @@
/*
zip_pkware.c -- Traditional PKWARE de/encryption backend routines
- Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_progress.c b/src/Common/libzip/zip_progress.c
index e080514b..5693d7a5 100644
--- a/src/Common/libzip/zip_progress.c
+++ b/src/Common/libzip/zip_progress.c
@@ -1,5 +1,5 @@
/*
zip_progress.c -- progress reporting
- Copyright (C) 2017-2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 2017-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -192,5 +192,5 @@ _zip_progress_update(zip_progress_t *progress, double sub_current) {
current = ZIP_MIN(ZIP_MAX(sub_current, 0.0), 1.0) * (progress->end - progress->start) + progress->start;
- if (current - progress->last_update > progress->precision) {
+ if (current - progress->last_update > progress->precision || (progress->last_update < 1 && current == 1)) {
progress->callback_progress(progress->za, current, progress->ud_progress);
progress->last_update = current;
diff --git a/src/Common/libzip/zip_random_unix.c b/src/Common/libzip/zip_random_unix.c
index 867df790..9446ca92 100644
--- a/src/Common/libzip/zip_random_unix.c
+++ b/src/Common/libzip/zip_random_unix.c
@@ -1,5 +1,5 @@
/*
zip_random_unix.c -- fill the user's buffer with random stuff (Unix version)
- Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2016-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_random_uwp.c b/src/Common/libzip/zip_random_uwp.c
index 0883ce45..7accdeb2 100644
--- a/src/Common/libzip/zip_random_uwp.c
+++ b/src/Common/libzip/zip_random_uwp.c
@@ -1,5 +1,5 @@
/*
zip_random_uwp.c -- fill the user's buffer with random stuff (UWP version)
- Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2017-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_random_win32.c b/src/Common/libzip/zip_random_win32.c
index 789b9c20..209ca4b8 100644
--- a/src/Common/libzip/zip_random_win32.c
+++ b/src/Common/libzip/zip_random_win32.c
@@ -1,5 +1,5 @@
/*
zip_random_win32.c -- fill the user's buffer with random stuff (Windows version)
- Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2016-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_rename.c b/src/Common/libzip/zip_rename.c
index c89b06c9..b356de45 100644
--- a/src/Common/libzip/zip_rename.c
+++ b/src/Common/libzip/zip_rename.c
@@ -1,5 +1,5 @@
/*
zip_rename.c -- rename file in zip archive
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_replace.c b/src/Common/libzip/zip_replace.c
index 96c083c3..549306a0 100644
--- a/src/Common/libzip/zip_replace.c
+++ b/src/Common/libzip/zip_replace.c
@@ -1,5 +1,5 @@
/*
zip_replace.c -- replace file via callback function
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_set_archive_comment.c b/src/Common/libzip/zip_set_archive_comment.c
index 7d06688e..2c75bda6 100644
--- a/src/Common/libzip/zip_set_archive_comment.c
+++ b/src/Common/libzip/zip_set_archive_comment.c
@@ -1,5 +1,5 @@
/*
zip_set_archive_comment.c -- set archive comment
- Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2006-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_set_archive_flag.c b/src/Common/libzip/zip_set_archive_flag.c
index 834ef5ba..7533ac50 100644
--- a/src/Common/libzip/zip_set_archive_flag.c
+++ b/src/Common/libzip/zip_set_archive_flag.c
@@ -1,5 +1,5 @@
/*
zip_get_archive_flag.c -- set archive global flag
- Copyright (C) 2008-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2008-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_set_default_password.c b/src/Common/libzip/zip_set_default_password.c
index 4bab513f..07b3a06e 100644
--- a/src/Common/libzip/zip_set_default_password.c
+++ b/src/Common/libzip/zip_set_default_password.c
@@ -1,5 +1,5 @@
/*
zip_set_default_password.c -- set default password for decryption
- Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_set_file_comment.c b/src/Common/libzip/zip_set_file_comment.c
index 5d2b0b8a..b587ae95 100644
--- a/src/Common/libzip/zip_set_file_comment.c
+++ b/src/Common/libzip/zip_set_file_comment.c
@@ -1,5 +1,5 @@
/*
zip_set_file_comment.c -- set comment for file in archive
- Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2006-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_set_file_compression.c b/src/Common/libzip/zip_set_file_compression.c
index a193bb77..cee099d5 100644
--- a/src/Common/libzip/zip_set_file_compression.c
+++ b/src/Common/libzip/zip_set_file_compression.c
@@ -1,5 +1,5 @@
/*
zip_set_file_compression.c -- set compression for file in archive
- Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2012-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_set_name.c b/src/Common/libzip/zip_set_name.c
index f1bf703e..0087af1a 100644
--- a/src/Common/libzip/zip_set_name.c
+++ b/src/Common/libzip/zip_set_name.c
@@ -1,5 +1,5 @@
/*
zip_set_name.c -- rename helper function
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_accept_empty.c b/src/Common/libzip/zip_source_accept_empty.c
index e772aeea..be319434 100644
--- a/src/Common/libzip/zip_source_accept_empty.c
+++ b/src/Common/libzip/zip_source_accept_empty.c
@@ -1,5 +1,5 @@
/*
zip_source_accept_empty.c -- if empty source is a valid archive
- Copyright (C) 2019-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2019-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_begin_write.c b/src/Common/libzip/zip_source_begin_write.c
index 4a9d5d5d..2724335d 100644
--- a/src/Common/libzip/zip_source_begin_write.c
+++ b/src/Common/libzip/zip_source_begin_write.c
@@ -1,5 +1,5 @@
/*
zip_source_begin_write.c -- start a new file for writing
- Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_begin_write_cloning.c b/src/Common/libzip/zip_source_begin_write_cloning.c
index df195fcd..67d3475b 100644
--- a/src/Common/libzip/zip_source_begin_write_cloning.c
+++ b/src/Common/libzip/zip_source_begin_write_cloning.c
@@ -1,5 +1,5 @@
/*
zip_source_begin_write_cloning.c -- clone part of file for writing
- Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2017-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_buffer.c b/src/Common/libzip/zip_source_buffer.c
index 44159536..bdd522d6 100644
--- a/src/Common/libzip/zip_source_buffer.c
+++ b/src/Common/libzip/zip_source_buffer.c
@@ -1,5 +1,5 @@
/*
zip_source_buffer.c -- create zip data source from buffer
- Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_call.c b/src/Common/libzip/zip_source_call.c
index 8c98fc2e..bc13c3b0 100644
--- a/src/Common/libzip/zip_source_call.c
+++ b/src/Common/libzip/zip_source_call.c
@@ -1,5 +1,5 @@
/*
zip_source_call.c -- invoke callback command on zip_source
- Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_close.c b/src/Common/libzip/zip_source_close.c
index f4f3ff2b..f1ae6f3e 100644
--- a/src/Common/libzip/zip_source_close.c
+++ b/src/Common/libzip/zip_source_close.c
@@ -1,5 +1,5 @@
/*
zip_source_close.c -- close zip_source (stop reading)
- Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_commit_write.c b/src/Common/libzip/zip_source_commit_write.c
index d7f567b8..ca7563ce 100644
--- a/src/Common/libzip/zip_source_commit_write.c
+++ b/src/Common/libzip/zip_source_commit_write.c
@@ -1,5 +1,5 @@
/*
zip_source_commit_write.c -- commit changes to file
- Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_compress.c b/src/Common/libzip/zip_source_compress.c
index 3cf709ff..54387eca 100644
--- a/src/Common/libzip/zip_source_compress.c
+++ b/src/Common/libzip/zip_source_compress.c
@@ -1,5 +1,5 @@
/*
zip_source_compress.c -- (de)compression routines
- Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2017-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_crc.c b/src/Common/libzip/zip_source_crc.c
index 435a084b..931a729c 100644
--- a/src/Common/libzip/zip_source_crc.c
+++ b/src/Common/libzip/zip_source_crc.c
@@ -1,5 +1,5 @@
/*
zip_source_crc.c -- pass-through source that calculates CRC32 and size
- Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_error.c b/src/Common/libzip/zip_source_error.c
index dc7fa20c..774eec0a 100644
--- a/src/Common/libzip/zip_source_error.c
+++ b/src/Common/libzip/zip_source_error.c
@@ -1,5 +1,5 @@
/*
zip_source_error.c -- get last error from zip_source
- Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_file.h b/src/Common/libzip/zip_source_file.h
index cca9fd2b..de07aecc 100644
--- a/src/Common/libzip/zip_source_file.h
+++ b/src/Common/libzip/zip_source_file.h
@@ -1,5 +1,8 @@
+#ifndef _HAD_ZIP_SOURCE_FILE_H
+#define _HAD_ZIP_SOURCE_FILE_H
+
/*
zip_source_file.h -- header for common file operations
- Copyright (C) 2020-2022 Dieter Baron and Thomas Klausner
+ Copyright (C) 2020-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -89,2 +92,4 @@ struct zip_source_file_operations {
zip_source_t *zip_source_file_common_new(const char *fname, void *file, zip_uint64_t start, zip_int64_t len, const zip_stat_t *st, zip_source_file_operations_t *ops, void *ops_userdata, zip_error_t *error);
+
+#endif /* _HAD_ZIP_SOURCE_FILE_H */
diff --git a/src/Common/libzip/zip_source_file_common.c b/src/Common/libzip/zip_source_file_common.c
index 6c58320f..99f893eb 100644
--- a/src/Common/libzip/zip_source_file_common.c
+++ b/src/Common/libzip/zip_source_file_common.c
@@ -1,5 +1,5 @@
/*
zip_source_file_common.c -- create data source from file
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_file_stdio.c b/src/Common/libzip/zip_source_file_stdio.c
index 6dcc5639..fd16f392 100644
--- a/src/Common/libzip/zip_source_file_stdio.c
+++ b/src/Common/libzip/zip_source_file_stdio.c
@@ -1,5 +1,5 @@
/*
zip_source_file_stdio.c -- read-only stdio file source implementation
- Copyright (C) 2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 2020-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -121,5 +121,5 @@ _zip_stdio_op_seek(zip_source_file_context_t *ctx, void *f, zip_int64_t offset,
#endif
- if (fseeko((FILE *)f, (off_t)offset, whence) < 0) {
+ if (zip_os_fseek((FILE *)f, (zip_off_t)offset, whence) < 0) {
zip_error_set(&ctx->error, ZIP_ER_SEEK, errno);
return false;
@@ -131,13 +131,13 @@ _zip_stdio_op_seek(zip_source_file_context_t *ctx, void *f, zip_int64_t offset,
bool
_zip_stdio_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t *st) {
- struct stat sb;
+ zip_os_stat_t sb;
int ret;
if (ctx->fname) {
- ret = stat(ctx->fname, &sb);
+ ret = zip_os_stat(ctx->fname, &sb);
}
else {
- ret = fstat(fileno((FILE *)ctx->f), &sb);
+ ret = zip_os_fstat(fileno((FILE *)ctx->f), &sb);
}
@@ -169,5 +169,5 @@ _zip_stdio_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t *st) {
zip_int64_t
_zip_stdio_op_tell(zip_source_file_context_t *ctx, void *f) {
- off_t offset = ftello((FILE *)f);
+ zip_off_t offset = zip_os_ftell((FILE *)f);
if (offset < 0) {
diff --git a/src/Common/libzip/zip_source_file_stdio.h b/src/Common/libzip/zip_source_file_stdio.h
index 802e6071..417a28c0 100644
--- a/src/Common/libzip/zip_source_file_stdio.h
+++ b/src/Common/libzip/zip_source_file_stdio.h
@@ -4,5 +4,5 @@
/*
zip_source_file_stdio.h -- common header for stdio file implementation
- Copyright (C) 2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 2020-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_file_stdio_named.c b/src/Common/libzip/zip_source_file_stdio_named.c
index 1495d7dd..1a5ca226 100644
--- a/src/Common/libzip/zip_source_file_stdio_named.c
+++ b/src/Common/libzip/zip_source_file_stdio_named.c
@@ -1,5 +1,5 @@
/*
zip_source_file_stdio_named.c -- source for stdio file opened by name
- Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -179,7 +179,7 @@ _zip_stdio_op_create_temp_output_cloning(zip_source_file_context_t *ctx, zip_uin
int fd;
struct file_clone_range range;
- struct stat st;
+ zip_os_stat_t st;
- if (fstat(fileno(ctx->f), &st) < 0) {
+ if (zip_os_fstat(fileno(ctx->f), &st) < 0) {
zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno);
return -1;
@@ -224,5 +224,5 @@ _zip_stdio_op_create_temp_output_cloning(zip_source_file_context_t *ctx, zip_uin
return -1;
}
- if (fseeko(tfp, (off_t)offset, SEEK_SET) < 0) {
+ if (zip_os_fseek(tfp, (zip_off_t)offset, SEEK_SET) < 0) {
zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno);
(void)fclose(tfp);
@@ -291,9 +291,9 @@ static int create_temp_file(zip_source_file_context_t *ctx, bool create_file) {
char *temp;
int mode;
- struct stat st;
+ zip_os_stat_t st;
int fd = 0;
char *start, *end;
- if (stat(ctx->fname, &st) == 0) {
+ if (zip_os_stat(ctx->fname, &st) == 0) {
mode = st.st_mode;
}
@@ -345,5 +345,5 @@ static int create_temp_file(zip_source_file_context_t *ctx, bool create_file) {
}
else {
- if (stat(temp, &st) < 0) {
+ if (zip_os_stat(temp, &st) < 0) {
if (errno == ENOENT) {
break;
diff --git a/src/Common/libzip/zip_source_file_win32.c b/src/Common/libzip/zip_source_file_win32.c
index 624860b1..aa669766 100644
--- a/src/Common/libzip/zip_source_file_win32.c
+++ b/src/Common/libzip/zip_source_file_win32.c
@@ -1,5 +1,5 @@
/*
zip_source_file_win32.c -- read-only Windows file source implementation
- Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_file_win32.h b/src/Common/libzip/zip_source_file_win32.h
index d86069ec..da691f0a 100644
--- a/src/Common/libzip/zip_source_file_win32.h
+++ b/src/Common/libzip/zip_source_file_win32.h
@@ -4,5 +4,5 @@
/*
zip_source_file_win32.h -- common header for Windows file implementation
- Copyright (C) 2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 2020-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -60,4 +60,5 @@ struct zip_win32_file_operations {
BOOL(__stdcall *set_file_attributes)(const void *name, DWORD attributes);
char *(*string_duplicate)(const char *string);
+ HANDLE(__stdcall *find_first_file)(const void *name, void *data);
};
@@ -74,11 +75,3 @@ bool _zip_filetime_to_time_t(FILETIME ft, time_t *t);
int _zip_win32_error_to_errno(DWORD win32err);
-#ifdef __clang__
-#define DONT_WARN_INCOMPATIBLE_FN_PTR_BEGIN _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wincompatible-function-pointer-types\"")
-#define DONT_WARN_INCOMPATIBLE_FN_PTR_END _Pragma("GCC diagnostic pop")
-#else
-#define DONT_WARN_INCOMPATIBLE_FN_PTR_BEGIN
-#define DONT_WARN_INCOMPATIBLE_FN_PTR_END
-#endif
-
#endif /* _HAD_ZIP_SOURCE_FILE_WIN32_H */
diff --git a/src/Common/libzip/zip_source_file_win32_ansi.c b/src/Common/libzip/zip_source_file_win32_ansi.c
index 58034cc2..f10f8ae3 100644
--- a/src/Common/libzip/zip_source_file_win32_ansi.c
+++ b/src/Common/libzip/zip_source_file_win32_ansi.c
@@ -1,5 +1,5 @@
/*
zip_source_file_win32_ansi.c -- source for Windows file opened by ANSI name
- Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -35,22 +35,26 @@
static char *ansi_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp);
+static HANDLE __stdcall ansi_create_file(const void *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file);
+static BOOL __stdcall ansi_delete_file(const void *name);
+static DWORD __stdcall ansi_get_file_attributes(const void *name);
+static BOOL __stdcall ansi_get_file_attributes_ex(const void *name, GET_FILEEX_INFO_LEVELS info_level, void *information);
static void ansi_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i);
+static BOOL __stdcall ansi_move_file(const void *from, const void *to, DWORD flags);
+static BOOL __stdcall ansi_set_file_attributes(const void *name, DWORD attributes);
+static HANDLE __stdcall ansi_find_first_file(const void *name, void* data);
/* clang-format off */
-DONT_WARN_INCOMPATIBLE_FN_PTR_BEGIN
-
zip_win32_file_operations_t ops_ansi = {
ansi_allocate_tempname,
- CreateFileA,
- DeleteFileA,
- GetFileAttributesA,
- GetFileAttributesExA,
+ ansi_create_file,
+ ansi_delete_file,
+ ansi_get_file_attributes,
+ ansi_get_file_attributes_ex,
ansi_make_tempname,
- MoveFileExA,
- SetFileAttributesA,
- strdup
+ ansi_move_file,
+ ansi_set_file_attributes,
+ strdup,
+ ansi_find_first_file,
};
-
-DONT_WARN_INCOMPATIBLE_FN_PTR_END
/* clang-format on */
@@ -81,4 +85,27 @@ ansi_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp) {
}
+static HANDLE __stdcall
+ansi_create_file(const void *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file)
+{
+ return CreateFileA((const char *)name, access, share_mode, security_attributes, creation_disposition, file_attributes, template_file);
+}
+
+static BOOL __stdcall
+ansi_delete_file(const void *name)
+{
+ return DeleteFileA((const char *)name);
+}
+
+static DWORD __stdcall
+ansi_get_file_attributes(const void *name)
+{
+ return GetFileAttributesA((const char *)name);
+}
+
+static BOOL __stdcall
+ansi_get_file_attributes_ex(const void *name, GET_FILEEX_INFO_LEVELS info_level, void *information)
+{
+ return GetFileAttributesExA((const char *)name, info_level, information);
+}
static void
@@ -86,2 +113,20 @@ ansi_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i) {
snprintf_s(buf, len, "%s.%08x", name, i);
}
+
+static BOOL __stdcall
+ansi_move_file(const void *from, const void *to, DWORD flags)
+{
+ return MoveFileExA((const char *)from, (const char *)to, flags);
+}
+
+static BOOL __stdcall
+ansi_set_file_attributes(const void *name, DWORD attributes)
+{
+ return SetFileAttributesA((const char *)name, attributes);
+}
+
+static HANDLE __stdcall
+ansi_find_first_file(const void *name, void *data)
+{
+ return FindFirstFileA((const char *)name, data);
+}
diff --git a/src/Common/libzip/zip_source_file_win32_named.c b/src/Common/libzip/zip_source_file_win32_named.c
index 855e605a..ae72db19 100644
--- a/src/Common/libzip/zip_source_file_win32_named.c
+++ b/src/Common/libzip/zip_source_file_win32_named.c
@@ -1,5 +1,5 @@
/*
zip_source_file_win32_named.c -- source for Windows file opened by name
- Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -34,4 +34,11 @@
#include "zip_source_file_win32.h"
+/* ACL is not available when targeting the games API partition */
+#if defined(WINAPI_FAMILY_PARTITION) && defined(WINAPI_PARTITION_GAMES)
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_GAMES)
+#define ACL_UNSUPPORTED
+#endif
+#endif
+
static zip_int64_t _zip_win32_named_op_commit_write(zip_source_file_context_t *ctx);
static zip_int64_t _zip_win32_named_op_create_temp_output(zip_source_file_context_t *ctx);
@@ -111,5 +118,9 @@ _zip_win32_named_op_create_temp_output(zip_source_file_context_t *ctx) {
if ((HANDLE)ctx->f != INVALID_HANDLE_VALUE && GetFileType((HANDLE)ctx->f) == FILE_TYPE_DISK) {
si = DACL_SECURITY_INFORMATION | UNPROTECTED_DACL_SECURITY_INFORMATION;
+ #ifdef ACL_UNSUPPORTED
+ success = ERROR_NOT_SUPPORTED;
+ #else
success = GetSecurityInfo((HANDLE)ctx->f, SE_FILE_OBJECT, si, NULL, NULL, &dacl, NULL, &psd);
+ #endif
if (success == ERROR_SUCCESS) {
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
@@ -211,6 +222,18 @@ _zip_win32_named_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t
if (file_attributes.dwFileAttributes != INVALID_FILE_ATTRIBUTES) {
- if ((file_attributes.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_REPARSE_POINT)) == 0) {
- st->regular_file = true;
+ if ((file_attributes.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE)) == 0) {
+ if (file_attributes.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
+#ifdef IO_REPARSE_TAG_DEDUP // Not defined in WinSDK 7.1 or before (VS2010).
+ WIN32_FIND_DATA find_data;
+ /* Deduplication on Windows replaces files with reparse points;
+ * accept them as regular files. */
+ if (file_ops->find_first_file(ctx->fname, &find_data) != INVALID_HANDLE_VALUE) {
+ st->regular_file = (find_data.dwReserved0 == IO_REPARSE_TAG_DEDUP);
+ }
+#endif
+ }
+ else {
+ st->regular_file = true;
+ }
}
}
diff --git a/src/Common/libzip/zip_source_file_win32_utf16.c b/src/Common/libzip/zip_source_file_win32_utf16.c
index 8f07d021..73e25666 100644
--- a/src/Common/libzip/zip_source_file_win32_utf16.c
+++ b/src/Common/libzip/zip_source_file_win32_utf16.c
@@ -1,5 +1,5 @@
/*
zip_source_file_win32_utf16.c -- source for Windows file opened by UTF-16 name
- Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -35,24 +35,28 @@
static char *utf16_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp);
-static HANDLE __stdcall utf16_create_file(const char *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file);
+static HANDLE __stdcall utf16_create_file(const void *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file);
+static BOOL __stdcall utf16_delete_file(const void *name);
+static DWORD __stdcall utf16_get_file_attributes(const void *name);
+static BOOL __stdcall utf16_get_file_attributes_ex(const void *name, GET_FILEEX_INFO_LEVELS info_level, void *information);
static void utf16_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i);
+static BOOL __stdcall utf16_move_file(const void *from, const void *to, DWORD flags);
+static BOOL __stdcall utf16_set_file_attributes(const void *name, DWORD attributes);
static char *utf16_strdup(const char *string);
+static HANDLE __stdcall utf16_find_first_file(const void *name, void* data);
-/* clang-format off */
-DONT_WARN_INCOMPATIBLE_FN_PTR_BEGIN
+/* clang-format off */
zip_win32_file_operations_t ops_utf16 = {
utf16_allocate_tempname,
utf16_create_file,
- DeleteFileW,
- GetFileAttributesW,
- GetFileAttributesExW,
+ utf16_delete_file,
+ utf16_get_file_attributes,
+ utf16_get_file_attributes_ex,
utf16_make_tempname,
- MoveFileExW,
- SetFileAttributesW,
- utf16_strdup
+ utf16_move_file,
+ utf16_set_file_attributes,
+ utf16_strdup,
+ utf16_find_first_file
};
-
-DONT_WARN_INCOMPATIBLE_FN_PTR_END
/* clang-format on */
@@ -85,5 +89,5 @@ utf16_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp) {
-static HANDLE __stdcall utf16_create_file(const char *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file) {
+static HANDLE __stdcall utf16_create_file(const void *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file) {
#ifdef MS_UWP
CREATEFILE2_EXTENDED_PARAMETERS extParams = {0};
@@ -101,4 +105,21 @@ static HANDLE __stdcall utf16_create_file(const char *name, DWORD access, DWORD
}
+static BOOL __stdcall
+utf16_delete_file(const void *name)
+{
+ return DeleteFileW((const wchar_t *)name);
+}
+
+static DWORD __stdcall
+utf16_get_file_attributes(const void *name)
+{
+ return GetFileAttributesW((const wchar_t *)name);
+}
+
+static BOOL __stdcall
+utf16_get_file_attributes_ex(const void *name, GET_FILEEX_INFO_LEVELS info_level, void *information)
+{
+ return GetFileAttributesExW((const wchar_t *)name, info_level, information);
+}
static void
@@ -107,4 +128,15 @@ utf16_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i) {
}
+static BOOL __stdcall
+utf16_move_file(const void *from, const void *to, DWORD flags)
+{
+ return MoveFileExW((const wchar_t *)from, (const wchar_t *)to, flags);
+}
+
+static BOOL __stdcall
+utf16_set_file_attributes(const void *name, DWORD attributes)
+{
+ return SetFileAttributesW((const wchar_t *)name, attributes);
+}
static char *
@@ -112,2 +144,9 @@ utf16_strdup(const char *string) {
return (char *)_wcsdup((const wchar_t *)string);
}
+
+
+static HANDLE __stdcall
+utf16_find_first_file(const void *name, void* data)
+{
+ return FindFirstFileW((const wchar_t *)name, data);
+}
diff --git a/src/Common/libzip/zip_source_file_win32_utf8.c b/src/Common/libzip/zip_source_file_win32_utf8.c
index d154f97a..5c27df92 100644
--- a/src/Common/libzip/zip_source_file_win32_utf8.c
+++ b/src/Common/libzip/zip_source_file_win32_utf8.c
@@ -1,5 +1,5 @@
/*
zip_source_file_win32_ansi.c -- source for Windows file opened by UTF-8 name
- Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_free.c b/src/Common/libzip/zip_source_free.c
index 1a800405..df4b08d8 100644
--- a/src/Common/libzip/zip_source_free.c
+++ b/src/Common/libzip/zip_source_free.c
@@ -1,5 +1,5 @@
/*
zip_source_free.c -- free zip data source
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_get_dostime.c b/src/Common/libzip/zip_source_get_dostime.c
new file mode 100644
index 00000000..17f652bb
--- /dev/null
+++ b/src/Common/libzip/zip_source_get_dostime.c
@@ -0,0 +1,72 @@
+/*
+ zip_source_get_dostime.c -- get modification time in DOS format from source
+ Copyright (C) 2024 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "zipint.h"
+
+/* Returns -1 on error, 0 on no dostime available, 1 for dostime returned */
+int
+zip_source_get_dos_time(zip_source_t *src, zip_dostime_t *dos_time) {
+ if (src->source_closed) {
+ return -1;
+ }
+ if (dos_time == NULL) {
+ zip_error_set(&src->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
+
+ if (src->write_state == ZIP_SOURCE_WRITE_REMOVED) {
+ zip_error_set(&src->error, ZIP_ER_READ, ENOENT);
+ }
+
+ if (zip_source_supports(src) & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_GET_DOS_TIME)) {
+ zip_int64_t n = _zip_source_call(src, dos_time, sizeof(*dos_time), ZIP_SOURCE_GET_DOS_TIME);
+
+ if (n < 0) {
+ return -1;
+ }
+ else if (n == 0) {
+ return 0;
+ }
+ else if (n == sizeof(*dos_time)) {
+ return 1;
+ }
+ else {
+ zip_error_set(&src->error, ZIP_ER_INTERNAL, 0);
+ return -1;
+ }
+ }
+ else {
+ return 0;
+ }
+}
diff --git a/src/Common/libzip/zip_source_get_file_attributes.c b/src/Common/libzip/zip_source_get_file_attributes.c
index 4771dc16..209e39f5 100644
--- a/src/Common/libzip/zip_source_get_file_attributes.c
+++ b/src/Common/libzip/zip_source_get_file_attributes.c
@@ -1,5 +1,5 @@
/*
zip_source_get_file_attributes.c -- get attributes for file from source
- Copyright (C) 2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 2020-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_is_deleted.c b/src/Common/libzip/zip_source_is_deleted.c
index 838aa909..d6016a02 100644
--- a/src/Common/libzip/zip_source_is_deleted.c
+++ b/src/Common/libzip/zip_source_is_deleted.c
@@ -1,5 +1,5 @@
/*
zip_source_is_deleted.c -- was archive was removed?
- Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_layered.c b/src/Common/libzip/zip_source_layered.c
index 62b78e68..be428190 100644
--- a/src/Common/libzip/zip_source_layered.c
+++ b/src/Common/libzip/zip_source_layered.c
@@ -1,5 +1,5 @@
/*
zip_source_layered.c -- create layered source
- Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_open.c b/src/Common/libzip/zip_source_open.c
index b34fa2c6..9e42d0a9 100644
--- a/src/Common/libzip/zip_source_open.c
+++ b/src/Common/libzip/zip_source_open.c
@@ -1,5 +1,5 @@
/*
zip_source_open.c -- open zip_source (prepare for reading)
- Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_pass_to_lower_layer.c b/src/Common/libzip/zip_source_pass_to_lower_layer.c
index 4a98222e..391729e4 100644
--- a/src/Common/libzip/zip_source_pass_to_lower_layer.c
+++ b/src/Common/libzip/zip_source_pass_to_lower_layer.c
@@ -1,5 +1,5 @@
/*
zip_source_pass_to_lower_layer.c -- pass command to lower layer
- Copyright (C) 2022 Dieter Baron and Thomas Klausner
+ Copyright (C) 2022-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -48,4 +48,5 @@ zip_int64_t zip_source_pass_to_lower_layer(zip_source_t *src, void *data, zip_ui
case ZIP_SOURCE_ACCEPT_EMPTY:
case ZIP_SOURCE_ERROR:
+ case ZIP_SOURCE_GET_DOS_TIME:
case ZIP_SOURCE_READ:
case ZIP_SOURCE_SEEK:
@@ -53,5 +54,4 @@ zip_int64_t zip_source_pass_to_lower_layer(zip_source_t *src, void *data, zip_ui
return _zip_source_call(src, data, length, command);
-
case ZIP_SOURCE_BEGIN_WRITE:
case ZIP_SOURCE_BEGIN_WRITE_CLONING:
diff --git a/src/Common/libzip/zip_source_pkware_decode.c b/src/Common/libzip/zip_source_pkware_decode.c
index b4c482b3..9c22a069 100644
--- a/src/Common/libzip/zip_source_pkware_decode.c
+++ b/src/Common/libzip/zip_source_pkware_decode.c
@@ -1,5 +1,5 @@
/*
zip_source_pkware_decode.c -- Traditional PKWARE decryption routines
- Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -81,7 +81,7 @@ static int
decrypt_header(zip_source_t *src, struct trad_pkware *ctx) {
zip_uint8_t header[ZIP_CRYPTO_PKWARE_HEADERLEN];
- struct zip_stat st;
+ zip_stat_t st;
+ zip_dostime_t dostime;
zip_int64_t n;
- bool ok = false;
if ((n = zip_source_read(src, header, ZIP_CRYPTO_PKWARE_HEADERLEN)) < 0) {
@@ -97,34 +97,33 @@ decrypt_header(zip_source_t *src, struct trad_pkware *ctx) {
_zip_pkware_decrypt(&ctx->keys, header, header, ZIP_CRYPTO_PKWARE_HEADERLEN);
- if (zip_source_stat(src, &st)) {
- /* stat failed, skip password validation */
+ if (zip_source_stat(src, &st) < 0 || (st.valid & ZIP_STAT_CRC) == 0) {
+ /* skip password validation */
return 0;
}
- /* password verification - two ways:
- * mtime - InfoZIP way, to avoid computing complete CRC before encrypting data
- * CRC - old PKWare way
- */
-
- if (st.valid & ZIP_STAT_MTIME) {
- unsigned short dostime, dosdate;
- _zip_u2d_time(st.mtime, &dostime, &dosdate);
- if (header[ZIP_CRYPTO_PKWARE_HEADERLEN - 1] == dostime >> 8) {
- ok = true;
+ if (zip_source_get_dos_time(src, &dostime) <= 0) {
+ if ((st.valid & ZIP_STAT_MTIME) == 0) {
+ /* no date available, skip password validation */
+ return 0;
}
- }
- if (st.valid & ZIP_STAT_CRC) {
- if (header[ZIP_CRYPTO_PKWARE_HEADERLEN - 1] == st.crc >> 24) {
- ok = true;
+ if (_zip_u2d_time(st.mtime, &dostime, &ctx->error) < 0) {
+ return -1;
}
}
- if (!ok && ((st.valid & (ZIP_STAT_MTIME | ZIP_STAT_CRC)) != 0)) {
+ /*
+ password verification - two ways:
+ - mtime - InfoZIP way, to avoid computing complete CRC before encrypting data
+ - CRC - old PKWare way
+ */
+ if (header[ZIP_CRYPTO_PKWARE_HEADERLEN - 1] == dostime.time >> 8
+ || header[ZIP_CRYPTO_PKWARE_HEADERLEN - 1] == st.crc >> 24) {
+ return 0;
+ }
+ else {
zip_error_set(&ctx->error, ZIP_ER_WRONGPASSWD, 0);
return -1;
}
-
- return 0;
}
diff --git a/src/Common/libzip/zip_source_pkware_encode.c b/src/Common/libzip/zip_source_pkware_encode.c
index d89b9f4e..fed76115 100644
--- a/src/Common/libzip/zip_source_pkware_encode.c
+++ b/src/Common/libzip/zip_source_pkware_encode.c
@@ -1,5 +1,5 @@
/*
zip_source_pkware_encode.c -- Traditional PKWARE encryption routines
- Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -43,6 +43,5 @@ struct trad_pkware {
zip_buffer_t *buffer;
bool eof;
- bool mtime_set;
- time_t mtime;
+ zip_dostime_t dostime;
zip_error_t error;
};
@@ -53,5 +52,4 @@ static zip_int64_t pkware_encrypt(zip_source_t *, void *, void *, zip_uint64_t,
static void trad_pkware_free(struct trad_pkware *);
static struct trad_pkware *trad_pkware_new(const char *password, zip_error_t *error);
-static void set_mtime(struct trad_pkware* ctx, zip_stat_t* st);
zip_source_t *
@@ -70,7 +68,22 @@ zip_source_pkware_encode(zip_t *za, zip_source_t *src, zip_uint16_t em, int flag
if ((ctx = trad_pkware_new(password, &za->error)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
return NULL;
}
+ if (zip_source_get_dos_time(src, &ctx->dostime) <= 0) {
+ zip_stat_t st;
+
+ if (zip_source_stat(src, &st) < 0) {
+ zip_error_set_from_source(&za->error, src);
+ trad_pkware_free(ctx);
+ return NULL;
+ }
+ if (_zip_u2d_time((st.valid & ZIP_STAT_MTIME) ? st.mtime : time(NULL), &ctx->dostime, &za->error) < 0) {
+ trad_pkware_free(ctx);
+ return NULL;
+ }
+ }
+
if ((s2 = zip_source_layered(za, src, pkware_encrypt, ctx)) == NULL) {
trad_pkware_free(ctx);
@@ -84,18 +97,6 @@ zip_source_pkware_encode(zip_t *za, zip_source_t *src, zip_uint16_t em, int flag
static int
encrypt_header(zip_source_t *src, struct trad_pkware *ctx) {
- unsigned short dostime, dosdate;
zip_uint8_t *header;
- if (!ctx->mtime_set) {
- struct zip_stat st;
- if (zip_source_stat(src, &st) != 0) {
- zip_error_set_from_source(&ctx->error, src);
- return -1;
- }
- set_mtime(ctx, &st);
- }
-
- _zip_u2d_time(ctx->mtime, &dostime, &dosdate);
-
if ((ctx->buffer = _zip_buffer_new(NULL, ZIP_CRYPTO_PKWARE_HEADERLEN)) == NULL) {
zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0);
@@ -113,5 +114,5 @@ encrypt_header(zip_source_t *src, struct trad_pkware *ctx) {
return -1;
}
- header[ZIP_CRYPTO_PKWARE_HEADERLEN - 1] = (zip_uint8_t)((dostime >> 8) & 0xff);
+ header[ZIP_CRYPTO_PKWARE_HEADERLEN - 1] = (zip_uint8_t)((ctx->dostime.time >> 8) & 0xff);
_zip_pkware_encrypt(&ctx->keys, header, header, ZIP_CRYPTO_PKWARE_HEADERLEN);
@@ -188,7 +189,4 @@ pkware_encrypt(zip_source_t *src, void *ud, void *data, zip_uint64_t length, zip
st->comp_size += ZIP_CRYPTO_PKWARE_HEADERLEN;
}
- set_mtime(ctx, st);
- st->mtime = ctx->mtime;
- st->valid |= ZIP_STAT_MTIME;
return 0;
@@ -207,6 +205,14 @@ pkware_encrypt(zip_source_t *src, void *ud, void *data, zip_uint64_t length, zip
}
+ case ZIP_SOURCE_GET_DOS_TIME:
+ if (length < sizeof(ctx->dostime)) {
+ zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
+ (void)memcpy_s(data, sizeof(ctx->dostime), &ctx->dostime, sizeof(ctx->dostime));
+ return sizeof(ctx->dostime);
+
case ZIP_SOURCE_SUPPORTS:
- return zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_GET_FILE_ATTRIBUTES, -1);
+ return zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_GET_FILE_ATTRIBUTES, ZIP_SOURCE_GET_DOS_TIME, -1);
case ZIP_SOURCE_ERROR:
@@ -238,6 +244,4 @@ trad_pkware_new(const char *password, zip_error_t *error) {
}
ctx->buffer = NULL;
- ctx->mtime_set = false;
- ctx->mtime = 0;
zip_error_init(&ctx->error);
@@ -257,15 +261,2 @@ trad_pkware_free(struct trad_pkware *ctx) {
free(ctx);
}
-
-
-static void set_mtime(struct trad_pkware* ctx, zip_stat_t* st) {
- if (!ctx->mtime_set) {
- if (st->valid & ZIP_STAT_MTIME) {
- ctx->mtime = st->mtime;
- }
- else {
- time(&ctx->mtime);
- }
- ctx->mtime_set = true;
- }
-}
diff --git a/src/Common/libzip/zip_source_read.c b/src/Common/libzip/zip_source_read.c
index 0938fcb0..910d4c3e 100644
--- a/src/Common/libzip/zip_source_read.c
+++ b/src/Common/libzip/zip_source_read.c
@@ -1,5 +1,5 @@
/*
zip_source_read.c -- read data from zip_source
- Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_remove.c b/src/Common/libzip/zip_source_remove.c
index c1d73ab9..06325b72 100644
--- a/src/Common/libzip/zip_source_remove.c
+++ b/src/Common/libzip/zip_source_remove.c
@@ -1,5 +1,5 @@
/*
zip_source_remove.c -- remove empty archive
- Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_rollback_write.c b/src/Common/libzip/zip_source_rollback_write.c
index ea1a1510..51613252 100644
--- a/src/Common/libzip/zip_source_rollback_write.c
+++ b/src/Common/libzip/zip_source_rollback_write.c
@@ -1,5 +1,5 @@
/*
zip_source_rollback_write.c -- discard changes
- Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_seek.c b/src/Common/libzip/zip_source_seek.c
index e3baad5a..42d6b0d2 100644
--- a/src/Common/libzip/zip_source_seek.c
+++ b/src/Common/libzip/zip_source_seek.c
@@ -1,5 +1,5 @@
/*
zip_source_seek.c -- seek to offset
- Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_seek_write.c b/src/Common/libzip/zip_source_seek_write.c
index 34ae2f5a..9e87fa4d 100644
--- a/src/Common/libzip/zip_source_seek_write.c
+++ b/src/Common/libzip/zip_source_seek_write.c
@@ -1,5 +1,5 @@
/*
zip_source_seek_write.c -- seek to offset for writing
- Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_stat.c b/src/Common/libzip/zip_source_stat.c
index 05dcb84d..7c8bacac 100644
--- a/src/Common/libzip/zip_source_stat.c
+++ b/src/Common/libzip/zip_source_stat.c
@@ -1,5 +1,5 @@
/*
zip_source_stat.c -- get meta information from zip_source
- Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_supports.c b/src/Common/libzip/zip_source_supports.c
index 8fea2ae9..e30ee757 100644
--- a/src/Common/libzip/zip_source_supports.c
+++ b/src/Common/libzip/zip_source_supports.c
@@ -1,5 +1,5 @@
/*
zip_source_supports.c -- check for supported functions
- Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_tell.c b/src/Common/libzip/zip_source_tell.c
index 49057ce5..33ec475e 100644
--- a/src/Common/libzip/zip_source_tell.c
+++ b/src/Common/libzip/zip_source_tell.c
@@ -1,5 +1,5 @@
/*
zip_source_tell.c -- report current offset
- Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_tell_write.c b/src/Common/libzip/zip_source_tell_write.c
index a5b0e531..6912af9e 100644
--- a/src/Common/libzip/zip_source_tell_write.c
+++ b/src/Common/libzip/zip_source_tell_write.c
@@ -1,5 +1,5 @@
/*
zip_source_tell_write.c -- report current offset for writing
- Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_window.c b/src/Common/libzip/zip_source_window.c
index 524e27c8..eac27c39 100644
--- a/src/Common/libzip/zip_source_window.c
+++ b/src/Common/libzip/zip_source_window.c
@@ -1,5 +1,5 @@
/*
zip_source_window.c -- return part of lower source
- Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2012-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -52,4 +52,6 @@ struct window {
zip_uint64_t stat_invalid;
zip_file_attributes_t attributes;
+ zip_dostime_t dostime;
+ bool dostime_valid;
zip_error_t error;
zip_int64_t supports;
@@ -62,10 +64,10 @@ static zip_int64_t window_read(zip_source_t *, void *, void *, zip_uint64_t, zip
ZIP_EXTERN zip_source_t *
zip_source_window_create(zip_source_t *src, zip_uint64_t start, zip_int64_t len, zip_error_t *error) {
- return _zip_source_window_new(src, start, len, NULL, 0, NULL, NULL, 0, false, error);
+ return _zip_source_window_new(src, start, len, NULL, 0, NULL, NULL, NULL, 0, false, error);
}
zip_source_t *
-_zip_source_window_new(zip_source_t *src, zip_uint64_t start, zip_int64_t length, zip_stat_t *st, zip_uint64_t st_invalid, zip_file_attributes_t *attributes, zip_t *source_archive, zip_uint64_t source_index, bool take_ownership, zip_error_t *error) {
+_zip_source_window_new(zip_source_t *src, zip_uint64_t start, zip_int64_t length, zip_stat_t *st, zip_uint64_t st_invalid, zip_file_attributes_t *attributes, zip_dostime_t *dostime, zip_t *source_archive, zip_uint64_t source_index, bool take_ownership, zip_error_t *error) {
zip_source_t* window_source;
struct window *ctx;
@@ -104,8 +106,15 @@ _zip_source_window_new(zip_source_t *src, zip_uint64_t start, zip_int64_t length
zip_file_attributes_init(&ctx->attributes);
}
+ if (dostime != NULL) {
+ ctx->dostime = *dostime;
+ ctx->dostime_valid = true;
+ }
+ else {
+ ctx->dostime_valid = false;
+ }
ctx->source_archive = source_archive;
ctx->source_index = source_index;
zip_error_init(&ctx->error);
- ctx->supports = (zip_source_supports(src) & (ZIP_SOURCE_SUPPORTS_SEEKABLE | ZIP_SOURCE_SUPPORTS_REOPEN)) | (zip_source_make_command_bitmap(ZIP_SOURCE_GET_FILE_ATTRIBUTES, ZIP_SOURCE_SUPPORTS, ZIP_SOURCE_TELL, ZIP_SOURCE_FREE, -1));
+ ctx->supports = (zip_source_supports(src) & (ZIP_SOURCE_SUPPORTS_SEEKABLE | ZIP_SOURCE_SUPPORTS_REOPEN)) | (zip_source_make_command_bitmap(ZIP_SOURCE_GET_FILE_ATTRIBUTES, ZIP_SOURCE_GET_DOS_TIME, ZIP_SOURCE_SUPPORTS, ZIP_SOURCE_TELL, ZIP_SOURCE_FREE, -1));
ctx->needs_seek = (ctx->supports & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SEEK)) ? true : false;
@@ -310,4 +319,17 @@ window_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_sou
return sizeof(ctx->attributes);
+ case ZIP_SOURCE_GET_DOS_TIME:
+ if (len < sizeof(ctx->dostime)) {
+ zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
+ if (ctx->dostime_valid) {
+ (void)memcpy_s(data, sizeof(ctx->dostime), &ctx->dostime, sizeof(ctx->dostime));
+ return sizeof(ctx->dostime);
+ }
+ else {
+ return 0;
+ }
+
case ZIP_SOURCE_SUPPORTS:
return ctx->supports;
diff --git a/src/Common/libzip/zip_source_winzip_aes_decode.c b/src/Common/libzip/zip_source_winzip_aes_decode.c
index ee53fb41..8830a005 100644
--- a/src/Common/libzip/zip_source_winzip_aes_decode.c
+++ b/src/Common/libzip/zip_source_winzip_aes_decode.c
@@ -1,5 +1,5 @@
/*
zip_source_winzip_aes_decode.c -- Winzip AES decryption routines
- Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_winzip_aes_encode.c b/src/Common/libzip/zip_source_winzip_aes_encode.c
index 87e2865a..c704b123 100644
--- a/src/Common/libzip/zip_source_winzip_aes_encode.c
+++ b/src/Common/libzip/zip_source_winzip_aes_encode.c
@@ -1,5 +1,5 @@
/*
zip_source_winzip_aes_encode.c -- Winzip AES encryption routines
- Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_write.c b/src/Common/libzip/zip_source_write.c
index 24dde9b2..20ca361c 100644
--- a/src/Common/libzip/zip_source_write.c
+++ b/src/Common/libzip/zip_source_write.c
@@ -1,5 +1,5 @@
/*
zip_source_write.c -- start a new file for writing
- Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_zip.c b/src/Common/libzip/zip_source_zip.c
index faabf0d2..07819865 100644
--- a/src/Common/libzip/zip_source_zip.c
+++ b/src/Common/libzip/zip_source_zip.c
@@ -1,5 +1,5 @@
/*
zip_source_zip.c -- create data source from zip file
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2023 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_source_zip_new.c b/src/Common/libzip/zip_source_zip_new.c
index ecccdd68..3eb8a4c2 100644
--- a/src/Common/libzip/zip_source_zip_new.c
+++ b/src/Common/libzip/zip_source_zip_new.c
@@ -1,5 +1,5 @@
/*
zip_source_zip_new.c -- prepare data structures for zip_fopen/zip_source_zip
- Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2012-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -201,5 +201,5 @@ ZIP_EXTERN zip_source_t *zip_source_zip_file_create(zip_t *srcza, zip_uint64_t s
}
- if ((src = _zip_source_window_new(src, start, data_len, &st2, ZIP_STAT_NAME, &attributes, source_archive, source_index, take_ownership, error)) == NULL) {
+ if ((src = _zip_source_window_new(src, start, data_len, &st2, ZIP_STAT_NAME, &attributes, &de->last_mod, source_archive, source_index, take_ownership, error)) == NULL) {
return NULL;
}
@@ -220,5 +220,5 @@ ZIP_EXTERN zip_source_t *zip_source_zip_file_create(zip_t *srcza, zip_uint64_t s
offset properly before each read for multiple zip_file_t
referring to the same underlying source */
- if ((src = _zip_source_window_new(srcza->src, 0, (zip_int64_t)st.comp_size, &st, ZIP_STAT_NAME, &attributes, srcza, srcidx, take_ownership, error)) == NULL) {
+ if ((src = _zip_source_window_new(srcza->src, 0, (zip_int64_t)st.comp_size, &st, ZIP_STAT_NAME, &attributes, &de->last_mod, srcza, srcidx, take_ownership, error)) == NULL) {
return NULL;
}
@@ -236,5 +236,5 @@ ZIP_EXTERN zip_source_t *zip_source_zip_file_create(zip_t *srcza, zip_uint64_t s
offset properly before each read for multiple zip_file_t
referring to the same underlying source */
- if ((src = _zip_source_window_new(src, 0, data_len, &st, ZIP_STAT_NAME, &attributes, NULL, 0, take_ownership, error)) == NULL) {
+ if ((src = _zip_source_window_new(src, 0, data_len, &st, ZIP_STAT_NAME, &attributes, &de->last_mod, NULL, 0, take_ownership, error)) == NULL) {
return NULL;
}
@@ -254,4 +254,5 @@ ZIP_EXTERN zip_source_t *zip_source_zip_file_create(zip_t *srcza, zip_uint64_t s
if ((enc_impl = _zip_get_encryption_implementation(st.encryption_method, ZIP_CODEC_DECODE)) == NULL) {
+ zip_source_free(src);
zip_error_set(error, ZIP_ER_ENCRNOTSUPP, 0);
return NULL;
@@ -290,5 +291,5 @@ ZIP_EXTERN zip_source_t *zip_source_zip_file_create(zip_t *srcza, zip_uint64_t s
st2.size = (zip_uint64_t)data_len;
}
- s2 = _zip_source_window_new(src, start, data_len, &st2, ZIP_STAT_NAME, NULL, NULL, 0, true, error);
+ s2 = _zip_source_window_new(src, start, data_len, &st2, ZIP_STAT_NAME, NULL, NULL, NULL, 0, true, error);
if (s2 == NULL) {
zip_source_free(src);
diff --git a/src/Common/libzip/zip_stat.c b/src/Common/libzip/zip_stat.c
index 51d8026d..74fc5c37 100644
--- a/src/Common/libzip/zip_stat.c
+++ b/src/Common/libzip/zip_stat.c
@@ -1,5 +1,5 @@
/*
zip_stat.c -- get information about file by name
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_stat_index.c b/src/Common/libzip/zip_stat_index.c
index da33c09e..af9f0e5f 100644
--- a/src/Common/libzip/zip_stat_index.c
+++ b/src/Common/libzip/zip_stat_index.c
@@ -1,5 +1,5 @@
/*
zip_stat_index.c -- get information about file by index
- Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -78,5 +78,5 @@ zip_stat_index(zip_t *za, zip_uint64_t index, zip_flags_t flags, zip_stat_t *st)
if (entry->changes != NULL && entry->changes->changed & ZIP_DIRENT_LAST_MOD) {
- st->mtime = de->last_mod;
+ st->mtime = zip_dirent_get_last_mod_mtime(de);
st->valid |= ZIP_STAT_MTIME;
}
@@ -87,5 +87,5 @@ zip_stat_index(zip_t *za, zip_uint64_t index, zip_flags_t flags, zip_stat_t *st)
st->crc = de->crc;
st->size = de->uncomp_size;
- st->mtime = de->last_mod;
+ st->mtime = zip_dirent_get_last_mod_mtime(de);
st->comp_size = de->comp_size;
st->comp_method = (zip_uint16_t)de->comp_method;
@@ -98,6 +98,10 @@ zip_stat_index(zip_t *za, zip_uint64_t index, zip_flags_t flags, zip_stat_t *st)
if ((za->ch_flags & ZIP_AFL_WANT_TORRENTZIP) && (flags & ZIP_FL_UNCHANGED) == 0) {
+ if (za->torrent_mtime == 0) {
+ zip_dostime_t dostime = {0xbc00, 0x2198};
+ za->torrent_mtime = _zip_d2u_time(&dostime);
+ }
st->comp_method = ZIP_CM_DEFLATE;
- st->mtime = _zip_d2u_time(0xbc00, 0x2198);
+ st->mtime = za->torrent_mtime;
st->valid |= ZIP_STAT_MTIME | ZIP_STAT_COMP_METHOD;
st->valid &= ~ZIP_STAT_COMP_SIZE;
diff --git a/src/Common/libzip/zip_stat_init.c b/src/Common/libzip/zip_stat_init.c
index 9c6088a7..bd83565b 100644
--- a/src/Common/libzip/zip_stat_init.c
+++ b/src/Common/libzip/zip_stat_init.c
@@ -1,5 +1,5 @@
/*
zip_stat_init.c -- initialize struct zip_stat.
- Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2006-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_strerror.c b/src/Common/libzip/zip_strerror.c
index 7d827931..681024a3 100644
--- a/src/Common/libzip/zip_strerror.c
+++ b/src/Common/libzip/zip_strerror.c
@@ -1,5 +1,5 @@
/*
zip_sterror.c -- get string representation of zip error
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_string.c b/src/Common/libzip/zip_string.c
index 1c964491..bb06c1d6 100644
--- a/src/Common/libzip/zip_string.c
+++ b/src/Common/libzip/zip_string.c
@@ -1,5 +1,5 @@
/*
zip_string.c -- string handling (with encoding)
- Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2012-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -89,6 +89,8 @@ _zip_string_get(zip_string_t *string, zip_uint32_t *lenp, zip_flags_t flags, zip
if ((flags & ZIP_FL_ENC_RAW) == 0) {
/* start guessing */
- if (string->encoding == ZIP_ENCODING_UNKNOWN)
- _zip_guess_encoding(string, ZIP_ENCODING_UNKNOWN);
+ if (string->encoding == ZIP_ENCODING_UNKNOWN) {
+ /* guess encoding, sets string->encoding */
+ (void)_zip_guess_encoding(string, ZIP_ENCODING_UNKNOWN);
+ }
if (((flags & ZIP_FL_ENC_STRICT) && string->encoding != ZIP_ENCODING_ASCII && string->encoding != ZIP_ENCODING_UTF8_KNOWN) || (string->encoding == ZIP_ENCODING_CP437)) {
@@ -108,4 +110,18 @@ _zip_string_get(zip_string_t *string, zip_uint32_t *lenp, zip_flags_t flags, zip
}
+bool _zip_string_is_ascii(const zip_string_t *string) {
+ if (string->encoding != ZIP_ENCODING_ASCII) {
+ zip_uint16_t i;
+
+ for (i = 0; i < string->length; i++) {
+ if (string->raw[i] & 0x80) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
zip_uint16_t
diff --git a/src/Common/libzip/zip_unchange_all.c b/src/Common/libzip/zip_unchange_all.c
index 34f3702e..0b22c803 100644
--- a/src/Common/libzip/zip_unchange_all.c
+++ b/src/Common/libzip/zip_unchange_all.c
@@ -1,5 +1,5 @@
/*
zip_unchange.c -- undo changes to all files in zip archive
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_unchange_archive.c b/src/Common/libzip/zip_unchange_archive.c
index 56a8e31f..ddd617bc 100644
--- a/src/Common/libzip/zip_unchange_archive.c
+++ b/src/Common/libzip/zip_unchange_archive.c
@@ -1,5 +1,5 @@
/*
zip_unchange_archive.c -- undo global changes to ZIP archive
- Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2006-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_unchange_data.c b/src/Common/libzip/zip_unchange_data.c
index 6bdecd18..30a7be7b 100644
--- a/src/Common/libzip/zip_unchange_data.c
+++ b/src/Common/libzip/zip_unchange_data.c
@@ -1,5 +1,5 @@
/*
zip_unchange_data.c -- undo helper function
- Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zip_utf-8.c b/src/Common/libzip/zip_utf-8.c
index 678912f6..7d671f60 100644
--- a/src/Common/libzip/zip_utf-8.c
+++ b/src/Common/libzip/zip_utf-8.c
@@ -1,5 +1,5 @@
/*
zip_utf-8.c -- UTF-8 support functions for libzip
- Copyright (C) 2011-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2011-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -102,56 +102,107 @@ _zip_guess_encoding(zip_string_t *str, zip_encoding_type_t expected_encoding) {
const zip_uint8_t *name;
zip_uint32_t i, j, ulen;
+ bool can_be_ascii = true;
+ bool can_be_utf8 = true;
+ bool has_control_characters = false;
- if (str == NULL)
+ if (str == NULL) {
return ZIP_ENCODING_ASCII;
+ }
name = str->raw;
- if (str->encoding != ZIP_ENCODING_UNKNOWN)
- enc = str->encoding;
- else {
- enc = ZIP_ENCODING_ASCII;
- for (i = 0; i < str->length; i++) {
- if ((name[i] > 31 && name[i] < 128) || name[i] == '\r' || name[i] == '\n' || name[i] == '\t')
- continue;
-
- enc = ZIP_ENCODING_UTF8_GUESSED;
- if ((name[i] & UTF_8_LEN_2_MASK) == UTF_8_LEN_2_MATCH)
- ulen = 1;
- else if ((name[i] & UTF_8_LEN_3_MASK) == UTF_8_LEN_3_MATCH)
- ulen = 2;
- else if ((name[i] & UTF_8_LEN_4_MASK) == UTF_8_LEN_4_MATCH)
- ulen = 3;
- else {
- enc = ZIP_ENCODING_CP437;
- break;
- }
+ if (str->encoding != ZIP_ENCODING_UNKNOWN) {
+ return str->encoding;
+ }
- if (i + ulen >= str->length) {
- enc = ZIP_ENCODING_CP437;
- break;
+ for (i = 0; i < str->length; i++) {
+ if (name[i] < 128) {
+ if (name[i] < 32 && name[i] != '\r' && name[i] != '\n' && name[i] != '\t') {
+ has_control_characters = true;
}
+ continue;
+ }
+
+ can_be_ascii = false;
+ if ((name[i] & UTF_8_LEN_2_MASK) == UTF_8_LEN_2_MATCH) {
+ ulen = 1;
+ }
+ else if ((name[i] & UTF_8_LEN_3_MASK) == UTF_8_LEN_3_MATCH) {
+ ulen = 2;
+ }
+ else if ((name[i] & UTF_8_LEN_4_MASK) == UTF_8_LEN_4_MATCH) {
+ ulen = 3;
+ }
+ else {
+ can_be_utf8 = false;
+ break;
+ }
- for (j = 1; j <= ulen; j++) {
- if ((name[i + j] & UTF_8_CONTINUE_MASK) != UTF_8_CONTINUE_MATCH) {
- enc = ZIP_ENCODING_CP437;
- goto done;
- }
+ if (i + ulen >= str->length) {
+ can_be_utf8 = false;
+ break;
+ }
+
+ for (j = 1; j <= ulen; j++) {
+ if ((name[i + j] & UTF_8_CONTINUE_MASK) != UTF_8_CONTINUE_MATCH) {
+ can_be_utf8 = false;
+ goto done;
}
- i += ulen;
}
+ i += ulen;
}
-done:
- str->encoding = enc;
+ done:
+ enc = ZIP_ENCODING_CP437;
+
+ switch (expected_encoding) {
+ case ZIP_ENCODING_UTF8_KNOWN:
+ case ZIP_ENCODING_UTF8_GUESSED:
+ if (can_be_utf8) {
+ enc = ZIP_ENCODING_UTF8_KNOWN;
+ }
+ else {
+ enc = ZIP_ENCODING_ERROR;
+ }
+ break;
- if (expected_encoding != ZIP_ENCODING_UNKNOWN) {
- if (expected_encoding == ZIP_ENCODING_UTF8_KNOWN && enc == ZIP_ENCODING_UTF8_GUESSED)
- str->encoding = enc = ZIP_ENCODING_UTF8_KNOWN;
+ case ZIP_ENCODING_ASCII:
+ if (can_be_ascii && !has_control_characters) {
+ enc = ZIP_ENCODING_ASCII;
+ }
+ else {
+ enc = ZIP_ENCODING_ERROR;
+ }
+ break;
- if (expected_encoding != enc && enc != ZIP_ENCODING_ASCII)
- return ZIP_ENCODING_ERROR;
+ case ZIP_ENCODING_CP437:
+ enc = ZIP_ENCODING_CP437;
+ break;
+
+ case ZIP_ENCODING_UNKNOWN:
+ if (can_be_ascii && !has_control_characters) {
+ /* only bytes from 0x20-0x7F */
+ enc = ZIP_ENCODING_ASCII;
+ }
+ else if (can_be_ascii && has_control_characters) {
+ /* only bytes from 0x00-0x7F */
+ enc = ZIP_ENCODING_CP437;
+ }
+ else if (can_be_utf8) {
+ /* contains bytes from 0x80-0xFF and is valid UTF-8 */
+ enc = ZIP_ENCODING_UTF8_GUESSED;
+ }
+ else {
+ /* fallback */
+ enc = ZIP_ENCODING_CP437;
+ }
+ break;
+ case ZIP_ENCODING_ERROR:
+ /* invalid, shouldn't happen */
+ enc = ZIP_ENCODING_ERROR;
+ break;
}
+ str->encoding = enc;
return enc;
}
@@ -160,10 +211,13 @@ done:
static zip_uint32_t
_zip_unicode_to_utf8_len(zip_uint32_t codepoint) {
- if (codepoint < 0x0080)
+ if (codepoint < 0x0080) {
return 1;
- if (codepoint < 0x0800)
+ }
+ if (codepoint < 0x0800) {
return 2;
- if (codepoint < 0x10000)
+ }
+ if (codepoint < 0x10000) {
return 3;
+ }
return 4;
}
@@ -202,12 +256,14 @@ _zip_cp437_to_utf8(const zip_uint8_t *const _cp437buf, zip_uint32_t len, zip_uin
if (len == 0) {
- if (utf8_lenp)
+ if (utf8_lenp) {
*utf8_lenp = 0;
+ }
return NULL;
}
buflen = 1;
- for (i = 0; i < len; i++)
+ for (i = 0; i < len; i++) {
buflen += _zip_unicode_to_utf8_len(_cp437_to_unicode[cp437buf[i]]);
+ }
if ((utf8buf = (zip_uint8_t *)malloc(buflen)) == NULL) {
@@ -217,10 +273,12 @@ _zip_cp437_to_utf8(const zip_uint8_t *const _cp437buf, zip_uint32_t len, zip_uin
offset = 0;
- for (i = 0; i < len; i++)
+ for (i = 0; i < len; i++) {
offset += _zip_unicode_to_utf8(_cp437_to_unicode[cp437buf[i]], utf8buf + offset);
+ }
utf8buf[buflen - 1] = 0;
- if (utf8_lenp)
+ if (utf8_lenp) {
*utf8_lenp = buflen - 1;
+ }
return utf8buf;
}
diff --git a/src/Common/libzip/zip_winzip_aes.c b/src/Common/libzip/zip_winzip_aes.c
index ce269036..2c9874b0 100644
--- a/src/Common/libzip/zip_winzip_aes.c
+++ b/src/Common/libzip/zip_winzip_aes.c
@@ -1,5 +1,5 @@
/*
zip_winzip_aes.c -- Winzip AES de/encryption backend routines
- Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
+ Copyright (C) 2017-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
diff --git a/src/Common/libzip/zipconf.h b/src/Common/libzip/zipconf.h
index 472e06c1..28954780 100644
--- a/src/Common/libzip/zipconf.h
+++ b/src/Common/libzip/zipconf.h
@@ -9,8 +9,8 @@
*/
-#define LIBZIP_VERSION "1.10.1"
+#define LIBZIP_VERSION "1.11.2"
#define LIBZIP_VERSION_MAJOR 1
-#define LIBZIP_VERSION_MINOR 10
-#define LIBZIP_VERSION_MICRO 1
+#define LIBZIP_VERSION_MINOR 11
+#define LIBZIP_VERSION_MICRO 2
/* #undef ZIP_STATIC */
diff --git a/src/Common/libzip/zipint.h b/src/Common/libzip/zipint.h
index 4887b6c5..e22d74c2 100644
--- a/src/Common/libzip/zipint.h
+++ b/src/Common/libzip/zipint.h
@@ -4,5 +4,5 @@
/*
zipint.h -- internal declarations.
- Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
@@ -57,4 +57,5 @@
#define EOCD64LOC_MAGIC "PK\6\7"
#define EOCD64_MAGIC "PK\6\6"
+#define MAGIC_LEN 4
#define CDENTRYSIZE 46u
#define LENTRYSIZE 30
@@ -230,10 +231,15 @@ extern const int _zip_err_details_count;
#define ZIP_ER_DETAIL_VARIABLE_SIZE_OVERFLOW 12 /* E variable size fields overflow header */
#define ZIP_ER_DETAIL_INVALID_UTF8_IN_FILENAME 13 /* E invalid UTF-8 in filename */
-#define ZIP_ER_DETAIL_INVALID_UTF8_IN_COMMENT 13 /* E invalid UTF-8 in comment */
-#define ZIP_ER_DETAIL_INVALID_ZIP64_EF 14 /* E invalid Zip64 extra field */
-#define ZIP_ER_DETAIL_INVALID_WINZIPAES_EF 14 /* E invalid WinZip AES extra field */
-#define ZIP_ER_DETAIL_EF_TRAILING_GARBAGE 15 /* E garbage at end of extra fields */
-#define ZIP_ER_DETAIL_INVALID_EF_LENGTH 16 /* E extra field length is invalid */
-#define ZIP_ER_DETAIL_INVALID_FILE_LENGTH 17 /* E file length in header doesn't match actual file length */
+#define ZIP_ER_DETAIL_INVALID_UTF8_IN_COMMENT 14 /* E invalid UTF-8 in comment */
+#define ZIP_ER_DETAIL_INVALID_ZIP64_EF 15 /* E invalid Zip64 extra field */
+#define ZIP_ER_DETAIL_INVALID_WINZIPAES_EF 16 /* E invalid WinZip AES extra field */
+#define ZIP_ER_DETAIL_EF_TRAILING_GARBAGE 17 /* E garbage at end of extra fields */
+#define ZIP_ER_DETAIL_INVALID_EF_LENGTH 18 /* E extra field length is invalid */
+#define ZIP_ER_DETAIL_INVALID_FILE_LENGTH 19 /* E file length in header doesn't match actual file length */
+#define ZIP_ER_DETAIL_STORED_SIZE_MISMATCH 20 /* E compressed and uncompressed sizes don't match for stored file */
+#define ZIP_ER_DETAIL_DATA_DESCRIPTOR_MISMATCH 21 /* E local header and data descriptor do not match */
+#define ZIP_ER_DETAIL_EOCD64_LOCATOR_MISMATCH 22 /* G EOCD64 and EOCD64 locator do not match */
+#define ZIP_ER_DETAIL_UTF8_FILENAME_MISMATCH 23 /* E UTF-8 filename is ASCII and doesn't match filename */
+#define ZIP_ER_DETAIL_UTF8_COMMENT_MISMATCH 24 /* E UTF-8 comment is ASCII and doesn't match comment */
/* directory entry: general purpose bit flags */
@@ -271,4 +277,5 @@ struct zip_progress;
typedef struct zip_cdir zip_cdir_t;
+typedef struct zip_dostime zip_dostime_t;
typedef struct zip_dirent zip_dirent_t;
typedef struct zip_entry zip_entry_t;
@@ -308,4 +315,5 @@ struct zip {
zip_uint32_t* write_crc; /* have _zip_write() compute CRC */
+ time_t torrent_mtime;
};
@@ -329,4 +337,9 @@ struct zip_file {
#define ZIP_DIRENT_ALL ZIP_UINT32_MAX
+struct zip_dostime {
+ zip_uint16_t time;
+ zip_uint16_t date;
+};
+
struct zip_dirent {
zip_uint32_t changed;
@@ -335,4 +348,5 @@ struct zip_dirent {
bool crc_valid; /* if CRC is valid (sometimes not for encrypted archives) */
+ bool last_mod_mtime_valid;
zip_uint16_t version_madeby; /* (c) version of creator */
@@ -340,5 +354,5 @@ struct zip_dirent {
zip_uint16_t bitflags; /* (cl) general purpose bit flag */
zip_int32_t comp_method; /* (cl) compression method used (uint16 and ZIP_CM_DEFAULT (-1)) */
- time_t last_mod; /* (cl) time of last modification */
+ zip_dostime_t last_mod; /* (cl) time of last modification */
zip_uint32_t crc; /* (cl) CRC-32 of uncompressed data */
zip_uint64_t comp_size; /* (cl) size of compressed data */
@@ -355,4 +369,6 @@ struct zip_dirent {
zip_uint16_t encryption_method; /* encryption method, computed from other fields */
char *password; /* file specific encryption password */
+
+ time_t last_mod_mtime; /* cached last_mod in Unix time format */
};
@@ -364,6 +380,11 @@ struct zip_cdir {
zip_uint64_t nentry_alloc; /* number of entries allocated */
+ zip_uint32_t this_disk;
+ zip_uint32_t eocd_disk;
+ zip_uint64_t disk_entries; /* number of entries on this disk */
+ zip_uint64_t num_entries; /* number of entries on all disks */
zip_uint64_t size; /* size of central directory */
zip_uint64_t offset; /* offset of central directory in file */
+ zip_uint64_t eocd_offset; /* offset of EOCD in file */
zip_string_t *comment; /* zip archive comment */
bool is_zip64; /* central directory in zip64 format */
@@ -527,18 +548,20 @@ zip_uint64_t _zip_buffer_size(zip_buffer_t *buffer);
void _zip_cdir_free(zip_cdir_t *);
bool _zip_cdir_grow(zip_cdir_t *cd, zip_uint64_t additional_entries, zip_error_t *error);
-zip_cdir_t *_zip_cdir_new(zip_uint64_t, zip_error_t *);
+zip_cdir_t *_zip_cdir_new(zip_error_t *);
zip_int64_t _zip_cdir_write(zip_t *za, const zip_filelist_t *filelist, zip_uint64_t survivors);
-time_t _zip_d2u_time(zip_uint16_t, zip_uint16_t);
+time_t _zip_d2u_time(const zip_dostime_t*);
void _zip_deregister_source(zip_t *za, zip_source_t *src);
void _zip_dirent_apply_attributes(zip_dirent_t *, zip_file_attributes_t *, bool, zip_uint32_t);
+int zip_dirent_check_consistency(zip_dirent_t *dirent);
zip_dirent_t *_zip_dirent_clone(const zip_dirent_t *);
void _zip_dirent_free(zip_dirent_t *);
void _zip_dirent_finalize(zip_dirent_t *);
+time_t zip_dirent_get_last_mod_mtime(zip_dirent_t *de);
void _zip_dirent_init(zip_dirent_t *);
bool _zip_dirent_needs_zip64(const zip_dirent_t *, zip_flags_t);
zip_dirent_t *_zip_dirent_new(void);
bool zip_dirent_process_ef_zip64(zip_dirent_t * zde, const zip_uint8_t * ef, zip_uint64_t got_len, bool local, zip_error_t * error);
-zip_int64_t _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, bool local, zip_error_t *error);
+zip_int64_t _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, bool local, zip_uint64_t central_compressed_size, bool check_consistency, zip_error_t *error);
void _zip_dirent_set_version_needed(zip_dirent_t *de, bool force_zip64);
void zip_dirent_torrentzip_normalize(zip_dirent_t *de);
@@ -612,4 +635,6 @@ bool zip_source_accept_empty(zip_source_t *src);
zip_int64_t _zip_source_call(zip_source_t *src, void *data, zip_uint64_t length, zip_source_cmd_t command);
bool _zip_source_eof(zip_source_t *);
+int zip_source_get_dos_time(zip_source_t *src, zip_dostime_t *dos_time);
+
zip_source_t *_zip_source_file_or_p(const char *, FILE *, zip_uint64_t, zip_int64_t, const zip_stat_t *, zip_error_t *error);
bool _zip_source_had_error(zip_source_t *);
@@ -617,5 +642,5 @@ void _zip_source_invalidate(zip_source_t *src);
zip_source_t *_zip_source_new(zip_error_t *error);
int _zip_source_set_source_archive(zip_source_t *, zip_t *);
-zip_source_t *_zip_source_window_new(zip_source_t *src, zip_uint64_t start, zip_int64_t length, zip_stat_t *st, zip_uint64_t st_invalid, zip_file_attributes_t *attributes, zip_t *source_archive, zip_uint64_t source_index, bool take_ownership, zip_error_t *error);
+zip_source_t *_zip_source_window_new(zip_source_t *src, zip_uint64_t start, zip_int64_t length, zip_stat_t *st, zip_uint64_t st_invalid, zip_file_attributes_t *attributes, zip_dostime_t *dostime, zip_t *source_archive, zip_uint64_t source_index, bool take_ownership, zip_error_t *error);
int _zip_stat_merge(zip_stat_t *dst, const zip_stat_t *src, zip_error_t *error);
@@ -624,4 +649,5 @@ void _zip_string_free(zip_string_t *string);
zip_uint32_t _zip_string_crc32(const zip_string_t *string);
const zip_uint8_t *_zip_string_get(zip_string_t *string, zip_uint32_t *lenp, zip_flags_t flags, zip_error_t *error);
+bool _zip_string_is_ascii(const zip_string_t *string);
zip_uint16_t _zip_string_length(const zip_string_t *string);
zip_string_t *_zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, zip_error_t *error);
@@ -648,8 +674,8 @@ zip_t *_zip_new(zip_error_t *);
zip_int64_t _zip_file_replace(zip_t *, zip_uint64_t, const char *, zip_source_t *, zip_flags_t);
int _zip_set_name(zip_t *, zip_uint64_t, const char *, zip_flags_t);
-void _zip_u2d_time(time_t, zip_uint16_t *, zip_uint16_t *);
+int _zip_u2d_time(time_t, zip_dostime_t *, zip_error_t *);
int _zip_unchange(zip_t *, zip_uint64_t, int);
void _zip_unchange_data(zip_entry_t *);
int _zip_write(zip_t *za, const void *data, zip_uint64_t length);
-#endif /* zipint.h */
+#endif /* _HAD_ZIPINT_H */