VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main
AgeCommit message (Collapse)AuthorFilesLines
2015-08-06Update license information to reflect the use of a dual license Apache 2.0 ↵Mounir IDRASSI98-448/+832
and TrueCrypt 3.0.
2015-07-25Linux: solve compilation error on OpenSUSE when linking against system ↵Mounir IDRASSI1-1/+1
wxWidgets. OpenSUSE enables STL in wxWidgets which causes the error because implicit casts are not available.
2015-07-19Linux: Add "new-hash" switch for changing PRF and remove "current-hash" ↵Mounir IDRASSI3-7/+7
switch which didin't fit the change password/keyfile logic.
2015-07-19User Interface enhancements for PIMMounir IDRASSI12-54/+305
2015-07-11Linux: Solve compilation warning (unused variables, pointer cast)Mounir IDRASSI2-6/+0
2015-07-11Linux: Solve error when building against dynamic wxWidgets library, ↵Mounir IDRASSI1-0/+4
especially under Ubuntu.
2015-07-11Use Pim name for internal variables instead of the old name PinMounir IDRASSI5-31/+31
2015-06-28Linux/MacOSX: Add dedicated PIM page in the volume creation wizard. Correct ↵Mounir IDRASSI11-10/+660
PIM value check logic.
2015-06-26Linux: don't ask for PIM if TrueCryptMode enabled, both in command line and GUIMounir IDRASSI6-13/+36
2015-06-24Linux: if a keyfile is specified in the command line without a password, ↵Mounir IDRASSI1-1/+1
don't try to mount using an empty password unless its TrueCryptMode or an empty password has been explicitly specified.
2015-06-24Linux/MacOSX: solve GUI layout issues although the volume creation wizard ↵Mounir IDRASSI4-9/+10
still has issues
2015-06-24Linux/MacOSX: restore normal file mode to some source filesMounir IDRASSI20-0/+0
2015-06-24Linux: solve bug when "-tc" command line switch is not followed by another ↵Mounir IDRASSI1-1/+1
switch. In this case, the value coming after the "-tc" switch was ignored from processing.
2015-06-24Linux/MacOSX: first dynamic mode implementationMounir IDRASSI19-53/+547
2015-04-26Linux: in command line, support hash algorithm names without '-' as on ↵Mounir IDRASSI1-3/+9
Windows ("sha256", "sha512", "ripemd160")
2015-04-19Linux: Correct wxWidgets assert warnings when displaying about/LegalNotice ↵Mounir IDRASSI2-4/+2
dialogs. This didn't happen with official binaries because the library used disables asserts.
2015-04-19
have a better user experience.
2014-12-20Linux: update the embedded data index inside the installer because the ↵Mounir IDRASSI1-1/+1
license content became bigger.
2014-12-20Linux/MacOSX: Add a donation menu entryMounir IDRASSI4-0/+23
2014-12-20Linux/MacOSX: remove calls to non existent class VolumeLayoutV1HiddenMounir IDRASSI2-4/+4
2014-12-20Reduce time for reporting wrong password by removing support for legacy ↵Mounir IDRASSI1-2/+2
hidden format because it was never functional and it was superseded by current hidden format.
2014-12-19Linux/MacOSX: Enhance performance by implementing the possibility to choose ↵Mounir IDRASSI16-20/+95
the correct hash algorithm of volumes during various operations (mount, change password...), both using the GUI and the command line.
2014-12-11Linux/macOSX: always display random gathering dialog/interface before ↵Mounir IDRASSI3-0/+20
performing sensitive operations that needs good quality random.
2014-12-11Linux/MacOSX: Implement generating more than one keyfile, specifying the ↵Mounir IDRASSI6-11/+948
size of the generated keyfiles and letting VeraCrypt choose random size values.
2014-12-07MacOSX/Linux: Solve truncated text in some Wizard windows by defining a ↵VeraCrypt_1.0f-BETA2Mounir IDRASSIpan>, 0x7, 0xe, 0xd, 0x0, 0x5, 0x8, 0x3, 0x4, 0xf, 0xa, 0x6, 0x9, 0xc, 0xb, 0x2 }, }; void gost_prepare_kds(gost_kds* kds) { uint32 i; // Build substitution tables. for (i = 0; i < 256; ++i) { uint32 p; p = kds->sbox[7][i >> 4] << 4 | kds->sbox[6][i & 15]; p = p << 24; p = p << 11 | p >> 21; kds->sbox_cvt[i] = p; // S87 p = kds->sbox[5][i >> 4] << 4 | kds->sbox[4][i & 15]; p = p << 16; p = p << 11 | p >> 21; kds->sbox_cvt[256 + i] = p; // S65 p = kds->sbox[3][i >> 4] << 4 | kds->sbox[2][i & 15]; p = p << 8; p = p << 11 | p >> 21; kds->sbox_cvt[256 * 2 + i] = p; // S43 p = kds->sbox[1][i >> 4] << 4 | kds->sbox[0][i & 15]; p = p << 11 | p >> 21; kds->sbox_cvt[256 * 3 + i] = p; // S21 } } static void xor_s_box(byte s_box[8][16], byte *seed) { int i; for (i = 0; i < 16; i++) { s_box[0][i] ^= (seed[ (i * 4) + 0 ] ) & 0xF; s_box[1][i] ^= (seed[ (i * 4) + 0 ]>>4) & 0xF; s_box[2][i] ^= (seed[ (i * 4) + 1 ] ) & 0xF; s_box[3][i] ^= (seed[ (i * 4) + 1 ]>>4) & 0xF; s_box[4][i] ^= (seed[ (i * 4) + 2 ] ) & 0xF; s_box[5][i] ^= (seed[ (i * 4) + 2 ]>>4) & 0xF; s_box[6][i] ^= (seed[ (i * 4) + 3 ] ) & 0xF; s_box[7][i] ^= (seed[ (i * 4) + 3 ]>>4) & 0xF; } } void gost_set_key(const byte *key, gost_kds *ks, int useDynamicSbox) { memcpy(ks->key, key, GOST_KEYSIZE); memcpy(ks->sbox, S_TC26, sizeof(ks->sbox)); if (useDynamicSbox) { STREEBOG_CTX sctx; byte sbox_seed[64]; #if defined (DEVICE_DRIVER) && !defined (_WIN64) KFLOATING_SAVE floatingPointState; NTSTATUS saveStatus = STATUS_INVALID_PARAMETER; if (HasSSE2() || HasSSE41()) saveStatus = KeSaveFloatingPointState (&floatingPointState); #endif //Generate pseudorandom data based on the key STREEBOG_init(&sctx); STREEBOG_add(&sctx, ks->key, 32); STREEBOG_finalize(&sctx, sbox_seed); #if defined (DEVICE_DRIVER) && !defined (_WIN64) if (NT_SUCCESS (saveStatus)) KeRestoreFloatingPointState (&floatingPointState); #endif xor_s_box(ks->sbox, sbox_seed); } gost_prepare_kds(ks); } static uint32 f(uint32 v, uint32* sbox){ byte* x =(byte*) &v; /* Do substitutions */ return sbox[x[3]] | sbox[256 + x[2]] | sbox[256*2 + x[1]] | sbox[256*3 + x[0]]; } void gost_encrypt_block(uint64 in_, uint64* out_, gost_kds* kds) { uint32* in = (uint32*)&in_; uint32* out = (uint32*)out_; uint32* key = (uint32*)kds->key; uint32* sbox = kds->sbox_cvt; // As named in the GOST uint32 n1 = in[0]; uint32 n2 = in[1]; n2 ^= f(n1+key[0], sbox); n1 ^= f(n2+key[1], sbox); n2 ^= f(n1+key[2], sbox); n1 ^= f(n2+key[3], sbox); n2 ^= f(n1+key[4], sbox); n1 ^= f(n2+key[5], sbox); n2 ^= f(n1+key[6], sbox); n1 ^= f(n2+key[7], sbox); n2 ^= f(n1+key[0], sbox); n1 ^= f(n2+key[1], sbox); n2 ^= f(n1+key[2], sbox); n1 ^= f(n2+key[3], sbox); n2 ^= f(n1+key[4], sbox); n1 ^= f(n2+key[5], sbox); n2 ^= f(n1+key[6], sbox); n1 ^= f(n2+key[7], sbox); n2 ^= f(n1+key[0], sbox); n1 ^= f(n2+key[1], sbox); n2 ^= f(n1+key[2], sbox); n1 ^= f(n2+key[3], sbox); n2 ^= f(n1+key[4], sbox); n1 ^= f(n2+key[5], sbox); n2 ^= f(n1+key[6], sbox); n1 ^= f(n2+key[7], sbox); n2 ^= f(n1+key[7], sbox); n1 ^= f(n2+key[6], sbox); n2 ^= f(n1+key[5], sbox); n1 ^= f(n2+key[4], sbox); n2 ^= f(n1+key[3], sbox); n1 ^= f(n2+key[2], sbox); n2 ^= f(n1+key[1], sbox); n1 ^= f(n2+key[0], sbox); // There is no swap after the last round out[0] = n2; out[1] = n1; } void gost_decrypt_block(uint64 in_, uint64* out_, gost_kds* kds) { uint32* in = (uint32*)&in_; uint32* out = (uint32*)out_; uint32* key = (uint32*)kds->key; uint32* sbox = kds->sbox_cvt; // As named in the GOST uint32 n1 = in[0]; uint32 n2 = in[1]; n2 ^= f(n1+key[0], sbox); n1 ^= f(n2+key[1], sbox); n2 ^= f(n1+key[2], sbox); n1 ^= f(n2+key[3], sbox); n2 ^= f(n1+key[4], sbox); n1 ^= f(n2+key[5], sbox); n2 ^= f(n1+key[6], sbox); n1 ^= f(n2+key[7], sbox); n2 ^= f(n1+key[7], sbox); n1 ^= f(n2+key[6], sbox); n2 ^= f(n1+key[5], sbox); n1 ^= f(n2+key[4], sbox); n2 ^= f(n1+key[3], sbox); n1 ^= f(n2+key[2], sbox); n2 ^= f(n1+key[1], sbox); n1 ^= f(n2+key[0], sbox); n2 ^= f(n1+key[7], sbox); n1 ^= f(n2+key[6], sbox); n2 ^= f(n1+key[5], sbox); n1 ^= f(n2+key[4], sbox); n2 ^= f(n1+key[3], sbox); n1 ^= f(n2+key[2], sbox); n2 ^= f(n1+key[1], sbox); n1 ^= f(n2+key[0], sbox); n2 ^= f(n1+key[7], sbox); n1 ^= f(n2+key[6], sbox); n2 ^= f(n1+key[5], sbox); n1 ^= f(n2+key[4], sbox); n2 ^= f(n1+key[3], sbox); n1 ^= f(n2+key[2], sbox); n2 ^= f(n1+key[1], sbox); n1 ^= f(n2+key[0], sbox); out[0] = n2; out[1] = n1; } #if defined(_M_AMD64) void gost_encrypt_128_CBC_asm(const byte *in, byte *out, gost_kds *ks, uint64 count); void gost_decrypt_128_CBC_asm(const byte *in, byte *out, gost_kds *ks, uint64 count); #endif void gost_encrypt(const byte *in, byte *out, gost_kds *ks, int count) { #if defined(_M_AMD64) gost_encrypt_128_CBC_asm(in, out, ks, (uint64)count); #else while (count > 0) { // encrypt two blocks in CBC mode gost_encrypt_block(*((uint64*)in), (uint64*)out, ks); *((gst_udword*)(out + 8)) = *((gst_udword*)(in + 8)) ^ *((gst_udword*)(out)); *((gst_udword*)(out + 12)) = *((gst_udword*)(in + 12)) ^ *((gst_udword*)(out + 4)); gost_encrypt_block(*((uint64*)(out + 8)), (uint64*)(out + 8), ks); count--; in += 16; out += 16; } #endif } void gost_decrypt(const byte *in, byte *out, gost_kds *ks, int count) { #if defined(_M_AMD64) gost_decrypt_128_CBC_asm(in, out, ks, (uint64)count); #else while (count > 0) { // decrypt two blocks in CBC mode gost_decrypt_block(*((uint64*)(in + 8)), (uint64*)(out + 8), ks); *((gst_udword*)(out + 8)) ^= *((gst_udword*)(in));; *((gst_udword*)(out + 12)) ^= *((gst_udword*)(in + 4));; gost_decrypt_block(*((uint64*)(in)), (uint64*)(out), ks); count--; in += 16; out += 16; } #endif } #endif