Commit 6ffb1647 authored by Eric Rost's avatar Eric Rost Committed by Greg Kroah-Hartman
Browse files

staging: skein: Whitespace cleanup



Pretties up multiline #defines and many other whitespace issues

Signed-off-by: default avatarEric Rost <eric.rost@mybabylon.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9246a4a9
Loading
Loading
Loading
Loading
+315 −270
Original line number Diff line number Diff line
@@ -33,8 +33,11 @@
#define ts              (kw + KW_TWK_BASE)

#ifdef SKEIN_DEBUG
#define debug_save_tweak(ctx) { \
			ctx->h.tweak[0] = ts[0]; ctx->h.tweak[1] = ts[1]; }
#define debug_save_tweak(ctx)       \
{                                   \
	ctx->h.tweak[0] = ts[0];    \
	ctx->h.tweak[1] = ts[1];    \
}
#else
#define debug_save_tweak(ctx)
#endif
@@ -96,7 +99,8 @@ void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blk_ptr,
		debug_save_tweak(ctx);
		skein_show_block(BLK_BITS, &ctx->h, ctx->x, blk_ptr, w, ks, ts);

		X0 = w[0] + ks[0]; /* do the first full key injection */
		/* do the first full key injection */
		X0 = w[0] + ks[0];
		X1 = w[1] + ks[1] + ts[0];
		X2 = w[2] + ks[2] + ts[1];
		X3 = w[3] + ks[3];
@@ -111,8 +115,12 @@ void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blk_ptr,

#define ROUND256(p0, p1, p2, p3, ROT, r_num) \
do {                                         \
	X##p0 += X##p1; X##p1 = rotl_64(X##p1, ROT##_0); X##p1 ^= X##p0; \
	X##p2 += X##p3; X##p3 = rotl_64(X##p3, ROT##_1); X##p3 ^= X##p2; \
	X##p0 += X##p1;                      \
	X##p1 = rotl_64(X##p1, ROT##_0);     \
	X##p1 ^= X##p0;                      \
	X##p2 += X##p3;                      \
	X##p3 = rotl_64(X##p3, ROT##_1);     \
	X##p3 ^= X##p2;                      \
} while (0)

