From 10ddedbbac7acb326fb9447c6a1c5f1706017e4b Mon Sep 17 00:00:00 2001 From: kavsrf Date: Sun, 26 Feb 2017 11:42:59 +0300 Subject: PasswordTimeout and infodelay keys in DcsProp DcsProp documented included in VeraCrypt Beta2 patch 1 --- Library/PasswordLib/ConsolePassword.c | 14 ++++++++++++++ Library/PasswordLib/PicturePassword.c | 21 +++++++++++++++++++++ 2 files changed, 35 insertions(+) (limited to 'Library/PasswordLib') diff --git a/Library/PasswordLib/ConsolePassword.c b/Library/PasswordLib/ConsolePassword.c index 797ee4a..6894b50 100644 --- a/Library/PasswordLib/ConsolePassword.c +++ b/Library/PasswordLib/ConsolePassword.c @@ -31,6 +31,20 @@ AskConsolePwdInt( UINTN i; gST->ConOut->EnableCursor(gST->ConOut, TRUE); + if (gPasswordTimeout) { + EFI_EVENT InputEvents[2]; + UINTN EventIndex = 0; + InputEvents[0] = gST->ConIn->WaitForKey; + gBS->CreateEvent(EVT_TIMER, 0, (EFI_EVENT_NOTIFY)NULL, NULL, &InputEvents[1]); + gBS->SetTimer(InputEvents[1], TimerPeriodic, 10000000 * gPasswordTimeout); + gBS->WaitForEvent(2, InputEvents, &EventIndex); + gPasswordTimeout = 0; + gBS->CloseEvent(InputEvents[1]); + if (EventIndex == 1) { + *retCode = AskPwdRetCancel; + return ; + } + } do { key = GetKey(); diff --git a/Library/PasswordLib/PicturePassword.c b/Library/PasswordLib/PicturePassword.c index c3831ad..4e46f47 100644 --- a/Library/PasswordLib/PicturePassword.c +++ b/Library/PasswordLib/PicturePassword.c @@ -31,9 +31,11 @@ UINTN gPasswordPictureCharsLen = 95; UINT8 gPasswordVisible = 0; int gPasswordShowMark = 1; UINT8 gPasswordProgress = 1; +int gPasswordTimeout = 0; int gPlatformLocked = 0; int gTPMLocked = 0; +int gTPMLockedInfoDelay = 9; int gSCLocked = 0; @@ -282,6 +284,25 @@ AskPictPwdInt( UINTN pwdAction = PwdActNone; CHAR8 pwdNewChar = 0; + if (gPasswordTimeout) { + UINTN EventIndex = 0; + InputEvents[0] = gST->ConIn->WaitForKey; + eventsCount = 2; + if (gTouchPointer != NULL) { + eventsCount = 3; + InputEvents[2] = gTouchPointer->WaitForInput; + } + gBS->CreateEvent(EVT_TIMER, 0, (EFI_EVENT_NOTIFY)NULL, NULL, &InputEvents[1]); + gBS->SetTimer(InputEvents[1], TimerPeriodic, 10000000 * gPasswordTimeout); + gBS->WaitForEvent(eventsCount, InputEvents, &EventIndex); + gPasswordTimeout = 0; + gBS->CloseEvent(InputEvents[1]); + if (EventIndex == 1) { + *retCode = AskPwdRetCancel; + return; + } + } + InitConsoleControl(); if (gBeepEnabled) { InitSpeaker(); -- cgit v1.2.3