forked from luck/tmp_suning_uos_patched
crypto: rmd256 - use swap macro in rmd256_transform
Make use of the swap macro and remove unnecessary variable *tmp*. This makes the code easier to read and maintain. This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
6b0daa7820
commit
d75f482eaf
|
@ -49,7 +49,7 @@ struct rmd256_ctx {
|
||||||
|
|
||||||
static void rmd256_transform(u32 *state, const __le32 *in)
|
static void rmd256_transform(u32 *state, const __le32 *in)
|
||||||
{
|
{
|
||||||
u32 aa, bb, cc, dd, aaa, bbb, ccc, ddd, tmp;
|
u32 aa, bb, cc, dd, aaa, bbb, ccc, ddd;
|
||||||
|
|
||||||
/* Initialize left lane */
|
/* Initialize left lane */
|
||||||
aa = state[0];
|
aa = state[0];
|
||||||
|
@ -100,7 +100,7 @@ static void rmd256_transform(u32 *state, const __le32 *in)
|
||||||
ROUND(bbb, ccc, ddd, aaa, F4, KK1, in[12], 6);
|
ROUND(bbb, ccc, ddd, aaa, F4, KK1, in[12], 6);
|
||||||
|
|
||||||
/* Swap contents of "a" registers */
|
/* Swap contents of "a" registers */
|
||||||
tmp = aa; aa = aaa; aaa = tmp;
|
swap(aa, aaa);
|
||||||
|
|
||||||
/* round 2: left lane */
|
/* round 2: left lane */
|
||||||
ROUND(aa, bb, cc, dd, F2, K2, in[7], 7);
|
ROUND(aa, bb, cc, dd, F2, K2, in[7], 7);
|
||||||
|
@ -139,7 +139,7 @@ static void rmd256_transform(u32 *state, const __le32 *in)
|
||||||
ROUND(bbb, ccc, ddd, aaa, F3, KK2, in[2], 11);
|
ROUND(bbb, ccc, ddd, aaa, F3, KK2, in[2], 11);
|
||||||
|
|
||||||
/* Swap contents of "b" registers */
|
/* Swap contents of "b" registers */
|
||||||
tmp = bb; bb = bbb; bbb = tmp;
|
swap(bb, bbb);
|
||||||
|
|
||||||
/* round 3: left lane */
|
/* round 3: left lane */
|
||||||
ROUND(aa, bb, cc, dd, F3, K3, in[3], 11);
|
ROUND(aa, bb, cc, dd, F3, K3, in[3], 11);
|
||||||
|
@ -178,7 +178,7 @@ static void rmd256_transform(u32 *state, const __le32 *in)
|
||||||
ROUND(bbb, ccc, ddd, aaa, F2, KK3, in[13], 5);
|
ROUND(bbb, ccc, ddd, aaa, F2, KK3, in[13], 5);
|
||||||
|
|
||||||
/* Swap contents of "c" registers */
|
/* Swap contents of "c" registers */
|
||||||
tmp = cc; cc = ccc; ccc = tmp;
|
swap(cc, ccc);
|
||||||
|
|
||||||
/* round 4: left lane */
|
/* round 4: left lane */
|
||||||
ROUND(aa, bb, cc, dd, F4, K4, in[1], 11);
|
ROUND(aa, bb, cc, dd, F4, K4, in[1], 11);
|
||||||
|
@ -217,7 +217,7 @@ static void rmd256_transform(u32 *state, const __le32 *in)
|
||||||
ROUND(bbb, ccc, ddd, aaa, F1, KK4, in[14], 8);
|
ROUND(bbb, ccc, ddd, aaa, F1, KK4, in[14], 8);
|
||||||
|
|
||||||
/* Swap contents of "d" registers */
|
/* Swap contents of "d" registers */
|
||||||
tmp = dd; dd = ddd; ddd = tmp;
|
swap(dd, ddd);
|
||||||
|
|
||||||
/* combine results */
|
/* combine results */
|
||||||
state[0] += aa;
|
state[0] += aa;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user