From 4922daee362adf600fd19f91aa11cc603d8d17e1 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Thu, 21 Mar 2019 20:57:16 +0100 Subject: Implement better timeout mechanism for password input. Implement new actions "shutdown" and "reboot". Set default timeout value to 3 minutes and default timeout action to "shutdown" --- Library/VeraCryptLib/DcsVeraCrypt.c | 11 +++++++---- Library/VeraCryptLib/DcsVeraCrypt.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'Library/VeraCryptLib') diff --git a/Library/VeraCryptLib/DcsVeraCrypt.c b/Library/VeraCryptLib/DcsVeraCrypt.c index 1249718..10bb7d7 100644 --- a/Library/VeraCryptLib/DcsVeraCrypt.c +++ b/Library/VeraCryptLib/DcsVeraCrypt.c @@ -81,6 +81,7 @@ UINT8 gForcePasswordProgress = 1; CHAR8* gOnExitFailed = NULL; CHAR8* gOnExitSuccess = NULL; CHAR8* gOnExitNotFound = NULL; +CHAR8* gOnExitTimeout = NULL; ////////////////////////////////////////////////////////////////////////// // Authorize @@ -147,7 +148,7 @@ VCAuthLoadConfig() gPasswordProgress = (UINT8)ConfigReadInt("AuthorizeProgress", 1); // print "*" gPasswordVisible = (UINT8)ConfigReadInt("AuthorizeVisible", 0); // show chars gPasswordShowMark = ConfigReadInt("AuthorizeMarkTouch", 1); // show touch points - gPasswordTimeout = (UINT8)ConfigReadInt("PasswordTimeout", 0); // If no password for => + gPasswordTimeout = (UINT8)ConfigReadInt("PasswordTimeout", 180); // If no password for => gDcsBootForce = ConfigReadInt("DcsBootForce", 1); // Ask password even if no USB marked found. @@ -181,6 +182,8 @@ VCAuthLoadConfig() ConfigReadString("ActionNotFound", "Exit", gOnExitNotFound, MAX_MSG); VCCONFIG_ALLOC(gOnExitFailed, MAX_MSG); ConfigReadString("ActionFailed", "Exit", gOnExitFailed, MAX_MSG); + VCCONFIG_ALLOC(gOnExitTimeout, MAX_MSG); + ConfigReadString("ActionTimeout", "Shutdown", gOnExitTimeout, MAX_MSG); strTemp = MEM_ALLOC(MAX_MSG); ConfigReadString("PartitionGuidOS", "", strTemp, MAX_MSG); @@ -321,7 +324,7 @@ VCAskPwd( ERR_PRINT(L"%r\n", res); } } while (gCfgMenuContinue); - if (gAuthPwdCode == AskPwdRetCancel) { + if ((gAuthPwdCode == AskPwdRetCancel) || (gAuthPwdCode == AskPwdRetTimeout)) { return; } } @@ -355,7 +358,7 @@ VCAskPwd( AskConsolePwdInt(&vcPwd->Length, vcPwd->Text, &gAuthPwdCode, sizeof(vcPwd->Text), gPasswordVisible); } - if (gAuthPwdCode == AskPwdRetCancel) { + if ((gAuthPwdCode == AskPwdRetCancel) || (gAuthPwdCode == AskPwdRetTimeout)) { return; } } @@ -396,7 +399,7 @@ VCAuthAsk() { VCAskPwd(AskPwdLogin, &gAuthPassword); - if (gAuthPwdCode == AskPwdRetCancel) { + if ((gAuthPwdCode == AskPwdRetCancel) || (gAuthPwdCode == AskPwdRetTimeout)) { return; } diff --git a/Library/VeraCryptLib/DcsVeraCrypt.h b/Library/VeraCryptLib/DcsVeraCrypt.h index f7a3c8f..152a335 100644 --- a/Library/VeraCryptLib/DcsVeraCrypt.h +++ b/Library/VeraCryptLib/DcsVeraCrypt.h @@ -74,6 +74,7 @@ extern UINT8 gForcePasswordProgress; extern CHAR8* gOnExitFailed; extern CHAR8* gOnExitSuccess; extern CHAR8* gOnExitNotFound; +extern CHAR8* gOnExitTimeout; void VCAuthAsk(); -- cgit v1.2.3