diff options
author | kavsrf <kavsrf@gmail.com> | 2017-03-19 17:05:02 +0300 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2017-06-18 15:41:14 +0200 |
commit | 51088d231d73cbe14516d553e97237e7f5a4f147 (patch) | |
tree | d27fde3652d9a852d43a3859f5314bd4ae7f13d1 /Library/DcsCfgLib | |
parent | bd99a40d81e34e048dc8e6daefc7ff3d9f3aef56 (diff) | |
download | VeraCrypt-DCS-51088d231d73cbe14516d553e97237e7f5a4f147.tar.gz VeraCrypt-DCS-51088d231d73cbe14516d553e97237e7f5a4f147.zip |
os hide prepare option
Diffstat (limited to 'Library/DcsCfgLib')
-rw-r--r-- | Library/DcsCfgLib/GptEdit.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/Library/DcsCfgLib/GptEdit.c b/Library/DcsCfgLib/GptEdit.c index 28d2160..bae8f1e 100644 --- a/Library/DcsCfgLib/GptEdit.c +++ b/Library/DcsCfgLib/GptEdit.c @@ -33,7 +33,7 @@ UINT64 gDcsDiskEntryPwdCacheID = DCS_DEP_PWD_CACHE_SIGN; DCS_DISK_ENTRY_LIST *DeList = NULL;
-UINT8 *CryptoHeader = NULL;
+UINT8 *DeCryptoHeader = NULL;
EFI_PARTITION_TABLE_HEADER *GptMainHdr = NULL;
EFI_PARTITION_ENTRY *GptMainEntrys = NULL;
@@ -131,15 +131,15 @@ GptLoadFromDisk( goto error;
}
- CryptoHeader = MEM_ALLOC(512);
- if (CryptoHeader == NULL) {
+ DeCryptoHeader = MEM_ALLOC(512);
+ if (DeCryptoHeader == NULL) {
ERR_PRINT(L"Can't alloc CryptoHeader\n");
res = EFI_BUFFER_TOO_SMALL;
goto error;
}
// Load disk IDs
- res = BlockIo->ReadBlocks(BlockIo, BlockIo->Media->MediaId, 0, 512, CryptoHeader);
+ res = BlockIo->ReadBlocks(BlockIo, BlockIo->Media->MediaId, 0, 512, DeCryptoHeader);
if (EFI_ERROR(res)) {
ERR_PRINT(L"Can't MBR \n");
goto error;
@@ -147,11 +147,11 @@ GptLoadFromDisk( SetMem(&DeDiskId, sizeof(DeDiskId), 0);
DeDiskId.Type = DE_DISKID;
- CopyMem(&DeDiskId.MbrID, &CryptoHeader[0x1b8], sizeof(DiskIdMbr));
+ CopyMem(&DeDiskId.MbrID, &DeCryptoHeader[0x1b8], sizeof(DiskIdMbr));
CopyMem(&DeDiskId.GptID, &GptMainHdr->DiskGUID, sizeof(DiskIdGpt));
// Load crypto header
- res = BlockIo->ReadBlocks(BlockIo, BlockIo->Media->MediaId, 62, 512, CryptoHeader);
+ res = BlockIo->ReadBlocks(BlockIo, BlockIo->Media->MediaId, 62, 512, DeCryptoHeader);
if (EFI_ERROR(res)) {
ERR_PRINT(L"Can't read CryptoHeader\n");
goto error;
@@ -176,7 +176,7 @@ error: MEM_FREE(GptMainEntrys);
MEM_FREE(GptAltHdr);
MEM_FREE(GptAltEntrys);
- MEM_FREE(CryptoHeader);
+ MEM_FREE(DeCryptoHeader);
return res;
}
@@ -233,7 +233,7 @@ DeListSaveToFile() { DeList->Count = DE_IDX_TOTAL;
Offset = 0;
- DeList_UPDATE_BEGIN(CryptoHeader, DE_Sectors, DE_IDX_CRYPTOHEADER, 512)
+ DeList_UPDATE_BEGIN(DeCryptoHeader, DE_Sectors, DE_IDX_CRYPTOHEADER, 512)
DeList->DE[DE_IDX_CRYPTOHEADER].Sectors.Start = 62 * 512;
DeList_UPDATE_END
@@ -339,7 +339,7 @@ DeListParseSaved( )
{
EFI_STATUS res = EFI_SUCCESS;
- CryptoHeader = DeBuffer;
+ DeCryptoHeader = DeBuffer;
DeList = (DCS_DISK_ENTRY_LIST*)(DeBuffer + 512);
CopyMem(&DeDiskId, &DeList->DE[DE_IDX_DISKID], sizeof(DeDiskId));
@@ -483,7 +483,7 @@ DeListApplySectorsToDisk( res = BlockIo->WriteBlocks(BlockIo, BlockIo->Media->MediaId,
DeList->DE[i].Sectors.Start >> 9,
(UINTN)DeList->DE[i].Sectors.Length,
- CryptoHeader + DeList->DE[i].Sectors.Offset);
+ DeCryptoHeader + DeList->DE[i].Sectors.Offset);
}
if (EFI_ERROR(res)) {
ERR_PRINT(L"Write: %r\n", res);
@@ -599,6 +599,9 @@ GptHideParts() { GptSqueze();
GptSort();
GptSyncMainAlt();
+ if (DeCryptoHeader != NULL) {
+ SetMem(DeCryptoHeader, 512, 0);
+ }
}
BOOLEAN
|