It doesn't need a second input or a length parameter.
Signed-off-by: George Spelvin <[email protected]>
---
crypto/ansi_cprng.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c
index 6b844f13..4856c84c7 100644
--- a/crypto/ansi_cprng.c
+++ b/crypto/ansi_cprng.c
@@ -74,14 +74,12 @@ if (dbg)\
printk(format, ##args);\
} while (0)
-static void xor_vectors(unsigned char *in1, unsigned char *in2,
- unsigned char *out, unsigned int size)
+static void xor_block(unsigned char const *in, unsigned char *out)
{
int i;
- for (i = 0; i < size; i++)
- out[i] = in1[i] ^ in2[i];
-
+ for (i = 0; i < DEFAULT_BLK_SZ; i++)
+ out[i] ^= in[i];
}
/*
* Returns DEFAULT_BLK_SZ bytes of random data per call
@@ -123,7 +121,7 @@ static int _get_more_prng_bytes(struct prng_context *ctx,
int cont_test)
* in (no longer used) V until we have done the
* anti-repetition compare.
*/
- xor_vectors(tmp, ctx->V, ctx->V, DEFAULT_BLK_SZ);
+ xor_block(tmp, ctx->V);
hexdump("input stage 1: ", ctx->V, DEFAULT_BLK_SZ);
input = output = ctx->V;
break;
@@ -151,7 +149,7 @@ static int _get_more_prng_bytes(struct prng_context *ctx,
int cont_test)
* Lastly xor the random data with I
* and encrypt that to obtain a new secret vector V
*/
- xor_vectors(tmp, ctx->V, ctx->V, DEFAULT_BLK_SZ);
+ xor_block(tmp, ctx->V);
hexdump("input stage 2: ", ctx->V, DEFAULT_BLK_SZ);
input = output = ctx->V;
break;
--
2.1.3
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html