#if SKEIN_UNROLL_256 == 0
@@ -131,7 +139,8 @@ do { \
	X3   += ks[((R) + 4) % 5] + (R) + 1;                              \
	skein_show_r_ptr(BLK_BITS, &ctx->h, SKEIN_RND_KEY_INJECT, X_ptr); \
} while (0)
#else /* looping version */
#else
/* looping version */
#define R256(p0, p1, p2, p3, ROT, r_num) \
do { \
	ROUND256(p0, p1, p2, p3, ROT, r_num); \
@@ -312,7 +321,8 @@ void skein_512_process_block(struct skein_512_ctx *ctx, const u8 *blk_ptr,
		debug_save_tweak(ctx);
		skein_show_block(BLK_BITS, &ctx->h, ctx->x, blk_ptr, w, ks, ts);

		X0   = w[0] + ks[0]; /* do the first full key injection */
		/* do the first full key injection */
		X0   = w[0] + ks[0];
		X1   = w[1] + ks[1];
		X2   = w[2] + ks[2];
		X3   = w[3] + ks[3];
@@ -328,10 +338,17 @@ void skein_512_process_block(struct skein_512_ctx *ctx, const u8 *blk_ptr,
		/* run the rounds */
#define ROUND512(p0, p1, p2, p3, p4, p5, p6, p7, ROT, r_num) \
do {                                                         \
	X##p0 += X##p1; X##p1 = rotl_64(X##p1, ROT##_0); X##p1 ^= X##p0; \
	X##p2 += X##p3; X##p3 = rotl_64(X##p3, ROT##_1); X##p3 ^= X##p2; \
	X##p4 += X##p5; X##p5 = rotl_64(X##p5, ROT##_2); X##p5 ^= X##p4; \
	X##p6 += X##p7; X##p7 = rotl_64(X##p7, ROT##_3); X##p7 ^= X##p6; \
	X##p0 += X##p1;                                      \
	X##p1 = rotl_64(X##p1, ROT##_0);                     \
	X##p1 ^= X##p0;                                      \
	X##p2 += X##p3;                                      \
	X##p3 = rotl_64(X##p3, ROT##_1);                     \
	X##p3 ^= X##p2;                                      \
	X##p4 += X##p5;					     \
	X##p5 = rotl_64(X##p5, ROT##_2);                     \
	X##p5 ^= X##p4;                                      \
	X##p6 += X##p7; X##p7 = rotl_64(X##p7, ROT##_3);     \
	X##p7 ^= X##p6;                                      \
} while (0)

#if SKEIN_UNROLL_512 == 0
@@ -354,6 +371,7 @@ do { \
	X7   += ks[((R) + 8) % 9] + (R) + 1;                              \
	skein_show_r_ptr(BLK_BITS, &ctx->h, SKEIN_RND_KEY_INJECT, X_ptr); \
} while (0)

#else /* looping version */
#define R512(p0, p1, p2, p3, p4, p5, p6, p7, ROT, r_num)                 \
do {                                                                     \
@@ -513,11 +531,21 @@ void skein_1024_process_block(struct skein_1024_ctx *ctx, const u8 *blk_ptr,
#ifdef SKEIN_DEBUG
	const u64 *X_ptr[16]; /* use for debugging (help cc put Xn in regs) */

	X_ptr[0]  = &X00;  X_ptr[1]  = &X01;  X_ptr[2]  = &X02;
	X_ptr[3]  = &X03;  X_ptr[4]  = &X04;  X_ptr[5]  = &X05;
	X_ptr[6]  = &X06;  X_ptr[7]  = &X07;  X_ptr[8]  = &X08;
	X_ptr[9]  = &X09;  X_ptr[10] = &X10;  X_ptr[11] = &X11;
	X_ptr[12] = &X12;  X_ptr[13] = &X13;  X_ptr[14] = &X14;
	X_ptr[0] = &X00;
	X_ptr[1] = &X01;
	X_ptr[2] = &X02;
	X_ptr[3] = &X03;
	X_ptr[4] = &X04;
	X_ptr[5] = &X05;
	X_ptr[6] = &X06;
	X_ptr[7] = &X07;
	X_ptr[8] = &X08;
	X_ptr[9] = &X09;
	X_ptr[10] = &X10;
	X_ptr[11] = &X11;
	X_ptr[12] = &X12;
	X_ptr[13] = &X13;
	X_ptr[14] = &X14;
	X_ptr[15] = &X15;
#endif

@@ -560,7 +588,8 @@ void skein_1024_process_block(struct skein_1024_ctx *ctx, const u8 *blk_ptr,
		debug_save_tweak(ctx);
		skein_show_block(BLK_BITS, &ctx->h, ctx->x, blk_ptr, w, ks, ts);

		X00    =  w[0] +  ks[0]; /* do the first full key injection */
		/* do the first full key injection */
		X00 = w[0] + ks[0];
		X01 = w[1] + ks[1];
		X02 = w[2] + ks[2];
		X03 = w[3] + ks[3];
@@ -583,14 +612,30 @@ void skein_1024_process_block(struct skein_1024_ctx *ctx, const u8 *blk_ptr,
#define ROUND1024(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, pA, pB, pC, pD, pE, \
		  pF, ROT, r_num)                                             \
do {                                                                          \
	X##p0 += X##p1; X##p1 = rotl_64(X##p1, ROT##_0); X##p1 ^= X##p0;   \
	X##p2 += X##p3; X##p3 = rotl_64(X##p3, ROT##_1); X##p3 ^= X##p2;   \
	X##p4 += X##p5; X##p5 = rotl_64(X##p5, ROT##_2); X##p5 ^= X##p4;   \
	X##p6 += X##p7; X##p7 = rotl_64(X##p7, ROT##_3); X##p7 ^= X##p6;   \
	X##p8 += X##p9; X##p9 = rotl_64(X##p9, ROT##_4); X##p9 ^= X##p8;   \
	X##pA += X##pB; X##pB = rotl_64(X##pB, ROT##_5); X##pB ^= X##pA;   \
	X##pC += X##pD; X##pD = rotl_64(X##pD, ROT##_6); X##pD ^= X##pC;   \
	X##pE += X##pF; X##pF = rotl_64(X##pF, ROT##_7); X##pF ^= X##pE;   \
	X##p0 += X##p1;                                                       \
	X##p1 = rotl_64(X##p1, ROT##_0);                                      \
	X##p1 ^= X##p0;                                                       \
	X##p2 += X##p3;                                                       \
	X##p3 = rotl_64(X##p3, ROT##_1);                                      \
	X##p3 ^= X##p2;                                                       \
	X##p4 += X##p5;                                                       \
	X##p5 = rotl_64(X##p5, ROT##_2);                                      \
	X##p5 ^= X##p4;                                                       \
	X##p6 += X##p7;                                                       \
	X##p7 = rotl_64(X##p7, ROT##_3);                                      \
	X##p7 ^= X##p6;                                                       \
	X##p8 += X##p9;                                                       \
	X##p9 = rotl_64(X##p9, ROT##_4);                                      \
	X##p9 ^= X##p8;                                                       \
	X##pA += X##pB;                                                       \
	X##pB = rotl_64(X##pB, ROT##_5);                                      \
	X##pB ^= X##pA;                                                       \
	X##pC += X##pD;                                                       \
	X##pD = rotl_64(X##pD, ROT##_6);                                      \
	X##pD ^= X##pC;                                                       \
	X##pE += X##pF;                                                       \
	X##pF = rotl_64(X##pF, ROT##_7);                                      \
	X##pF ^= X##pE;                                                       \
} while (0)

#if SKEIN_UNROLL_1024 == 0