mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-14 07:03:35 +01:00
Linux/MacOSX: Use also PIM when comparing Outer and Hidden volumes credentials
This commit is contained in:
parent
b4465b80e6
commit
05b3cd5cc1
@ -92,6 +92,8 @@ namespace VeraCrypt
|
|||||||
|
|
||||||
VolumeCreationWizard::~VolumeCreationWizard ()
|
VolumeCreationWizard::~VolumeCreationWizard ()
|
||||||
{
|
{
|
||||||
|
burn (&Pim, sizeof (Pim));
|
||||||
|
burn (&OuterPim, sizeof (OuterPim));
|
||||||
}
|
}
|
||||||
|
|
||||||
WizardPage *VolumeCreationWizard::GetPage (WizardStep step)
|
WizardPage *VolumeCreationWizard::GetPage (WizardStep step)
|
||||||
@ -774,6 +776,24 @@ namespace VeraCrypt
|
|||||||
Kdf = page->GetPkcs5Kdf();
|
Kdf = page->GetPkcs5Kdf();
|
||||||
Keyfiles = page->GetKeyfiles();
|
Keyfiles = page->GetKeyfiles();
|
||||||
|
|
||||||
|
if (forward && Password && !Password->IsEmpty())
|
||||||
|
{
|
||||||
|
if (Password->Size() < VolumePassword::WarningSizeThreshold)
|
||||||
|
{
|
||||||
|
if (!Gui->AskYesNo (LangString["PASSWORD_LENGTH_WARNING"], false, true))
|
||||||
|
{
|
||||||
|
return GetCurrentStep();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (page->IsPimSelected ())
|
||||||
|
return Step::VolumePim;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Clear PIM
|
||||||
|
Pim = 0;
|
||||||
|
|
||||||
if (forward && !OuterVolume && SelectedVolumeType == VolumeType::Hidden)
|
if (forward && !OuterVolume && SelectedVolumeType == VolumeType::Hidden)
|
||||||
{
|
{
|
||||||
shared_ptr <VolumePassword> hiddenPassword;
|
shared_ptr <VolumePassword> hiddenPassword;
|
||||||
@ -792,29 +812,15 @@ namespace VeraCrypt
|
|||||||
((!hiddenPassword || hiddenPassword->IsEmpty()) && (!OuterPassword || OuterPassword->IsEmpty()))
|
((!hiddenPassword || hiddenPassword->IsEmpty()) && (!OuterPassword || OuterPassword->IsEmpty()))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Gui->ShowError (_("The Hidden volume password can not be identical to the Outer volume password"));
|
//check if they have also the same PIM
|
||||||
return GetCurrentStep();
|
if (OuterPim == Pim)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (forward && Password && !Password->IsEmpty())
|
|
||||||
{
|
|
||||||
if (Password->Size() < VolumePassword::WarningSizeThreshold)
|
|
||||||
{
|
|
||||||
if (!Gui->AskYesNo (LangString["PASSWORD_LENGTH_WARNING"], false, true))
|
|
||||||
{
|
{
|
||||||
|
Gui->ShowError (_("The Hidden volume can't have the same password, PIM and keyfiles as the Outer volume"));
|
||||||
return GetCurrentStep();
|
return GetCurrentStep();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (page->IsPimSelected ())
|
|
||||||
return Step::VolumePim;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Clear PIM
|
|
||||||
Pim = 0;
|
|
||||||
|
|
||||||
// Skip PIM
|
// Skip PIM
|
||||||
if (forward && OuterVolume)
|
if (forward && OuterVolume)
|
||||||
{
|
{
|
||||||
@ -841,8 +847,6 @@ namespace VeraCrypt
|
|||||||
VolumePimWizardPage *page = dynamic_cast <VolumePimWizardPage *> (GetCurrentPage());
|
VolumePimWizardPage *page = dynamic_cast <VolumePimWizardPage *> (GetCurrentPage());
|
||||||
Pim = page->GetVolumePim();
|
Pim = page->GetVolumePim();
|
||||||
|
|
||||||
if (forward && Password && !Password->IsEmpty())
|
|
||||||
{
|
|
||||||
if (-1 == Pim)
|
if (-1 == Pim)
|
||||||
{
|
{
|
||||||
// PIM invalid: don't go anywhere
|
// PIM invalid: don't go anywhere
|
||||||
@ -850,6 +854,35 @@ namespace VeraCrypt
|
|||||||
return GetCurrentStep();
|
return GetCurrentStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (forward && !OuterVolume && SelectedVolumeType == VolumeType::Hidden)
|
||||||
|
{
|
||||||
|
shared_ptr <VolumePassword> hiddenPassword;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
hiddenPassword = Keyfile::ApplyListToPassword (Keyfiles, Password);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
hiddenPassword = Password;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if Outer and Hidden passwords are the same
|
||||||
|
if ( (hiddenPassword && !hiddenPassword->IsEmpty() && OuterPassword && !OuterPassword->IsEmpty() && (*(OuterPassword.get()) == *(hiddenPassword.get())))
|
||||||
|
||
|
||||||
|
((!hiddenPassword || hiddenPassword->IsEmpty()) && (!OuterPassword || OuterPassword->IsEmpty()))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//check if they have also the same PIM
|
||||||
|
if (OuterPim == Pim)
|
||||||
|
{
|
||||||
|
Gui->ShowError (_("The Hidden volume can't have the same password, PIM and keyfiles as the Outer volume"));
|
||||||
|
return GetCurrentStep();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (forward && Password && !Password->IsEmpty())
|
||||||
|
{
|
||||||
if (Password->Size() < VolumePassword::WarningSizeThreshold)
|
if (Password->Size() < VolumePassword::WarningSizeThreshold)
|
||||||
{
|
{
|
||||||
if (Pim > 0 && Pim < 485)
|
if (Pim > 0 && Pim < 485)
|
||||||
@ -1112,6 +1145,8 @@ namespace VeraCrypt
|
|||||||
{
|
{
|
||||||
OuterPassword = Password;
|
OuterPassword = Password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OuterPim = Pim;
|
||||||
}
|
}
|
||||||
catch (exception &e)
|
catch (exception &e)
|
||||||
{
|
{
|
||||||
|
@ -84,6 +84,7 @@ namespace VeraCrypt
|
|||||||
shared_ptr <VolumePassword> Password;
|
shared_ptr <VolumePassword> Password;
|
||||||
shared_ptr <VolumePassword> OuterPassword;
|
shared_ptr <VolumePassword> OuterPassword;
|
||||||
int Pim;
|
int Pim;
|
||||||
|
int OuterPim;
|
||||||
shared_ptr <Pkcs5Kdf> Kdf;
|
shared_ptr <Pkcs5Kdf> Kdf;
|
||||||
uint32 SectorSize;
|
uint32 SectorSize;
|
||||||
shared_ptr <Hash> SelectedHash;
|
shared_ptr <Hash> SelectedHash;
|
||||||
|
Loading…
Reference in New Issue
Block a user