From d37d6d681061fdefc2a909b5975b40b604a27c62 Mon Sep 17 00:00:00 2001 From: kavsrf Date: Wed, 4 Jan 2017 01:19:02 +0300 Subject: debug code cleanup --- DcsInt/DcsInt.c | 11 ++++--- DcsRe/DcsRe.c | 21 ++++++------- Library/VeraCryptLib/llmath.c | 73 ------------------------------------------- 3 files changed, 17 insertions(+), 88 deletions(-) diff --git a/DcsInt/DcsInt.c b/DcsInt/DcsInt.c index 672997f..aaeaafc 100644 --- a/DcsInt/DcsInt.c +++ b/DcsInt/DcsInt.c @@ -628,7 +628,7 @@ SecRegionTryDecrypt() { int vcres = 1; EFI_STATUS res = EFI_SUCCESS; - + int retry = gAuthRetry; PlatformGetID(SecRegionHandle, &gPlatformKeyFile, &gPlatformKeyFileSize); do { @@ -650,8 +650,8 @@ SecRegionTryDecrypt() } else { ERR_PRINT(L"%a", gAuthErrorMsg); } - gAuthRetry--; - } while (vcres != 0 && gAuthRetry > 0); + retry--; + } while (vcres != 0 && retry > 0); if (vcres != 0) { return EFI_CRC_ERROR; } @@ -935,6 +935,10 @@ VirtualNotifyEvent( if (SecRegionData != NULL) { MEM_BURN(SecRegionData, SecRegionSize); } + + if (gAutoPassword != NULL) { + MEM_BURN(gAutoPassword, MAX_PASSWORD); + } } ////////////////////////////////////////////////////////////////////////// @@ -987,7 +991,6 @@ UefiMain( } } if (!devFound) return OnExit(gOnExitNotFound, OnExitAuthNotFound, EFI_NOT_FOUND); - KeyWait(L"%2d \r", 12, 0, 0); } // Try to find by OS partition GUID diff --git a/DcsRe/DcsRe.c b/DcsRe/DcsRe.c index 1d86e50..1f71f11 100644 --- a/DcsRe/DcsRe.c +++ b/DcsRe/DcsRe.c @@ -20,6 +20,13 @@ https://opensource.org/licenses/LGPL-3.0 #include #include "common/Tcdefs.h" +#ifdef _M_X64 +#define ARCHdotEFI L"x64.efi" +#else +#define ARCHdotEFI L"IA32.efi" +#endif + + ////////////////////////////////////////////////////////////////////////// // Menu ////////////////////////////////////////////////////////////////////////// @@ -52,11 +59,7 @@ SelectEfiVolume() for (i = 0; i < gFSCount; ++i) { res = FileOpenRoot(gFSHandles[i], &file); if(EFI_ERROR(res)) continue; -#ifdef _M_X64 - if (!EFI_ERROR(FileExist(file, L"EFI\\Boot\\bootx64.efi"))) { -#else - if (!EFI_ERROR(FileExist(file, L"EFI\\Boot\\bootia32.efi"))) { -#endif + if (!EFI_ERROR(FileExist(file, L"EFI\\Boot\\boot" ARCHdotEFI))) { efiVolumesCount++; efiVolumes[i] = file; if (gFSHandles[i] != startHandle) { @@ -95,11 +98,7 @@ SelectEfiVolume() ////////////////////////////////////////////////////////////////////////// EFI_STATUS ActionBootWinPE(IN VOID* ctx) { -#ifdef _M_X64 - return EfiExec(NULL, L"EFI\\Boot\\WinPE_bootx64.efi"); -#else - return EfiExec(NULL, L"EFI\\Boot\\WinPE_bootia32.efi"); -#endif + return EfiExec(NULL, L"EFI\\Boot\\WinPE_boot" ARCHdotEFI); } EFI_STATUS @@ -256,7 +255,7 @@ DcsReMain( item = DcsMenuAppend(item, L"Boot VeraCrypt loader from rescue disk", 'v', ActionDcsBoot, NULL); } - if (!EFI_ERROR(FileExist(NULL, L"EFI\\Boot\\WinPE_bootx64.efi"))) { + if (!EFI_ERROR(FileExist(NULL, L"EFI\\Boot\\WinPE_boot" ARCHdotEFI))) { item = DcsMenuAppend(item, L"Boot Windows PE from rescue disk", 'w', ActionBootWinPE, NULL); } diff --git a/Library/VeraCryptLib/llmath.c b/Library/VeraCryptLib/llmath.c index 7d79657..ad13758 100644 --- a/Library/VeraCryptLib/llmath.c +++ b/Library/VeraCryptLib/llmath.c @@ -224,79 +224,6 @@ __declspec(naked) void __cdecl _aulldiv() } } -////////////////////////////////////////////////////////////////////////// -// Shifts -////////////////////////////////////////////////////////////////////////// -__declspec(naked) void __cdecl _aullshr1() { - _asm { - ; - ; Checking: Only handle 64bit shifting or more - ; - cmp cl, 64 - jae _Exit - - ; - ; Handle shifting between 0 and 31 bits - ; - cmp cl, 32 - jae More32 - shrd eax, edx, cl - shr edx, cl - ret - - ; - ; Handle shifting of 32-63 bits - ; -More32: - mov eax, edx - xor edx, edx - and cl, 31 - shr eax, cl - ret - - ; - ; Invalid number (less then 32bits), return 0 - ; -_Exit: - xor eax, eax - xor edx, edx - ret - } -} - -__declspec(naked) void __cdecl _allshl1() { - _asm { - ; - ; Handle shifting of 64 or more bits (return 0) - ; - cmp cl, 64 - jae short ReturnZero - - ; - ; Handle shifting of between 0 and 31 bits - ; - cmp cl, 32 - jae short More32 - shld edx, eax, cl - shl eax, cl - ret - - ; - ; Handle shifting of between 32 and 63 bits - ; -More32: - mov edx, eax - xor eax, eax - and cl, 31 - shl edx, cl - ret - -ReturnZero: - xor eax,eax - xor edx,edx - ret - } -} UINT64 EFIAPI -- cgit v1.2.3