From b261177b8f5bc3f8495406d13dc03c0328b930f9 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Mon, 2 May 2016 14:45:22 +0200 Subject: [PATCH] Windows/Linux/MacOSX: Set maximum PIM value to 2147468 in order to avoid having negative values for iterations count using the formula 15000 + (PIM x 1000). Add specific error message to XML language files. --- Translations/Language.ar.xml | 1 + Translations/Language.be.xml | 1 + Translations/Language.bg.xml | 1 + Translations/Language.ca.xml | 1 + Translations/Language.cs.xml | 1 + Translations/Language.da.xml | 1 + Translations/Language.de.xml | 1 + Translations/Language.el.xml | 1 + Translations/Language.es.xml | 1 + Translations/Language.et.xml | 1 + Translations/Language.eu.xml | 1 + Translations/Language.fa.xml | 1 + Translations/Language.fi.xml | 1 + Translations/Language.fr.xml | 1 + Translations/Language.hu.xml | 1 + Translations/Language.id.xml | 1 + Translations/Language.it.xml | 1 + Translations/Language.ja.xml | 1 + Translations/Language.ka.xml | 1 + Translations/Language.ko.xml | 1 + Translations/Language.lv.xml | 1 + Translations/Language.my.xml | 1 + Translations/Language.nl.xml | 1 + Translations/Language.nn.xml | 1 + Translations/Language.pl.xml | 1 + Translations/Language.pt-br.xml | 1 + Translations/Language.ru.xml | 1 + Translations/Language.sk.xml | 1 + Translations/Language.sl.xml | 1 + Translations/Language.sv.xml | 1 + Translations/Language.tr.xml | 1 + Translations/Language.uk.xml | 1 + Translations/Language.uz.xml | 1 + Translations/Language.vi.xml | 1 + Translations/Language.zh-cn.xml | 1 + Translations/Language.zh-hk.xml | 1 + Translations/Language.zh-tw.xml | 1 + src/Common/Language.xml | 1 + src/Common/Password.h | 3 ++- src/Format/Tcformat.c | Bin 642784 -> 643202 bytes src/Main/CommandLineInterface.cpp | 6 +++--- src/Main/Forms/Forms.cpp | 4 ++-- src/Main/Forms/MountOptionsDialog.cpp | 4 ++-- src/Main/Forms/TrueCrypt.fbp | 4 ++-- src/Main/Forms/VolumePasswordPanel.cpp | 6 ++++-- src/Main/Forms/VolumePimWizardPage.cpp | 2 +- src/Main/Main.h | 5 +++++ src/Main/TextUserInterface.cpp | 6 ++++++ src/Mount/Favorites.cpp | 16 +++++++++++++++- src/Mount/Mount.c | 9 ++++++++- 50 files changed, 88 insertions(+), 15 deletions(-) diff --git a/Translations/Language.ar.xml b/Translations/Language.ar.xml index 5e471b95..4f2b0216 100644 --- a/Translations/Language.ar.xml +++ b/Translations/Language.ar.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.be.xml b/Translations/Language.be.xml index 025da788..82df7d7c 100644 --- a/Translations/Language.be.xml +++ b/Translations/Language.be.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.bg.xml b/Translations/Language.bg.xml index d5d6fd59..264e0f9f 100644 --- a/Translations/Language.bg.xml +++ b/Translations/Language.bg.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.ca.xml b/Translations/Language.ca.xml index d985c01d..36e33320 100644 --- a/Translations/Language.ca.xml +++ b/Translations/Language.ca.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.cs.xml b/Translations/Language.cs.xml index c2298f4a..35aad9af 100644 --- a/Translations/Language.cs.xml +++ b/Translations/Language.cs.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.da.xml b/Translations/Language.da.xml index 65b7642e..98eaf461 100644 --- a/Translations/Language.da.xml +++ b/Translations/Language.da.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.de.xml b/Translations/Language.de.xml index 59a5db59..2b1e5c10 100644 --- a/Translations/Language.de.xml +++ b/Translations/Language.de.xml @@ -1398,6 +1398,7 @@ Wert in die Zwischenablage kopieren... Im Prä-Boot-Authentifikationsbildschirm keinen PIM abfragen WARNUNG: Sie sollten nicht vergessen, dass, wenn Sie diese Option aktivieren, der PIM-Wert unverschlüsselt auf der Festplatte gespeichert wird.\n\nSind Sie sicher, dass Sie diese Option aktivieren möchten? + Der größtmögliche Wert für den PIM (Personal Iterations Multiplier) ist 2147468. diff --git a/Translations/Language.el.xml b/Translations/Language.el.xml index 72de8fb6..6198084c 100644 --- a/Translations/Language.el.xml +++ b/Translations/Language.el.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.es.xml b/Translations/Language.es.xml index 1a2e55fc..27c3613c 100644 --- a/Translations/Language.es.xml +++ b/Translations/Language.es.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.et.xml b/Translations/Language.et.xml index 0a46c980..20aee1f3 100644 --- a/Translations/Language.et.xml +++ b/Translations/Language.et.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.eu.xml b/Translations/Language.eu.xml index c5e67cde..80aa70fc 100644 --- a/Translations/Language.eu.xml +++ b/Translations/Language.eu.xml @@ -1398,6 +1398,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.fa.xml b/Translations/Language.fa.xml index 184c7a20..a6f215b8 100644 --- a/Translations/Language.fa.xml +++ b/Translations/Language.fa.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.fi.xml b/Translations/Language.fi.xml index bd44a623..259ac30a 100644 --- a/Translations/Language.fi.xml +++ b/Translations/Language.fi.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.fr.xml b/Translations/Language.fr.xml index 90365020..7bed07c4 100644 --- a/Translations/Language.fr.xml +++ b/Translations/Language.fr.xml @@ -1396,6 +1396,7 @@ Copier la valeur vers le Presse-Papier... Ne demander aucun PIM dans l'écran d'authentification de pré-amorçage. AVERTISSEMENT : Gardez à l'esprit que si vous activez cette option, la valeur du PIM sera écrite non chiffrée sur le disk.\n\nÊtes-vous sûr que vous souhaitez activer cette option ? + La valeur maximale du PIM est 2147468. diff --git a/Translations/Language.hu.xml b/Translations/Language.hu.xml index a6c40a2d..51586b96 100644 --- a/Translations/Language.hu.xml +++ b/Translations/Language.hu.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.id.xml b/Translations/Language.id.xml index 7e85e9be..70ea95e9 100644 --- a/Translations/Language.id.xml +++ b/Translations/Language.id.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.it.xml b/Translations/Language.it.xml index a1f14f27..5dda93aa 100644 --- a/Translations/Language.it.xml +++ b/Translations/Language.it.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.ja.xml b/Translations/Language.ja.xml index b6c85633..92f94ef0 100644 --- a/Translations/Language.ja.xml +++ b/Translations/Language.ja.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.ka.xml b/Translations/Language.ka.xml index 34711d46..7e196212 100644 --- a/Translations/Language.ka.xml +++ b/Translations/Language.ka.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.ko.xml b/Translations/Language.ko.xml index 8840b612..603bb833 100644 --- a/Translations/Language.ko.xml +++ b/Translations/Language.ko.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.lv.xml b/Translations/Language.lv.xml index ed791c14..a2e398be 100644 --- a/Translations/Language.lv.xml +++ b/Translations/Language.lv.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.my.xml b/Translations/Language.my.xml index 835c32c8..cb3ac8c5 100644 --- a/Translations/Language.my.xml +++ b/Translations/Language.my.xml @@ -1398,6 +1398,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.nl.xml b/Translations/Language.nl.xml index cf322b19..eb450139 100644 --- a/Translations/Language.nl.xml +++ b/Translations/Language.nl.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.nn.xml b/Translations/Language.nn.xml index 9f1ee4bd..6a346437 100644 --- a/Translations/Language.nn.xml +++ b/Translations/Language.nn.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.pl.xml b/Translations/Language.pl.xml index 7d9967dc..56b3e1ed 100644 --- a/Translations/Language.pl.xml +++ b/Translations/Language.pl.xml @@ -1397,6 +1397,7 @@ płyty ratunkowej VeraCrypt, włóż ją do napędu CD/DVD i uruchom ponownie ko Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.pt-br.xml b/Translations/Language.pt-br.xml index 91e596d9..065d7cf2 100644 --- a/Translations/Language.pt-br.xml +++ b/Translations/Language.pt-br.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.ru.xml b/Translations/Language.ru.xml index 3dcdc976..bb57148b 100644 --- a/Translations/Language.ru.xml +++ b/Translations/Language.ru.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.sk.xml b/Translations/Language.sk.xml index 19fca7fe..824b382a 100644 --- a/Translations/Language.sk.xml +++ b/Translations/Language.sk.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.sl.xml b/Translations/Language.sl.xml index 19459a18..2e9baa6c 100644 --- a/Translations/Language.sl.xml +++ b/Translations/Language.sl.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.sv.xml b/Translations/Language.sv.xml index 09b0874d..f10d85fe 100644 --- a/Translations/Language.sv.xml +++ b/Translations/Language.sv.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.tr.xml b/Translations/Language.tr.xml index 418ebf5f..420a5f4e 100644 --- a/Translations/Language.tr.xml +++ b/Translations/Language.tr.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.uk.xml b/Translations/Language.uk.xml index ab7127af..89f72f69 100644 --- a/Translations/Language.uk.xml +++ b/Translations/Language.uk.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.uz.xml b/Translations/Language.uz.xml index 49c35628..ec7a68f0 100644 --- a/Translations/Language.uz.xml +++ b/Translations/Language.uz.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.vi.xml b/Translations/Language.vi.xml index 89272077..5e688976 100644 --- a/Translations/Language.vi.xml +++ b/Translations/Language.vi.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.zh-cn.xml b/Translations/Language.zh-cn.xml index fc673746..6b209cf6 100644 --- a/Translations/Language.zh-cn.xml +++ b/Translations/Language.zh-cn.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.zh-hk.xml b/Translations/Language.zh-hk.xml index f2291435..8f8a9d8d 100644 --- a/Translations/Language.zh-hk.xml +++ b/Translations/Language.zh-hk.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/Translations/Language.zh-tw.xml b/Translations/Language.zh-tw.xml index 1786c666..b8aa5ded 100644 --- a/Translations/Language.zh-tw.xml +++ b/Translations/Language.zh-tw.xml @@ -1394,6 +1394,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/src/Common/Language.xml b/src/Common/Language.xml index f72e1a30..8f83b864 100644 --- a/src/Common/Language.xml +++ b/src/Common/Language.xml @@ -1396,6 +1396,7 @@ Copy Value to Clipboard... Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk) WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? + Personal Iterations Multiplier (PIM) maximum value is 2147468. diff --git a/src/Common/Password.h b/src/Common/Password.h index c6d1579b..e2058cdb 100644 --- a/src/Common/Password.h +++ b/src/Common/Password.h @@ -17,7 +17,8 @@ // User text input limits #define MIN_PASSWORD 1 // Minimum possible password length #define MAX_PASSWORD 64 // Maximum possible password length -#define MAX_PIM 10 // Maximum allowed digits in a PIM (enough for 32-bit value) +#define MAX_PIM 7 // Maximum allowed digits in a PIM (enough for maximum value) +#define MAX_PIM_VALUE 2147468 // Maximum value to have a positive 32-bit result for formula 15000 + (PIM x 1000) #define MAX_BOOT_PIM 5 // Maximum allowed digits in a PIM for boot (enough for 16-bit value) #define MAX_BOOT_PIM_VALUE 65535 diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index 3e228ac031894e6d3d227e5e79418b2e5bd7c09c..c49bc94b617487eb611f9a3f3e83a6c648ab752c 100644 GIT binary patch delta 155 zcmV;M0A&B*ohO2!CxC>8JDkp&o+uz3O!1yBG<08N(*IR`hEM*$9(5U&O* zmmm}dSckAT2e+^{2x4iM{HzEPmyn?d2$woI2MiHV07(E%0AB!B06_pu0961*hY6tw Jw+W#M*DbmpE?xit delta 53 zcmZo#sQzHCdP56i3sVbo3rh=Y3)>d<2=nO*B5V=U`PA4m+N&(tw^vzm{K{zGvWR2* JmPMTBbOG_>6I1{I diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp index 2222b54f..e48a495f 100644 --- a/src/Main/CommandLineInterface.cpp +++ b/src/Main/CommandLineInterface.cpp @@ -414,7 +414,7 @@ namespace VeraCrypt throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); } - if (ArgNewPim < 0) + if (ArgNewPim < 0 || ArgNewPim > (ArgMountOptions.PartitionInSystemEncryptionScope? MAX_BOOT_PIM_VALUE: MAX_PIM_VALUE)) throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); else if (ArgNewPim > 0 && ArgTrueCryptMode) throw_err (LangString["PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]); @@ -454,7 +454,7 @@ namespace VeraCrypt throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); } - if (ArgPim < 0) + if (ArgPim < 0 || ArgPim > (ArgMountOptions.PartitionInSystemEncryptionScope? MAX_BOOT_PIM_VALUE: MAX_PIM_VALUE)) throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); else if (ArgPim > 0 && ArgTrueCryptMode) throw_err (LangString["PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]); @@ -491,7 +491,7 @@ namespace VeraCrypt try { pim = StringConverter::ToInt32 (wstring (str)); - if (pim < 0) + if (pim < 0 || pim > (ArgMountOptions.PartitionInSystemEncryptionScope? MAX_BOOT_PIM_VALUE: MAX_PIM_VALUE)) throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); } catch (...) diff --git a/src/Main/Forms/Forms.cpp b/src/Main/Forms/Forms.cpp index 5fa70e5f..ee8455bf 100644 --- a/src/Main/Forms/Forms.cpp +++ b/src/Main/Forms/Forms.cpp @@ -3240,7 +3240,7 @@ VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID i GridBagSizer->Add( VolumePimStaticText, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT, 5 ); VolumePimTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD ); - VolumePimTextCtrl->SetMaxLength( 10 ); + VolumePimTextCtrl->SetMaxLength( 7 ); GridBagSizer->Add( VolumePimTextCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND, 5 ); VolumePimHelpStaticText = new wxStaticText( this, wxID_ANY, _("(Empty or 0 for default iterations)"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -3381,7 +3381,7 @@ VolumePimWizardPageBase::VolumePimWizardPageBase( wxWindow* parent, wxWindowID i PimSizer->Add( VolumePimStaticText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); VolumePimTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD ); - VolumePimTextCtrl->SetMaxLength( 10 ); + VolumePimTextCtrl->SetMaxLength( 7 ); PimSizer->Add( VolumePimTextCtrl, 0, wxALL, 5 ); VolumePimHelpStaticText = new wxStaticText( this, wxID_ANY, _("(Empty or 0 for default iterations)"), wxDefaultPosition, wxDefaultSize, 0 ); diff --git a/src/Main/Forms/MountOptionsDialog.cpp b/src/Main/Forms/MountOptionsDialog.cpp index 207d2479..55098b0e 100644 --- a/src/Main/Forms/MountOptionsDialog.cpp +++ b/src/Main/Forms/MountOptionsDialog.cpp @@ -94,13 +94,13 @@ namespace VeraCrypt ProtectionPasswordPanel->GetVolumePim() : 0; /* invalid PIM: set focus to PIM field and stop processing */ - if (-1 == Pim) + if (-1 == Pim || (PartitionInSystemEncryptionScopeCheckBox->IsChecked() && Pim > MAX_BOOT_PIM_VALUE)) { PasswordPanel->SetFocusToPimTextCtrl(); return; } - if (-1 == ProtectionPim) + if (-1 == ProtectionPim || (PartitionInSystemEncryptionScopeCheckBox->IsChecked() && ProtectionPim > MAX_BOOT_PIM_VALUE)) { ProtectionPasswordPanel->SetFocusToPimTextCtrl(); return; diff --git a/src/Main/Forms/TrueCrypt.fbp b/src/Main/Forms/TrueCrypt.fbp index d9b1b1f1..b71d80d1 100644 --- a/src/Main/Forms/TrueCrypt.fbp +++ b/src/Main/Forms/TrueCrypt.fbp @@ -26270,7 +26270,7 @@ 0 - 10 + 7 0 @@ -27710,7 +27710,7 @@ 0 - 10 + 7 0 diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp index 16fafa3a..27d66bd8 100644 --- a/src/Main/Forms/VolumePasswordPanel.cpp +++ b/src/Main/Forms/VolumePasswordPanel.cpp @@ -63,6 +63,7 @@ namespace VeraCrypt EnablePimEntry = enablePassword && (!enableConfirmation || (enablePkcs5Prf && !isMountPassword)); PimCheckBox->Show (EnablePimEntry); VolumePimStaticText->Show (false); + VolumePimTextCtrl->SetMaxLength (MAX_PIM_DIGITS); VolumePimTextCtrl->Show (false); VolumePimHelpStaticText->Show (false); @@ -198,7 +199,7 @@ namespace VeraCrypt int colspan = isPim? 1 : 2; wxTextCtrl *newTextCtrl = new wxTextCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, display ? 0 : wxTE_PASSWORD); - newTextCtrl->SetMaxLength (isPim? 10 : VolumePassword::MaxSize); + newTextCtrl->SetMaxLength (isPim? MAX_PIM_DIGITS : VolumePassword::MaxSize); newTextCtrl->SetValue ((*textCtrl)->GetValue()); newTextCtrl->SetMinSize ((*textCtrl)->GetSize()); @@ -279,7 +280,8 @@ namespace VeraCrypt if (pimStr.IsEmpty()) return 0; if (((size_t) wxNOT_FOUND == pimStr.find_first_not_of (wxT("0123456789"))) - && pimStr.ToLong (&pim)) + && pimStr.ToLong (&pim) + && pim <= MAX_PIM_VALUE) return (int) pim; else return -1; diff --git a/src/Main/Forms/VolumePimWizardPage.cpp b/src/Main/Forms/VolumePimWizardPage.cpp index 0e3d4299..2d61a719 100644 --- a/src/Main/Forms/VolumePimWizardPage.cpp +++ b/src/Main/Forms/VolumePimWizardPage.cpp @@ -103,7 +103,7 @@ namespace VeraCrypt bool display = event.IsChecked (); wxTextCtrl *newTextCtrl = new wxTextCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, display ? 0 : wxTE_PASSWORD); - newTextCtrl->SetMaxLength (10); + newTextCtrl->SetMaxLength (MAX_PIM_DIGITS); newTextCtrl->SetValue (VolumePimTextCtrl->GetValue()); newTextCtrl->SetMinSize (VolumePimTextCtrl->GetSize()); diff --git a/src/Main/Main.h b/src/Main/Main.h index a35bf780..e9d7e838 100644 --- a/src/Main/Main.h +++ b/src/Main/Main.h @@ -18,4 +18,9 @@ #include "Core/Core.h" #include "Main/StringFormatter.h" +#define MAX_PIM_DIGITS 7 // Maximum allowed digits in a PIM (enough for maximum value) +#define MAX_PIM_VALUE 2147468 // Maximum value to have a positive 32-bit result for formula 15000 + (PIM x 1000) +#define MAX_BOOT_PIM_DIGITS 5 // Maximum allowed digits in a PIM for boot (enough for 16-bit value) +#define MAX_BOOT_PIM_VALUE 65535 + #endif // TC_HEADER_Main_Main diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp index 632552b7..bddfc0b2 100644 --- a/src/Main/TextUserInterface.cpp +++ b/src/Main/TextUserInterface.cpp @@ -182,6 +182,12 @@ namespace VeraCrypt try { pim = (int) StringConverter::ToUInt32 (pimStr); + if (pim > MAX_PIM_VALUE) + { + pim = -1; + ShowError ("PIM_TOO_BIG"); + continue; + } } catch (...) { diff --git a/src/Mount/Favorites.cpp b/src/Mount/Favorites.cpp index 45883bc9..af5f9b0d 100644 --- a/src/Mount/Favorites.cpp +++ b/src/Mount/Favorites.cpp @@ -383,6 +383,20 @@ namespace VeraCrypt case IDC_SHOW_PIM: HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PIM, IDC_PIM, 0); return 1; + + case IDC_PIM: + if (hw == EN_CHANGE) + { + int pim = GetPim (hwndDlg, IDC_PIM); + if (pim > (SystemFavoritesMode? MAX_BOOT_PIM_VALUE: MAX_PIM_VALUE)) + { + SetDlgItemText (hwndDlg, IDC_PIM, L""); + SetFocus (GetDlgItem(hwndDlg, IDC_PIM)); + Warning (SystemFavoritesMode? "PIM_SYSENC_TOO_BIG": "PIM_TOO_BIG", hwndDlg); + return 1; + } + } + break; } return 0; @@ -601,7 +615,7 @@ namespace VeraCrypt XmlGetAttributeText (xml, "pin", label, sizeof (label)); } favorite.Pim = strtol (label, NULL, 10); - if (favorite.Pim < 0) + if (favorite.Pim < 0 || favorite.Pim > (systemFavorite? MAX_BOOT_PIM_VALUE : MAX_PIM_VALUE)) favorite.Pim = 0; char boolVal[2]; diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index 1851af06..7dabc5ff 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -2506,6 +2506,13 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return 1; } + if (!bSysEncPwdChangeDlgMode && (pim > MAX_PIM_VALUE)) + { + SetFocus (GetDlgItem(hwndDlg, IDC_PIM)); + Error ("PIM_TOO_BIG", hwndDlg); + return 1; + } + if (pwdChangeDlgMode == PCDM_CHANGE_PKCS5_PRF) { newKeyFilesParam.EnableKeyFiles = KeyFilesEnable; @@ -8712,7 +8719,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) { wchar_t* endPtr = NULL; CmdVolumePim = (int) wcstol(szTmp, &endPtr, 0); - if (CmdVolumePim < 0 || endPtr == szTmp || *endPtr != L'\0') + if (CmdVolumePim < 0 || CmdVolumePim > MAX_PIM_VALUE || endPtr == szTmp || *endPtr != L'\0') { CmdVolumePim = 0; AbortProcess ("COMMAND_LINE_ERROR");