VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Format/Tcformat.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-04-05 22:21:59 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-04-06 00:22:36 +0200
commit2784652ab880dcea82aa212096b64d39695012fc (patch)
treeb6cc4636a3e47efaeae338dca1fca87a347b82b8 /src/Format/Tcformat.c
parenta284922ce45ca777dd98b53e846603c63cb44904 (diff)
downloadVeraCrypt-2784652ab880dcea82aa212096b64d39695012fc.tar.gz
VeraCrypt-2784652ab880dcea82aa212096b64d39695012fc.zip
Windows vulnerability fix: CryptAcquireContext vulnerability fix. Add checks to random generator to abort in case of error and display a diagnose message to the user.
Diffstat (limited to 'src/Format/Tcformat.c')
-rw-r--r--src/Format/Tcformat.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c
index 80fc6d00..b32ce0ce 100644
--- a/src/Format/Tcformat.c
+++ b/src/Format/Tcformat.c
@@ -9000,7 +9000,15 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, char *lpszComm
nPbar = IDC_PROGRESS_BAR;
if (Randinit ())
- AbortProcess ("INIT_RAND");
+ {
+ DWORD dwLastError = GetLastError ();
+ wchar_t szTmp[4096];
+ if (CryptoAPILastError == ERROR_SUCCESS)
+ StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("INIT_RAND"), SRC_POS, dwLastError);
+ else
+ StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("CAPI_RAND"), SRC_POS, CryptoAPILastError);
+ AbortProcessDirect (szTmp);
+ }
RegisterRedTick(hInstance);