VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/DcsCfg/DcsCfgMain.c
diff options
context:
space:
mode:
authorkavsrf <kavsrf@gmail.com>2017-03-19 17:05:02 +0300
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2017-06-18 15:41:14 +0200
commit51088d231d73cbe14516d553e97237e7f5a4f147 (patch)
treed27fde3652d9a852d43a3859f5314bd4ae7f13d1 /DcsCfg/DcsCfgMain.c
parentbd99a40d81e34e048dc8e6daefc7ff3d9f3aef56 (diff)
downloadVeraCrypt-DCS-51088d231d73cbe14516d553e97237e7f5a4f147.tar.gz
VeraCrypt-DCS-51088d231d73cbe14516d553e97237e7f5a4f147.zip
os hide prepare option
Diffstat (limited to 'DcsCfg/DcsCfgMain.c')
-rw-r--r--DcsCfg/DcsCfgMain.c95
1 files changed, 55 insertions, 40 deletions
diff --git a/DcsCfg/DcsCfgMain.c b/DcsCfg/DcsCfgMain.c
index daf0fb0..c289bf8 100644
--- a/DcsCfg/DcsCfgMain.c
+++ b/DcsCfg/DcsCfgMain.c
@@ -39,15 +39,6 @@ https://opensource.org/licenses/LGPL-3.0
#define OPT_DISK_START L"-ds"
#define OPT_DISK_END L"-de"
#define OPT_DISK_BOOT L"-db"
-#define OPT_AUTH_ASK L"-aa"
-#define OPT_AUTH_CREATE_HEADER L"-ach"
-#define OPT_RND L"-rnd"
-#define OPT_RND_GEN L"-rndgen"
-#define OPT_RND_LOAD L"-rndload"
-#define OPT_RND_SAVE L"-rndsave"
-#define OPT_VOLUME_ENCRYPT L"-vec"
-#define OPT_VOLUME_DECRYPT L"-vdc"
-#define OPT_VOLUME_CHANGEPWD L"-vcp"
#define OPT_USB_LIST L"-ul"
#define OPT_TOUCH_LIST L"-tl"
#define OPT_TOUCH_TEST L"-tt"
@@ -57,6 +48,18 @@ https://opensource.org/licenses/LGPL-3.0
#define OPT_BEEP_LIST L"-bl"
#define OPT_BEEP_TEST L"-bt"
#define OPT_SETUP L"-setup"
+
+#define OPT_AUTH_ASK L"-aa"
+#define OPT_AUTH_CREATE_HEADER L"-ach"
+#define OPT_VOLUME_ENCRYPT L"-vec"
+#define OPT_VOLUME_DECRYPT L"-vdc"
+#define OPT_VOLUME_CHANGEPWD L"-vcp"
+
+#define OPT_RND L"-rnd"
+#define OPT_RND_GEN L"-rndgen"
+#define OPT_RND_LOAD L"-rndload"
+#define OPT_RND_SAVE L"-rndsave"
+
#define OPT_PARTITION_LIST L"-pl"
#define OPT_PARTITION_FILE L"-pf"
#define OPT_PARTITION_SAVE L"-ps"
@@ -72,13 +75,16 @@ https://opensource.org/licenses/LGPL-3.0
#define OPT_PARTITION_RND_SAVE L"-prndsave"
#define OPT_PARTITION_EDIT_PWD_CACHE L"-pwdcache"
#define OPT_KEYFILE_PLATFORM L"-kp"
+
#define OPT_SECREGION_MARK L"-srm"
#define OPT_SECREGION_WIPE L"-srw"
#define OPT_SECREGION_ADD L"-sra"
#define OPT_SECREGION_DUMP L"-srdump"
#define OPT_WIPE L"-wipe"
+
#define OPT_OS_DECRYPT L"-osdecrypt"
#define OPT_OS_RESTORE_KEY L"-osrestorekey"
+
#define OPT_TPM_PCRS L"-tpmpcrs"
#define OPT_TPM_NVLIST L"-tpmnvlist"
#define OPT_TPM_CFG L"-tpmcfg"
@@ -91,6 +97,9 @@ https://opensource.org/licenses/LGPL-3.0
#define OPT_TBL_APPEND L"-tba"
#define OPT_TBL_DUMP L"-tbdump"
+#define OPT_OS_HIDE_PREP L"-oshideprep"
+
+
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
{ OPT_TBL_DUMP, TypeValue },
{ OPT_TBL_FILE, TypeValue },
@@ -144,6 +153,7 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
{ OPT_WIPE, TypeDoubleValue },
{ OPT_OS_DECRYPT, TypeFlag },
{ OPT_OS_RESTORE_KEY, TypeFlag },
+ { OPT_OS_HIDE_PREP, TypeFlag },
{ OPT_TPM_PCRS, TypeDoubleValue },
{ OPT_TPM_NVLIST, TypeFlag },
{ OPT_TPM_CFG, TypeFlag },
@@ -229,6 +239,41 @@ DcsCfgMain(
ParamCount = ShellCommandLineGetCount(Package);
+ // Create random
+ if (ShellCommandLineGetFlag(Package, OPT_RND)) {
+ CONST CHAR16* opt = NULL;
+ CHAR16* context = NULL;
+ UINTN rndType;
+ UINTN contextSize = 0;
+ opt = ShellCommandLineGetValue(Package, OPT_RND);
+ rndType = StrDecimalToUintn(opt);
+ context = (CHAR16*)StrStr(opt, L" ");
+ if (context != NULL) {
+ context++;
+ contextSize = StrLen(context) * 2;
+ if (!EFI_ERROR(FileExist(NULL, context))) {
+ FileLoad(NULL, context, &context, &contextSize);
+ }
+ }
+ res = RndInit(rndType, context, contextSize, &gRnd);
+ if (EFI_ERROR(res)) {
+ ERR_PRINT(L"Random: %r\n", res);
+ }
+ }
+
+ // Rescue
+ if (ShellCommandLineGetFlag(Package, OPT_OS_DECRYPT)) {
+ return OSDecrypt();
+ }
+
+ if (ShellCommandLineGetFlag(Package, OPT_OS_RESTORE_KEY)) {
+ return OSRestoreKey();
+ }
+
+ if (ShellCommandLineGetFlag(Package, OPT_OS_HIDE_PREP)) {
+ return OuterInit();
+ }
+
// Common parameters
if (ShellCommandLineGetFlag(Package, OPT_DISK_START)) {
CONST CHAR16* opt = NULL;
@@ -285,15 +330,6 @@ DcsCfgMain(
TestAuthAsk();
}
- // Rescue
- if (ShellCommandLineGetFlag(Package, OPT_OS_DECRYPT)) {
- return OSDecrypt();
- }
-
- if (ShellCommandLineGetFlag(Package, OPT_OS_RESTORE_KEY)) {
- return OSRestoreKey();
- }
-
// Beep
if (ShellCommandLineGetFlag(Package, OPT_BEEP_LIST)) {
PrintSpeakerList();
@@ -373,28 +409,7 @@ DcsCfgMain(
PrintUsbList();
}
- // Create random
- if (ShellCommandLineGetFlag(Package, OPT_RND)) {
- CONST CHAR16* opt = NULL;
- CHAR16* context = NULL;
- UINTN rndType;
- UINTN contextSize = 0;
- opt = ShellCommandLineGetValue(Package, OPT_RND);
- rndType = StrDecimalToUintn(opt);
- context = (CHAR16*)StrStr(opt, L" ");
- if (context != NULL) {
- context++;
- contextSize = StrLen(context) * 2;
- if (!EFI_ERROR(FileExist(NULL, context))) {
- FileLoad(NULL, context, &context, &contextSize);
- }
- }
- res = RndInit(rndType, context, contextSize, &gRnd);
- if (EFI_ERROR(res)) {
- ERR_PRINT(L"Random: %r\n", res);
- }
- }
-
+ // Randoms
if (ShellCommandLineGetFlag(Package, OPT_RND_LOAD)) {
CONST CHAR16* opt = NULL;
UINT8 temp[4];