1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
|
/*
Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
code distribution packages. */
#include "Tcdefs.h"
#include "Crypto.h"
#include "Volumes.h"
#include "Password.h"
#include "Dlgcode.h"
#include "Language.h"
#include "Pkcs5.h"
#include "Endian.h"
#include "Random.h"
#include <io.h>
#ifndef SRC_POS
#define SRC_POS (__FUNCTION__ ":" TC_TO_STRING(__LINE__))
#endif
void VerifyPasswordAndUpdate (HWND hwndDlg, HWND hButton, HWND hPassword,
HWND hVerify, unsigned char *szPassword,
char *szVerify,
BOOL keyFilesEnabled)
{
wchar_t szTmp1[MAX_PASSWORD + 1];
wchar_t szTmp2[MAX_PASSWORD + 1];
char szTmp1Utf8[MAX_PASSWORD + 1];
char szTmp2Utf8[MAX_PASSWORD + 1];
int k = GetWindowTextLength (hPassword);
BOOL bEnable = FALSE;
int utf8Len1, utf8Len2;
UNREFERENCED_PARAMETER (hwndDlg); /* Remove warning */
GetWindowText (hPassword, szTmp1, ARRAYSIZE (szTmp1));
GetWindowText (hVerify, szTmp2, ARRAYSIZE (szTmp2));
utf8Len1 = WideCharToMultiByte (CP_UTF8, 0, szTmp1, -1, szTmp1Utf8, MAX_PASSWORD + 1, NULL, NULL);
utf8Len2 = WideCharToMultiByte (CP_UTF8, 0, szTmp2, -1, szTmp2Utf8, MAX_PASSWORD + 1, NULL, NULL);
if (wcscmp (szTmp1, szTmp2) != 0)
bEnable = FALSE;
else if (utf8Len1 <= 0)
bEnable = FALSE;
else
{
if (k >= MIN_PASSWORD || keyFilesEnabled)
bEnable = TRUE;
else
bEnable = FALSE;
}
if (szPassword != NULL)
{
if (utf8Len1 > 0)
memcpy (szPassword, szTmp1Utf8, sizeof (szTmp1Utf8));
else
szPassword [0] = 0;
}
if (szVerify != NULL)
{
if (utf8Len2 > 0)
memcpy (szVerify, szTmp2Utf8, sizeof (szTmp2Utf8));
else
szVerify [0] = 0;
}
burn (szTmp1, sizeof (szTmp1));
burn (szTmp2, sizeof (szTmp2));
burn (szTmp1Utf8, sizeof (szTmp1Utf8));
burn (szTmp2Utf8, sizeof (szTmp2Utf8));
EnableWindow (hButton, bEnable);
}
BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw)
{
int i, len;
if (hPassword == NULL)
{
if (ptrPw)
{
unsigned char *pw;
len = ptrPw->Length;
pw = (unsigned char *) ptrPw->Text;
for (i = 0; i < len; i++)
{
if (pw[i] >= 0x7f || pw[i] < 0x20) // A non-ASCII or non-printable character?
return FALSE;
}
}
else
return FALSE;
}
else
{
wchar_t s[MAX_PASSWORD + 1];
len = GetWindowTextLength (hPassword);
if (len > MAX_PASSWORD)
return FALSE;
GetWindowTextW (hPassword, s, sizeof (s) / sizeof (wchar_t));
for (i = 0; i < len; i++)
{
if (s[i] >= 0x7f || s[i] < 0x20) // A non-ASCII or non-printable character?
break;
}
burn (s, sizeof(s));
if (i < len)
return FALSE;
}
return TRUE;
}
BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim, BOOL bForBoot, BOOL bSkipPasswordWarning, BOOL bSkipPimWarning)
{
BOOL bCustomPimSmall = ((pim != 0) && (pim < (bForBoot? 98 : 485)))? TRUE : FALSE;
if (passwordLength < PASSWORD_LEN_WARNING)
{
if (bCustomPimSmall)
{
Error (bForBoot? "BOOT_PIM_REQUIRE_LONG_PASSWORD": "PIM_REQUIRE_LONG_PASSWORD", hwndDlg);
return FALSE;
}
#ifndef _DEBUG
if (!bSkipPasswordWarning && (MessageBoxW (hwndDlg, GetString ("PASSWORD_LENGTH_WARNING"), lpszTitle, MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2) != IDYES))
return FALSE;
#endif
}
#ifndef _DEBUG
else if (bCustomPimSmall)
{
if (!bSkipPimWarning && AskWarnNoYes ("PIM_SMALL_WARNING", hwndDlg) != IDYES)
return FALSE;
}
#endif
if ((pim != 0) && (pim > (bForBoot? 98 : 485)))
{
// warn that mount/boot will take more time
Warning ("PIM_LARGE_WARNING", hwndDlg);
}
return TRUE;
}
int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg)
{
int nDosLinkCreated = 1, nStatus = ERR_OS_ERROR;
wchar_t szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH];
wchar_t szDosDevice[TC_MAX_PATH];
char buffer[TC_VOLUME_HEADER_EFFECTIVE_SIZE];
PCRYPTO_INFO cryptoInfo = NULL, ci = NULL;
void *dev = INVALID_HANDLE_VALUE;
DWORD dwError;
DWORD bytesRead;
BOOL bDevice;
unsigned __int64 hostSize = 0;
int volumeType;
int wipePass;
FILETIME ftCreationTime;
FILETIME ftLastWriteTime;
FILETIME ftLastAccessTime;
BOOL bTimeStampValid = FALSE;
LARGE_INTEGER headerOffset;
BOOL backupHeader;
DISK_GEOMETRY_EX driveInfo;
if (oldPassword->Length == 0 || newPassword->Length == 0) return -1;
if ((wipePassCount <= 0) || (truecryptMode && (old_pkcs5 == SHA256)))
{
nStatus = ERR_PARAMETER_INCORRECT;
handleError (hwndDlg, nStatus, SRC_POS);
return nStatus;
}
if (!lpszVolume)
{
nStatus = ERR_OUTOFMEMORY;
handleError (hwndDlg, nStatus, SRC_POS);
return nStatus;
}
WaitCursor ();
CreateFullVolumePath (szDiskFile, sizeof(szDiskFile), lpszVolume, &bDevice);
if (bDevice == FALSE)
{
wcscpy (szCFDevice, szDiskFile);
}
else
{
nDosLinkCreated = FakeDosNameForDevice (szDiskFile, szDosDevice, sizeof.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */<?xml version="1.0" encoding="utf-8"?>
<VeraCrypt>
<localization prog-version="1.16">
<!-- Languages -->
<language langid="nn" name="Norsk Nynorsk" en-name="Norwegian (Nynorsk)" version="0.1.0" translators="Kjell Rune Helland" />
<!-- Fonts -->
<font lang="nn" class="normal" size="11" face="default" />
<font lang="nn" class="bold" size="13" face="Arial " />
<font lang="nn" class="fixed" size="12" face="Lucida Console " />
<font lang="nn" class="title" size="21" face="Times New Roman " />
<!-- Controls -->
<control lang="nn" key="IDCANCEL">Avbryt</control>
<control lang="en" key="IDC_ALL_USERS">Install &for all users</control>
<control lang="en" key="IDC_BROWSE">Bro&wse...</control>
<control lang="nn" key="IDC_DESKTOP_ICON">Legg til VeraCrypt ikon til skrivebordet</control>
<control lang="en" key="IDC_DONATE">Donate now...</control>
<control lang="en" key="IDC_FILE_TYPE">Associate the .hc file &extension with VeraCrypt</control>
<control lang="en" key="IDC_OPEN_CONTAINING_FOLDER">&Open the destination location when finished</control>
<control lang="nn" key="IDC_PROG_GROUP">Legg VeraCrypt til Start menyen</control>
<control lang="nn" key="IDC_SYSTEM_RESTORE">Lag System Gjennopprettings Punkt</control>
<control lang="nn" key="IDC_UNINSTALL">&Avinstaller</control>
<control lang="en" key="IDC_WIZARD_MODE_EXTRACT_ONLY">&Extract</control>
<control lang="en" key="IDC_WIZARD_MODE_INSTALL">&Install</control>
<control lang="en" key="IDD_INSTL_DLG">VeraCrypt Setup Wizard</control>
<control lang="nn" key="IDD_UNINSTALL">Avinstaller VeraCrypt</control>
<control lang="nn" key="IDHELP">&Hjelp</control>
<control lang="en" key="IDT_EXTRACT_DESTINATION">Please select or type the location where you want to place the extracted files:</control>
<control lang="en" key="IDT_INSTALL_DESTINATION">Please select or type the location where you want to install the VeraCrypt program files. If the specified folder does not exist, it will be automatically created.</control>
<control lang="en" key="IDT_UNINSTALL_DIR">Click Uninstall to remove VeraCrypt from this system.</control>
<control lang="nn" key="IDC_ABORT_BUTTON">Avbryt</control>
<control lang="en" key="IDC_BENCHMARK">&Benchmark</control>
<control lang="nn" key="IDC_CIPHER_TEST">&Test</control>
<control lang="en" key="IDC_DEVICE_TRANSFORM_MODE_FORMAT">Create encrypted volume and format it</control>
<control lang="en" key="IDC_DEVICE_TRANSFORM_MODE_INPLACE">Encrypt partition in place</control>
<control lang="en" key="IDC_DISPLAY_KEYS">Display generated keys (their portions)</control>
<control lang="nn" key="IDC_DISPLAY_POOL_CONTENTS">Skjerm basseng innhald</control>
<control lang="en" key="IDC_DOWNLOAD_CD_BURN_SOFTWARE">Download CD/DVD recording software</control>
<control lang="en" key="IDC_FILE_CONTAINER">Create an encrypted file container</control>
<control lang="en" key="IDC_GB">&GB</control>
<control lang="en" key="IDC_TB">&TB</control>
<control lang="en" key="IDC_HIDDEN_SYSENC_INFO_LINK">More information</control>
<control lang="en" key="IDC_HIDDEN_VOL">Hi&dden VeraCrypt volume </control>
<control lang="en" key="IDC_HIDDEN_VOL_HELP">More information about hidden volumes</control>
<control lang="en" key="IDC_HIDVOL_WIZ_MODE_DIRECT">Direct mode</control>
<control lang="en" key="IDC_HIDVOL_WIZ_MODE_FULL">Normal mode</control>
<control lang="nn" key="IDC_KB">&KB</control>
<control lang="nn" key="IDC_KEYFILES_ENABLE">U&Bruk nøkkelfiler</control>
<control lang="en" key="IDC_KEYFILES_TRY_EMPTY_PASSWORD">Try first to mount with an empty password</control>
<control lang="en" key="IDC_KEYFILES_RANDOM_SIZE">Random size ( 64 <-> 1048576 )</control>
<control lang="nn" key="IDC_KEY_FILES">Nø&kkelfiler..</control>
<control lang="nn" key="IDC_LINK_HASH_INFO">Informasjon om hash algoritmar</control>
<control lang="nn" key="IDC_LINK_MORE_INFO_ABOUT_CIPHER">Meir informasjon</control>
<control lang="en" key="IDC_LINK_PIM_INFO">Information on PIM</control>
<control lang="nn" key="IDC_MB">&MB </control>
<control lang="en" key="IDC_MORE_INFO_ON_CONTAINERS">More information</control>
<control lang="en" key="IDC_MORE_INFO_ON_SYS_ENCRYPTION">More information about system encryption</control>
<control lang="en" key="IDC_MORE_INFO_SYS_ENCRYPTION">More information</control>
<control lang="en" key="IDC_MULTI_BOOT">Multi-Boot</control>
<control lang="en" key="IDC_NONSYS_DEVICE">Encrypt a non-system partition/drive</control>
<control lang="nn" key="IDC_NO_HISTORY">&Aldri lagra historie</control>
<control lang="nn" key="IDC_OPEN_OUTER_VOLUME">Opne Ytre Volum</control>
<control lang="en" key="IDC_PAUSE">&Pause</control>
<control lang="en" key="IDC_PIM_ENABLE">Use PIM</control>
<control lang="en" key="IDC_NEW_PIM_ENABLE">Use PIM</control>
<control lang="nn" key="IDC_QUICKFORMAT">Rask Formatering</control>
<control lang="nn" key="IDC_SHOW_PASSWORD">&Vis passord</control>
<control lang="en" key="IDC_SHOW_PASSWORD_SINGLE">&Display password</control>
<control lang="en" key="IDC_SHOW_PIM">&Display PIM</control>
<control lang="en" key="IDC_SINGLE_BOOT">Single-boot</control>
<control lang="en" key="IDC_STD_VOL">Standard VeraCrypt volume</control>
<control lang="en" key="IDC_SYSENC_HIDDEN">Hi&dden</control>
<control lang="en" key="IDC_SYSENC_NORMAL">Normal</control>
<control lang="en" key="IDC_SYS_DEVICE">Encrypt the system partition or entire system drive</control>
<control lang="en" key="IDC_SYS_PARTITION">Encrypt the Windows system partition</control>
<control lang="en" key="IDC_WHOLE_SYS_DRIVE">Encrypt the whole drive</control>
<control lang="en" key="IDD_VOL_CREATION_WIZARD_DLG">VeraCrypt Volume Creation Wizard</control>
<control lang="nn" key="IDT_CLUSTER">Sektorgruppe </control>
<control lang="en" key="IDT_COLLECTING_RANDOM_DATA_NOTE">IMPORTANT: Move your mouse as randomly as possible within this window. The longer you move it, the better. This significantly increases the cryptographic strength of the encryption keys. Then click Next to continue.</control>
<control lang="nn" key="IDT_CONFIRM">&Bekreft:</control>
<control lang="nn" key="IDT_DONE">Ferdig </control>
<control lang="en" key="IDT_DRIVE_LETTER">Drive letter:</control>
<control lang="nn" key="IDT_ENCRYPTION_ALGO">Krypterings Algoritme</control>
<control lang="nn" key="IDT_FILESYSTEM">Filsystem </control>
<control lang="en" key="IDT_FILE_CONTAINER">Creates a virtual encrypted disk within a file. Recommended for inexperienced users.</control>
<control lang="nn" key="IDT_FORMAT_OPTIONS">Alternativ</control>
<control lang="nn" key="IDT_HASH_ALGO">Hash Algoritme</control>
<control lang="nn" key="IDT_HEADER_KEY">Over Nøkkel: </control>
<control lang="nn" key="IDT_LEFT">Venstre </control>
<control lang="nn" key="IDT_MASTER_KEY">Hovud Nøkkel: </control>
<control lang="en" key="IDT_MULTI_BOOT">Select this option if there are two or more operating systems installed on this computer.\n\nFor example:\n- Windows XP and Windows XP\n- Windows XP and Windows Vista\n- Windows and Mac OS X\n- Windows and Linux\n- Windows, Linux and Mac OS X</control>
<control lang="en" key="IDT_NON_SYS_DEVICE">Encrypts a non-system partition on any internal or external drive (e.g. a flash drive). Optionally, creates a hidden volume.</control>
<control lang="en" key="IDT_PARTIAL_POOL_CONTENTS">Current pool content (partial)</control>
<control lang="en" key="IDT_PASS">Pass</control>
<control lang="nn" key="IDT_PASSWORD">Passord:</control>
<control lang="en" key="IDT_PIM">Volume PIM:</control>
<control lang="en" key="IDT_OLD_PIM">Volume PIM:</control>
<control lang="en" key="IDT_PROGRESS">Progress:</control>
<control lang="nn" key="IDT_RANDOM_POOL">Tilfeldig Gruppe: </control>
<control lang="en" key="IDT_SINGLE_BOOT">Select this option if there is only one operating system installed on this computer (even if it has
|