VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Crypto
diff options
context:
space:
mode:
authorDavid Foerster <david.foerster@informatik.hu-berlin.de>2016-05-10 22:16:32 +0200
committerDavid Foerster <david.foerster@informatik.hu-berlin.de>2016-05-10 22:18:34 +0200
commit11716ed2dacbb104f8f59867fe66f2c0a6984291 (patch)
tree28aa448de2e790d0f40dc57799a55a9df12ee6fb /src/Crypto
parent191075155835172e5596e191cf0679ff9022f0fd (diff)
downloadVeraCrypt-11716ed2dacbb104f8f59867fe66f2c0a6984291.tar.gz
VeraCrypt-11716ed2dacbb104f8f59867fe66f2c0a6984291.zip
Remove trailing whitespace
Diffstat (limited to 'src/Crypto')
-rw-r--r--src/Crypto/AesSmall_x86.asm30
-rw-r--r--src/Crypto/Aes_hw_cpu.asm4
-rw-r--r--src/Crypto/Aes_hw_cpu.h2
-rw-r--r--src/Crypto/Aes_x64.asm14
-rw-r--r--src/Crypto/Aes_x86.asm14
-rw-r--r--src/Crypto/Aestab.c2
-rw-r--r--src/Crypto/Rmd160.c8
-rw-r--r--src/Crypto/Serpent.c66
-rw-r--r--src/Crypto/Sha2Small.c10
-rw-r--r--src/Crypto/Twofish.c64
-rw-r--r--src/Crypto/Whirlpool.c12
-rw-r--r--src/Crypto/cpu.c2
-rw-r--r--src/Crypto/cpu.h2
13 files changed, 115 insertions, 115 deletions
diff --git a/src/Crypto/AesSmall_x86.asm b/src/Crypto/AesSmall_x86.asm
index de32fc66..20008194 100644
--- a/src/Crypto/AesSmall_x86.asm
+++ b/src/Crypto/AesSmall_x86.asm
@@ -1,23 +1,23 @@
; ---------------------------------------------------------------------------
; Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved.
-;
+;
; LICENSE TERMS
-;
+;
; The free distribution and use of this software is allowed (with or without
; changes) provided that:
-;
+;
; 1. source code distributions include the above copyright notice, this
; list of conditions and the following disclaimer;
-;
+;
; 2. binary distributions include the above copyright notice, this list
; of conditions and the following disclaimer in their documentation;
-;
+;
; 3. the name of the copyright holder is not used to endorse products
; built using this software without specific written permission.
-;
+;
; DISCLAIMER
-;
+;
; This software is provided 'as is' with no explicit or implied warranties
; in respect of its properties, including, but not limited to, correctness
; and/or fitness for purpose.
@@ -367,7 +367,7 @@ extern _aes_enc_tab
; Apply S-Box to the 4 bytes in a 32-bit word and rotate byte positions
%ifdef REDUCE_CODE_SIZE
-
+
l3s_col:
movzx ecx,al ; in eax
movzx ecx, etab_b(ecx) ; out eax
@@ -413,7 +413,7 @@ l3s_col:
%endmacro
%endif
-
+
; offsets to parameters
in_blk equ 2 ; input byte array address parameter
@@ -444,7 +444,7 @@ enc_round:
xor ebx,[ebp+4]
add sp, 2
ret
-
+
%else
%macro enc_round 0
@@ -724,7 +724,7 @@ enc_round:
mov ax, sp
movzx esp, ax
-
+
push ebp
push ebx
push esi
@@ -1000,7 +1000,7 @@ dec_round:
; AES Decryption Subroutine
do_name _aes_decrypt,12
-
+
mov ax, sp
movzx esp, ax
@@ -1095,7 +1095,7 @@ inv_mix_col:
%else
-%macro inv_mix_col 0
+%macro inv_mix_col 0
movzx ecx,dl ; input eax, edx
movzx ecx,etab_b(ecx) ; output eax
@@ -1243,14 +1243,14 @@ inv_mix_col:
%endif
do_name _aes_decrypt_key256,8
-
+
mov ax, sp
movzx esp, ax
push ebp
push ebx
push esi
push edi
-
+
movzx eax, word [esp+20] ; ks
movzx edx, word [esp+18] ; key
push ax
diff --git a/src/Crypto/Aes_hw_cpu.asm b/src/Crypto/Aes_hw_cpu.asm
index 53852665..faaba4f3 100644
--- a/src/Crypto/Aes_hw_cpu.asm
+++ b/src/Crypto/Aes_hw_cpu.asm
@@ -254,7 +254,7 @@
cmp ax, 0
jl .decrypt
-
+
aesenc xmm1, xmm0
jmp .2
.decrypt:
@@ -264,7 +264,7 @@
add si, ax
movdqu xmm0, [si]
-
+
cmp ax, 0
jl .decrypt_last
diff --git a/src/Crypto/Aes_hw_cpu.h b/src/Crypto/Aes_hw_cpu.h
index e2fed1a1..1265ac47 100644
--- a/src/Crypto/Aes_hw_cpu.h
+++ b/src/Crypto/Aes_hw_cpu.h
@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0.
- Modifications and additions to the original source code (contained in this file)
+ 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
diff --git a/src/Crypto/Aes_x64.asm b/src/Crypto/Aes_x64.asm
index 06d57ac2..f74d0328 100644
--- a/src/Crypto/Aes_x64.asm
+++ b/src/Crypto/Aes_x64.asm
@@ -1,23 +1,23 @@
; ---------------------------------------------------------------------------
; Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved.
-;
+;
; LICENSE TERMS
-;
+;
; The free distribution and use of this software is allowed (with or without
; changes) provided that:
-;
+;
; 1. source code distributions include the above copyright notice, this
; list of conditions and the following disclaimer;
-;
+;
; 2. binary distributions include the above copyright notice, this list
; of conditions and the following disclaimer in their documentation;
-;
+;
; 3. the name of the copyright holder is not used to endorse products
; built using this software without specific written permission.
-;
+;
; DISCLAIMER
-;
+;
; This software is provided 'as is' with no explicit or implied warranties
; in respect of its properties, including, but not limited to, correctness
; and/or fitness for purpose.
diff --git a/src/Crypto/Aes_x86.asm b/src/Crypto/Aes_x86.asm
index 3825deee..484e31a7 100644
--- a/src/Crypto/Aes_x86.asm
+++ b/src/Crypto/Aes_x86.asm
@@ -1,23 +1,23 @@
; ---------------------------------------------------------------------------
; Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved.
-;
+;
; LICENSE TERMS
-;
+;
; The free distribution and use of this software is allowed (with or without
; changes) provided that:
-;
+;
; 1. source code distributions include the above copyright notice, this
; list of conditions and the following disclaimer;
-;
+;
; 2. binary distributions include the above copyright notice, this list
; of conditions and the following disclaimer in their documentation;
-;
+;
; 3. the name of the copyright holder is not used to endorse products
; built using this software without specific written permission.
-;
+;
; DISCLAIMER
-;
+;
; This software is provided 'as is' with no explicit or implied warranties
; in respect of its properties, including, but not limited to, correctness
; and/or fitness for purpose.
diff --git a/src/Crypto/Aestab.c b/src/Crypto/Aestab.c
index 1effb6f6..afa633ec 100644
--- a/src/Crypto/Aestab.c
+++ b/src/Crypto/Aestab.c
@@ -280,7 +280,7 @@ AES_RETURN aes_init(void)
return EXIT_SUCCESS;
for (i = 0; i < 256; ++i)
- {
+ {
uint_8t x = fwd_affine(fi((uint_8t)i));
aes_enc_tab[i][0] = 0;
aes_enc_tab[i][1] = x;
diff --git a/src/Crypto/Rmd160.c b/src/Crypto/Rmd160.c
index 75a34c3e..9387f9ba 100644
--- a/src/Crypto/Rmd160.c
+++ b/src/Crypto/Rmd160.c
@@ -15,7 +15,7 @@
#include "Common/Endian.h"
#include "Rmd160.h"
-#define F(x, y, z) (x ^ y ^ z)
+#define F(x, y, z) (x ^ y ^ z)
#define G(x, y, z) (z ^ (x & (y^z)))
#define H(x, y, z) (z ^ (x | ~y))
#define I(x, y, z) (y ^ (z & (x^y)))
@@ -300,7 +300,7 @@ void RMD160Transform (unsigned __int32 *digest, const unsigned __int32 *data)
Subround(J, b2, c2, d2, e2, a2, X[ 3], 12, k5);
Subround(J, a2, b2, c2, d2, e2, X[12], 6, k5);
- Subround(I, e2, a2, b2, c2, d2, X[ 6], 9, k6);
+ Subround(I, e2, a2, b2, c2, d2, X[ 6], 9, k6);
Subround(I, d2, e2, a2, b2, c2, X[11], 13, k6);
Subround(I, c2, d2, e2, a2, b2, X[ 3], 15, k6);
Subround(I, b2, c2, d2, e2, a2, X[ 7], 7, k6);
@@ -383,7 +383,7 @@ void RMD160Transform (unsigned __int32 *digest, const unsigned __int32 *data)
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0.
- Modifications and additions to the original source code (contained in this file)
+ 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
@@ -454,7 +454,7 @@ void RMD160Transform (unsigned __int32 *state, const unsigned __int32 *data)
for (pos = 0; pos < 160; ++pos)
{
tmp = a + data[OrderTab[pos]] + KTab[pos >> 4];
-
+
switch (pos >> 4)
{
case 0: case 9: tmp += F (b, c, d); break;
diff --git a/src/Crypto/Serpent.c b/src/Crypto/Serpent.c
index a8c528de..2db76deb 100644
--- a/src/Crypto/Serpent.c
+++ b/src/Crypto/Serpent.c
@@ -64,7 +64,7 @@
#define afterI1(f) f(1,a,b,c,e,d)
#define afterI0(f) f(0,a,d,b,e,c)
-// The instruction sequences for the S-box functions
+// The instruction sequences for the S-box functions
// come from Dag Arne Osvik's paper "Speeding up Serpent".
#define S0(i, r0, r1, r2, r3, r4) \
@@ -462,9 +462,9 @@ static void S0f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r
}
static void S1f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r2, unsigned __int32 *r3, unsigned __int32 *r4)
-{
- *r0 = ~*r0;
- *r2 = ~*r2;
+{
+ *r0 = ~*r0;
+ *r2 = ~*r2;
*r4 = *r0;
*r0 &= *r1;
*r2 ^= *r0;
@@ -484,7 +484,7 @@ static void S1f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r
}
static void S2f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r2, unsigned __int32 *r3, unsigned __int32 *r4)
-{
+{
*r4 = *r0;
*r0 &= *r2;
*r0 ^= *r3;
@@ -500,11 +500,11 @@ static void S2f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r
*r4 ^= *r0;
*r1 ^= *r3;
*r1 ^= *r4;
- *r4 = ~*r4;
+ *r4 = ~*r4;
}
static void S3f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r2, unsigned __int32 *r3, unsigned __int32 *r4)
-{
+{
*r4 = *r0;
*r0 |= *r3;
*r3 ^= *r1;
@@ -527,9 +527,9 @@ static void S3f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r
}
static void S4f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r2, unsigned __int32 *r3, unsigned __int32 *r4)
-{
+{
*r1 ^= *r3;
- *r3 = ~*r3;
+ *r3 = ~*r3;
*r2 ^= *r3;
*r3 ^= *r0;
*r4 = *r1;
@@ -546,15 +546,15 @@ static void S4f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r
*r0 |= *r3;
*r0 ^= *r2;
*r2 &= *r3;
- *r0 = ~*r0;
+ *r0 = ~*r0;
*r4 ^= *r2;
}
static void S5f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r2, unsigned __int32 *r3, unsigned __int32 *r4)
-{
+{
*r0 ^= *r1;
*r1 ^= *r3;
- *r3 = ~*r3;
+ *r3 = ~*r3;
*r4 = *r1;
*r1 &= *r0;
*r2 ^= *r3;
@@ -567,15 +567,15 @@ static void S5f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r
*r4 ^= *r2;
*r2 ^= *r0;
*r0 &= *r3;
- *r2 = ~*r2;
+ *r2 = ~*r2;
*r0 ^= *r4;
*r4 |= *r3;
*r2 ^= *r4;
}
static void S6f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r2, unsigned __int32 *r3, unsigned __int32 *r4)
-{
- *r2 = ~*r2;
+{
+ *r2 = ~*r2;
*r4 = *r3;
*r3 &= *r0;
*r0 ^= *r4;
@@ -590,13 +590,13 @@ static void S6f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r
*r0 ^= *r2;
*r4 ^= *r3;
*r4 ^= *r0;
- *r3 = ~*r3;
+ *r3 = ~*r3;
*r2 &= *r4;
*r2 ^= *r3;
}
static void S7f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r2, unsigned __int32 *r3, unsigned __int32 *r4)
-{
+{
*r4 = *r2;
*r2 &= *r1;
*r2 ^= *r3;
@@ -612,7 +612,7 @@ static void S7f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r
*r3 ^= *r4;
*r4 ^= *r2;
*r2 &= *r0;
- *r4 = ~*r4;
+ *r4 = ~*r4;
*r2 ^= *r4;
*r4 &= *r0;
*r1 ^= *r3;
@@ -767,7 +767,7 @@ void serpent_encrypt(const unsigned __int8 *inBlock, unsigned __int8 *outBlock,
while (1);
afterS7(KX);
-
+
out[0] = LE32(d);
out[1] = LE32(e);
out[2] = LE32(b);
@@ -827,7 +827,7 @@ void serpent_encrypt(const unsigned __int8 *inBlock, unsigned __int8 *outBlock,
while (1);
KXf (k, 32, &d, &e, &b, &a);
-
+
out[0] = LE32(d);
out[1] = LE32(e);
out[2] = LE32(b);
@@ -862,17 +862,17 @@ void serpent_decrypt(const unsigned __int8 *inBlock, unsigned __int8 *outBlock,
k -= 32;
beforeI7(ILT);
start:
- beforeI7(I7); afterI7(KX);
- afterI7(ILT); afterI7(I6); afterI6(KX);
- afterI6(ILT); afterI6(I5); afterI5(KX);
- afterI5(ILT); afterI5(I4); afterI4(KX);
- afterI4(ILT); afterI4(I3); afterI3(KX);
- afterI3(ILT); afterI3(I2); afterI2(KX);
- afterI2(ILT); afterI2(I1); afterI1(KX);
+ beforeI7(I7); afterI7(KX);
+ afterI7(ILT); afterI7(I6); afterI6(KX);
+ afterI6(ILT); afterI6(I5); afterI5(KX);
+ afterI5(ILT); afterI5(I4); afterI4(KX);
+ afterI4(ILT); afterI4(I3); afterI3(KX);
+ afterI3(ILT); afterI3(I2); afterI2(KX);
+ afterI2(ILT); afterI2(I1); afterI1(KX);
afterI1(ILT); afterI1(I0); afterI0(KX);
}
while (--i != 0);
-
+
out[0] = LE32(a);
out[1] = LE32(d);
out[2] = LE32(b);
@@ -882,7 +882,7 @@ start:
#else // TC_MINIMIZE_CODE_SIZE
static void ILTf (uint32 *a, uint32 *b, uint32 *c, uint32 *d)
-{
+{
*c = rotrFixed(*c, 22);
*a = rotrFixed(*a, 5);
*c ^= *d ^ (*b << 7);
@@ -919,16 +919,16 @@ void serpent_decrypt(const unsigned __int8 *inBlock, unsigned __int8 *outBlock,
beforeI7(ILT);
start:
beforeI7(I7); KXf (k, 28, &d, &a, &b, &e);
- ILTf (&d, &a, &b, &e); afterI7(I6); KXf (k, 24, &a, &b, &c, &e);
- ILTf (&a, &b, &c, &e); afterI6(I5); KXf (k, 20, &b, &d, &e, &c);
- ILTf (&b, &d, &e, &c); afterI5(I4); KXf (k, 16, &b, &c, &e, &a);
+ ILTf (&d, &a, &b, &e); afterI7(I6); KXf (k, 24, &a, &b, &c, &e);
+ ILTf (&a, &b, &c, &e); afterI6(I5); KXf (k, 20, &b, &d, &e, &c);
+ ILTf (&b, &d, &e, &c); afterI5(I4); KXf (k, 16, &b, &c, &e, &a);
ILTf (&b, &c, &e, &a); afterI4(I3); KXf (k, 12, &a, &b, &e, &c);
ILTf (&a, &b, &e, &c); afterI3(I2); KXf (k, 8, &b, &d, &e, &c);
ILTf (&b, &d, &e, &c); afterI2(I1); KXf (k, 4, &a, &b, &c, &e);
ILTf (&a, &b, &c, &e); afterI1(I0); KXf (k, 0, &a, &d, &b, &e);
}
while (--i != 0);
-
+
out[0] = LE32(a);
out[1] = LE32(d);
out[2] = LE32(b);
diff --git a/src/Crypto/Sha2Small.c b/src/Crypto/Sha2Small.c
index 539ff05d..08318833 100644
--- a/src/Crypto/Sha2Small.c
+++ b/src/Crypto/Sha2Small.c
@@ -52,7 +52,7 @@ static const uint32 K[64] = {
Various logical functions
*/
#define Ch(x,y,z) (z ^ (x & (y ^ z)))
-#define Maj(x,y,z) (((x | y) & z) | (x & y))
+#define Maj(x,y,z) (((x | y) & z) | (x & y))
#define S(x, n) RORc((x),(n))
#define R(x, n) ((x)>>(n))
#define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22))
@@ -119,7 +119,7 @@ static void sha256_compress(sha256_ctx * ctx, unsigned char *buf)
for (i = 0; i < 64; ++i) {
RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],i);
- t = S[7]; S[7] = S[6]; S[6] = S[5]; S[5] = S[4];
+ t = S[7]; S[7] = S[6]; S[6] = S[5]; S[5] = S[4];
S[4] = S[3]; S[3] = S[2]; S[2] = S[1]; S[1] = S[0]; S[0] = t;
}
@@ -154,7 +154,7 @@ VOID_RETURN sha256_hash(unsigned char* data, unsigned int len, sha256_ctx* ctx)
{
uint32 n;
while (len > 0) {
- if (ctx->curlen == 0 && len >= 64) {
+ if (ctx->curlen == 0 && len >= 64) {
sha256_compress(ctx, (unsigned char *)data);
n = ctx->lowLength + 512;
@@ -178,7 +178,7 @@ VOID_RETURN sha256_hash(unsigned char* data, unsigned int len, sha256_ctx* ctx)
if (n < ctx->lowLength) {
ctx->highLength++;
}
- ctx->lowLength = n;
+ ctx->lowLength = n;
ctx->curlen = 0;
}
}
@@ -232,7 +232,7 @@ VOID_RETURN sha256_end(unsigned char* hval, sha256_ctx* ctx)
STORE32H(ctx->highLength, ctx->buf, 56);
STORE32H(ctx->lowLength, ctx->buf, 60);
-
+
sha256_compress(ctx, ctx->buf);
/*
diff --git a/src/Crypto/Twofish.c b/src/Crypto/Twofish.c
index 7c58c91e..09f6edaf 100644
--- a/src/Crypto/Twofish.c
+++ b/src/Crypto/Twofish.c
@@ -63,26 +63,26 @@ static u1byte tab_ef[4] = { 0, (G_M >> 1) ^ (G_M >> 2), G_M >> 1, G_M >> 2 };
static u1byte ror4[16] = { 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15 };
static u1byte ashx[16] = { 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 5, 14, 7 };
-static u1byte qt0[2][16] =
+static u1byte qt0[2][16] =
{ { 8, 1, 7, 13, 6, 15, 3, 2, 0, 11, 5, 9, 14, 12, 10, 4 },
{ 2, 8, 11, 13, 15, 7, 6, 14, 3, 1, 9, 4, 0, 10, 12, 5 }
};
static u1byte qt1[2][16] =
-{ { 14, 12, 11, 8, 1, 2, 3, 5, 15, 4, 10, 6, 7, 0, 9, 13 },
+{ { 14, 12, 11, 8, 1, 2, 3, 5, 15, 4, 10, 6, 7, 0, 9, 13 },
{ 1, 14, 2, 11, 4, 12, 3, 7, 6, 13, 10, 5, 15, 9, 0, 8 }
};
-static u1byte qt2[2][16] =
+static u1byte qt2[2][16] =
{ { 11, 10, 5, 14, 6, 13, 9, 0, 12, 8, 15, 3, 2, 4, 7, 1 },
{ 4, 12, 7, 5, 1, 6, 9, 10, 0, 14, 13, 8, 2, 11, 3, 15 }
};
-static u1byte qt3[2][16] =
+static u1byte qt3[2][16] =
{ { 13, 7, 15, 4, 1, 2, 6, 14, 9, 11, 3, 0, 8, 5, 12, 10 },
{ 11, 9, 5, 1, 12, 3, 13, 14, 6, 4, 7, 15, 2, 0, 8, 10 }
};
-
+
static u1byte qp(const u4byte n, const u1byte x)
{ u1byte a0, a1, a2, a3, a4, b0, b1, b2, b3, b4;
@@ -105,7 +105,7 @@ static void gen_qtab(void)
{ u4byte i;
for(i = 0; i < 256; ++i)
- {
+ {
q(0,i) = qp(0, (u1byte)i);
q(1,i) = qp(1, (u1byte)i);
}
@@ -124,7 +124,7 @@ static u4byte m_tab[4][256];
static void gen_mtab(void)
{ u4byte i, f01, f5b, fef;
-
+
for(i = 0; i < 256; ++i)
{
f01 = q(1,i); f5b = ffm_5b(f01); fef = ffm_ef(f01);
@@ -254,12 +254,12 @@ static void gen_mk_tab(TwofishInstance *instance, u4byte key[])
mk_tab[0 + 4*i] = mds(0, q20(by)); mk_tab[1 + 4*i] = mds(1, q21(by));
mk_tab[2 + 4*i] = mds(2, q22(by)); mk_tab[3 + 4*i] = mds(3, q23(by));
#else
- sb[0][i] = q20(by); sb[1][i] = q21(by);
+ sb[0][i] = q20(by); sb[1][i] = q21(by);
sb[2][i] = q22(by); sb[3][i] = q23(by);
#endif
}
break;
-
+
case 3: for(i = 0; i < 256; ++i)
{
by = (u1byte)i;
@@ -267,12 +267,12 @@ static void gen_mk_tab(TwofishInstance *instance, u4byte key[])
mk_tab[0 + 4*i] = mds(0, q30(by)); mk_tab[1 + 4*i] = mds(1, q31(by));
mk_tab[2 + 4*i] = mds(2, q32(by)); mk_tab[3 + 4*i] = mds(3, q33(by));
#else
- sb[0][i] = q30(by); sb[1][i] = q31(by);
+ sb[0][i] = q30(by); sb[1][i] = q31(by);
sb[2][i] = q32(by); sb[3][i] = q33(by);
#endif
}
break;
-
+
case 4: for(i = 0; i < 256; ++i)
{
by = (u1byte)i;
@@ -280,7 +280,7 @@ static void gen_mk_tab(TwofishInstance *instance, u4byte key[])
mk_tab[0 + 4*i] = mds(0, q40(by)); mk_tab[1 + 4*i] = mds(1, q41(by));
mk_tab[2 + 4*i] = mds(2, q42(by)); mk_tab[3 + 4*i] = mds(3, q43(by));
#else
- sb[0][i] = q40(by); sb[1][i] = q41(by);
+ sb[0][i] = q40(by); sb[1][i] = q41(by);
sb[2][i] = q42(by); sb[3][i] = q43(by);
#endif
}
@@ -315,22 +315,22 @@ static void gen_mk_tab(TwofishInstance *instance, u4byte key[])
where the coefficients are in the finite field GF(2^8) with a
modular polynomial a^8 + a^6 + a^3 + a^2 + 1. To generate the
remainder we have to start with a 12th order polynomial with our
-eight input bytes as the coefficients of the 4th to 11th terms.
+eight input bytes as the coefficients of the 4th to 11th terms.
That is:
m[7] * x^11 + m[6] * x^10 ... + m[0] * x^4 + 0 * x^3 +... + 0
-
+
We then multiply the generator polynomial by m[7] * x^7 and subtract
-it - xor in GF(2^8) - from the above to eliminate the x^7 term (the
-artihmetic on the coefficients is done in GF(2^8). We then multiply
+it - xor in GF(2^8) - from the above to eliminate the x^7 term (the
+artihmetic on the coefficients is done in GF(2^8). We then multiply
the generator polynomial by x^6 * coeff(x^10) and use this to remove
the x^10 term. We carry on in this way until the x^4 term is removed
so that we are left with:
r[3] * x^3 + r[2] * x^2 + r[1] 8 x^1 + r[0]
-which give the resulting 4 bytes of the remainder. This is equivalent
-to the matrix multiplication in the Twofish description but much faster
+which give the resulting 4 bytes of the remainder. This is equivalent
+to the matrix multiplication in the Twofish description but much faster
to implement.
*/
@@ -343,23 +343,23 @@ static u4byte mds_rem(u4byte p0, u4byte p1)
for(i = 0; i < 8; ++i)
{
t = p1 >> 24; // get most significant coefficient
-
+
p1 = (p1 << 8) | (p0 >> 24); p0 <<= 8; // shift others up
-
+
// multiply t by a (the primitive element - i.e. left shift)
- u = (t << 1);
-
+ u = (t << 1);
+
if(t & 0x80) // subtract modular polynomial on overflow
-
- u ^= G_MOD;
- p1 ^= t ^ (u << 16); // remove t * (a * x^2 + 1)
+ u ^= G_MOD;
+
+ p1 ^= t ^ (u << 16); // remove t * (a * x^2 + 1)
+
+ u ^= (t >> 1); // form u = a * t + t / a = t * (a + 1 / a);
- u ^= (t >> 1); // form u = a * t + t / a = t * (a + 1 / a);
-
if(t & 0x01) // add the modular polynomial on underflow
-
+
u ^= G_MOD >> 1;
p1 ^= (u << 24) | (u << 8); // remove t * (a + 1/a) * (x^3 + x)
@@ -445,7 +445,7 @@ void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte o
out_blk[0] = LE32(blk[2] ^ l_key[4]);
out_blk[1] = LE32(blk[3] ^ l_key[5]);
out_blk[2] = LE32(blk[0] ^ l_key[6]);
- out_blk[3] = LE32(blk[1] ^ l_key[7]);
+ out_blk[3] = LE32(blk[1] ^ l_key[7]);
};
#else // TC_MINIMIZE_CODE_SIZE
@@ -477,7 +477,7 @@ void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte o
out_blk[0] = LE32(blk[2] ^ l_key[4]);
out_blk[1] = LE32(blk[3] ^ l_key[5]);
out_blk[2] = LE32(blk[0] ^ l_key[6]);
- out_blk[3] = LE32(blk[1] ^ l_key[7]);
+ out_blk[3] = LE32(blk[1] ^ l_key[7]);
};
#endif // TC_MINIMIZE_CODE_SIZE
@@ -511,7 +511,7 @@ void twofish_decrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte o
out_blk[0] = LE32(blk[2] ^ l_key[0]);
out_blk[1] = LE32(blk[3] ^ l_key[1]);
out_blk[2] = LE32(blk[0] ^ l_key[2]);
- out_blk[3] = LE32(blk[1] ^ l_key[3]);
+ out_blk[3] = LE32(blk[1] ^ l_key[3]);
};
#else // TC_MINIMIZE_CODE_SIZE
@@ -543,7 +543,7 @@ void twofish_decrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte o
out_blk[0] = LE32(blk[2] ^ l_key[0]);
out_blk[1] = LE32(blk[3] ^ l_key[1]);
out_blk[2] = LE32(blk[0] ^ l_key[2]);
- out_blk[3] = LE32(blk[1] ^ l_key[3]);
+ out_blk[3] = LE32(blk[1] ^ l_key[3]);
};
#endif // TC_MINIMIZE_CODE_SIZE
diff --git a/src/Crypto/Whirlpool.c b/src/Crypto/Whirlpool.c
index c0e5b884..ee109d81 100644
--- a/src/Crypto/Whirlpool.c
+++ b/src/Crypto/Whirlpool.c
@@ -26,7 +26,7 @@
* ``The Whirlpool hashing function,''
* NESSIE submission, 2000 (tweaked version, 2001),
* <https://www.cosic.esat.kuleuven.ac.be/nessie/workshop/submissions/whirlpool.zip>
- *
+ *
* @author Paulo S.L.M. Barreto
* @author Vincent Rijmen.
*
@@ -397,7 +397,7 @@ void WhirlpoolTransform(uint64 *digest, const uint64 *block)
AS2( and esp, -16)
AS2( sub esp, 16*8)
AS_PUSH_IF86( ax)
-
+
#if CRYPTOPP_BOOL_X86
#define SSE2_workspace esp+WORD_SZ
#elif CRYPTOPP_BOOL_X32
@@ -722,7 +722,7 @@ void WHIRLPOOL_init(WHIRLPOOL_CTX * const ctx) {
*/
void WHIRLPOOL_add(const unsigned char * input,
unsigned __int32 sourceBits,
- WHIRLPOOL_CTX * const ctx)
+ WHIRLPOOL_CTX * const ctx)
{
uint64 num, oldCountLo = ctx->countLo, oldCountHi = ctx->countHi;
uint64 len = sourceBits >> 3;
@@ -734,7 +734,7 @@ void WHIRLPOOL_add(const unsigned char * input,
else
{
uint64* dataBuf = ctx->data;
- byte* data = (byte *)dataBuf;
+ byte* data = (byte *)dataBuf;
num = oldCountLo & 63;
if (num != 0) // process left over data
@@ -786,11 +786,11 @@ void WHIRLPOOL_add(const unsigned char * input,
/**
* Get the hash value from the hashing state.
- *
+ *
* This method uses the invariant: bufferBits < DIGESTBITS
*/
void WHIRLPOOL_finalize(WHIRLPOOL_CTX * const ctx,
- unsigned char * result)
+ unsigned char * result)
{
unsigned int num = ctx->countLo & 63;
uint64* dataBuf = ctx->data;
diff --git a/src/Crypto/cpu.c b/src/Crypto/cpu.c
index 4274a8ae..3de87069 100644
--- a/src/Crypto/cpu.c
+++ b/src/Crypto/cpu.c
@@ -76,7 +76,7 @@ int CpuId(uint32 input, uint32 output[4])
{
return 0;
}
-
+
// function 0 returns the highest basic function understood in EAX
if(input == 0)
return !!output[0]? 1 : 0;
diff --git a/src/Crypto/cpu.h b/src/Crypto/cpu.h
index 7ef509ec..44da8cc3 100644
--- a/src/Crypto/cpu.h
+++ b/src/Crypto/cpu.h
@@ -36,7 +36,7 @@ extern __m128i _mm_insert_epi32(__m128i dst, int s, const int ndx);
#if (defined(__AES__) && defined(__PCLMUL__)) || defined(__INTEL_COMPILER)
#ifdef TC_WINDOWS_DRIVER
-extern __m128i _mm_clmulepi64_si128(__m128i v1, __m128i v2,
+extern __m128i _mm_clmulepi64_si128(__m128i v1, __m128i v2,
const int imm8);
extern __m128i _mm_aeskeygenassist_si128(__m128i ckey, const int rcon);
extern __m128i _mm_aesimc_si128(__m128i v);