diff options
author | kavsrf <kavsrf@gmail.com> | 2017-02-05 17:31:28 +0300 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2017-06-05 17:36:54 +0200 |
commit | abf3adcd2f37f4e278fc9ef7634ca0c8f5171893 (patch) | |
tree | c7fe7706e8648c7a989bcfd30dbc66a1faa108f3 /DcsCfg | |
parent | d200f27ac3b8a4f58e52a5ee798e11e3fdf74924 (diff) | |
download | VeraCrypt-DCS-abf3adcd2f37f4e278fc9ef7634ca0c8f5171893.tar.gz VeraCrypt-DCS-abf3adcd2f37f4e278fc9ef7634ca0c8f5171893.zip |
picture password bmp and DcsProp can be in secregion on separate flash
Tables overlay configuration commands
Diffstat (limited to 'DcsCfg')
-rw-r--r-- | DcsCfg/DcsCfgCrypt.c | 13 | ||||
-rw-r--r-- | DcsCfg/DcsCfgMain.c | 44 |
2 files changed, 55 insertions, 2 deletions
diff --git a/DcsCfg/DcsCfgCrypt.c b/DcsCfg/DcsCfgCrypt.c index 45523dd..94f8768 100644 --- a/DcsCfg/DcsCfgCrypt.c +++ b/DcsCfg/DcsCfgCrypt.c @@ -1380,6 +1380,8 @@ SecRigionAdd( EFI_BLOCK_IO_PROTOCOL* bio;
UINT8* regionData;
UINTN regionSize;
+ UINT8* padding = NULL;
+ UINTN paddingSize = 0;
INTN deListHdrIdOk;
res = FileLoad(NULL, (CHAR16*)DcsDiskEntrysFileName, ®ionData, ®ionSize);
if (EFI_ERROR(res)) {
@@ -1400,9 +1402,18 @@ SecRigionAdd( res = EFI_ACCESS_DENIED;
goto error;
}
-
+ paddingSize = regionSize & 0x01FF;
+ regionSize -= paddingSize;
res = bio->WriteBlocks(bio, bio->Media->MediaId, 62 + regIdx * (128 * 1024 / 512), regionSize, regionData);
+ if (!EFI_ERROR(res) &&
+ paddingSize != 0) {
+ padding = MEM_ALLOC(512);
+ CopyMem(padding, regionData + regionSize, paddingSize);
+ res = bio->WriteBlocks(bio, bio->Media->MediaId, 62 + regIdx * ((128 * 1024 ) / 512) + regionSize / 512, 512, padding);
+ MEM_FREE(padding);
+ }
+
if (EFI_ERROR(res)) {
ERR_PRINT(L"Write: %r\n", res);
goto error;
diff --git a/DcsCfg/DcsCfgMain.c b/DcsCfg/DcsCfgMain.c index 6e4c863..ec92b25 100644 --- a/DcsCfg/DcsCfgMain.c +++ b/DcsCfg/DcsCfgMain.c @@ -81,8 +81,22 @@ https://opensource.org/licenses/LGPL-3.0 #define OPT_TPM_PCRS L"-tpmpcrs"
#define OPT_TPM_NVLIST L"-tpmnvlist"
#define OPT_TPM_CFG L"-tpmcfg"
+
+#define OPT_TBL_FILE L"-tbf"
+#define OPT_TBL_ZERO L"-tbz"
+#define OPT_TBL_LIST L"-tbl"
+#define OPT_TBL_NAME L"-tbn"
+#define OPT_TBL_DELETE L"-tbd"
+#define OPT_TBL_APPEND L"-tba"
+
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- { OPT_DISK_LIST, TypeValue },
+ { OPT_TBL_FILE, TypeValue },
+ { OPT_TBL_ZERO, TypeFlag },
+ { OPT_TBL_LIST, TypeFlag },
+ { OPT_TBL_DELETE, TypeFlag },
+ { OPT_TBL_NAME, TypeValue },
+ { OPT_TBL_APPEND, TypeValue },
+ { OPT_DISK_LIST, TypeValue },
{ OPT_DISK_CHECK, TypeFlag },
{ OPT_DISK_START, TypeValue },
{ OPT_DISK_END, TypeValue },
@@ -228,6 +242,34 @@ DcsCfgMain( DcsDiskEntrysFileName = ShellCommandLineGetValue(Package, OPT_PARTITION_FILE);
}
+ if (ShellCommandLineGetFlag(Package, OPT_TBL_FILE)) {
+ DcsTablesFileName = ShellCommandLineGetValue(Package, OPT_TBL_FILE);
+ }
+
+ if (ShellCommandLineGetFlag(Package, OPT_TBL_DELETE) &&
+ ShellCommandLineGetFlag(Package, OPT_TBL_NAME)
+ ) {
+ CONST CHAR16* opt1 = NULL;
+ opt1 = ShellCommandLineGetValue(Package, OPT_TBL_NAME);
+ res = TablesDel(opt1);
+ }
+
+ if (ShellCommandLineGetFlag(Package, OPT_TBL_APPEND) &&
+ ShellCommandLineGetFlag(Package, OPT_TBL_NAME)
+ ) {
+ CONST CHAR16* opt1 = NULL;
+ CONST CHAR16* opt2 = NULL;
+ opt1 = ShellCommandLineGetValue(Package, OPT_TBL_NAME);
+ opt2 = ShellCommandLineGetValue(Package, OPT_TBL_APPEND);
+ res = TablesNew(opt1, opt2);
+ }
+
+ if (ShellCommandLineGetFlag(Package, OPT_TBL_LIST)) {
+ if (gDcsTables == NULL) TablesLoad();
+ OUT_PRINT(L"Size = %d, Zones=%d\n", gDcsTablesSize, (gDcsTablesSize + 128 * 1024 - 1) / (128 * 1024));
+ TablesList(gDcsTablesSize, gDcsTables);
+ }
+
if (ShellCommandLineGetFlag(Package, OPT_AUTH_ASK)) {
TestAuthAsk();
}
|