Changeset 64731 in vbox for trunk/src/VBox/HostDrivers/Support
- Timestamp:
- Nov 21, 2016 2:35:37 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyImage-win.cpp
r62677 r64731 1095 1095 1096 1096 /** 1097 * RTTimeNow equivaltent that handles ring-3 where we cannot use it. 1098 * 1099 * @returns pNow 1100 * @param pNow Where to return the current time. 1101 */ 1102 static PRTTIMESPEC supHardNtTimeNow(PRTTIMESPEC pNow) 1103 { 1104 #ifdef IN_RING3 1105 /* 1106 * Just read system time. 1107 */ 1108 KUSER_SHARED_DATA volatile *pUserSharedData = (KUSER_SHARED_DATA volatile *)MM_SHARED_USER_DATA_VA; 1109 # ifdef RT_ARCH_AMD64 1110 uint64_t uRet = *(uint64_t volatile *)&pUserSharedData->SystemTime; /* This is what KeQuerySystemTime does (missaligned). */ 1111 return RTTimeSpecSetNtTime(pNow, uRet); 1112 # else 1113 1114 LARGE_INTEGER NtTime; 1115 do 1116 { 1117 NtTime.HighPart = pUserSharedData->SystemTime.High1Time; 1118 NtTime.LowPart = pUserSharedData->SystemTime.LowPart; 1119 } while (pUserSharedData->SystemTime.High2Time != NtTime.HighPart); 1120 return RTTimeSpecSetNtTime(pNow, NtTime.QuadPart); 1121 # endif 1122 #else /* IN_RING0 */ 1123 return RTTimeNow(pNow); 1124 #endif /* IN_RING0 */ 1125 } 1126 1127 1128 /** 1097 1129 * Verifies the given loader image. 1098 1130 * … … 1173 1205 * validations. This works around issues with old DLLs that 1174 1206 * we sign against with our certificate (crt, sdl, qt). 1207 * 1208 * Update: If the validation fails, retry with the current timestamp. This 1209 * is a workaround for NTDLL.DLL in build 14971 having a weird 1210 * timestamp: 0xDF1E957E (Sat Aug 14 14:05:18 2088). 1175 1211 */ 1176 1212 int rc = RTLdrQueryProp(hLdrMod, RTLDRPROP_TIMESTAMP_SECONDS, &pNtViRdr->uTimestamp, sizeof(pNtViRdr->uTimestamp)); … … 1190 1226 g_uBuildTimestampHack = pNtViRdr->uTimestamp; 1191 1227 #endif 1228 1229 if (rc == VERR_CR_X509_CPV_NOT_VALID_AT_TIME) 1230 { 1231 RTTIMESPEC Now; 1232 uint64_t uOld = pNtViRdr->uTimestamp; 1233 pNtViRdr->uTimestamp = RTTimeSpecGetSeconds(supHardNtTimeNow(&Now)); 1234 SUP_DPRINTF(("%ls: VERR_CR_X509_CPV_NOT_VALID_AT_TIME for %#RX64; retrying against current time: %#RX64.\n", 1235 pwszName, uOld, pNtViRdr->uTimestamp)); NOREF(uOld); 1236 rc = RTLdrVerifySignature(hLdrMod, supHardNtViCallback, pNtViRdr, pErrInfo); 1237 } 1192 1238 1193 1239 /*
Note:
See TracChangeset
for help on using the changeset viewer.