Add a few const annotations, use unsigned bytes consistently, and
make do_cont_test a bool.

Signed-off-by: George Spelvin <li...@horizon.com>
---
 crypto/ansi_cprng.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c
index dff27a7a..6723a561 100644
--- a/crypto/ansi_cprng.c
+++ b/crypto/ansi_cprng.c
@@ -82,7 +82,7 @@ static void xor_block(unsigned char const *in, unsigned char 
*out)
  * Returns DEFAULT_BLK_SZ bytes of random data per call
  * returns 0 if generation succeeded, <0 if something went wrong
  */
-static int _get_more_prng_bytes(struct prng_context *ctx, int cont_test)
+static int _get_more_prng_bytes(struct prng_context *ctx, bool cont_test)
 {
        int i;
        unsigned char tmp[DEFAULT_BLK_SZ];
@@ -176,8 +176,8 @@ static int _get_more_prng_bytes(struct prng_context *ctx, 
int cont_test)
 }
 
 /* Our exported functions */
-static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx,
-                               int do_cont_test)
+static int get_prng_bytes(unsigned char *buf, unsigned int nbytes,
+                               struct prng_context *ctx, bool do_cont_test)
 {
        unsigned char *ptr = buf;
        unsigned int byte_count = (unsigned int)nbytes;
@@ -312,7 +312,7 @@ static int cprng_get_random(struct crypto_rng *tfm, u8 
*rdata,
 {
        struct prng_context *prng = crypto_rng_ctx(tfm);
 
-       return get_prng_bytes(rdata, dlen, prng, 0);
+       return get_prng_bytes(rdata, dlen, prng, false);
 }
 
 /*
@@ -324,8 +324,8 @@ static int cprng_get_random(struct crypto_rng *tfm, u8 
*rdata,
 static int cprng_reset(struct crypto_rng *tfm, u8 *seed, unsigned int slen)
 {
        struct prng_context *prng = crypto_rng_ctx(tfm);
-       u8 *key = seed + DEFAULT_BLK_SZ;
-       u8 *dt = NULL;
+       u8 const *key = seed + DEFAULT_BLK_SZ;
+       u8 const *dt = NULL;
 
        if (slen < DEFAULT_PRNG_KSZ + DEFAULT_BLK_SZ)
                return -EINVAL;
@@ -346,13 +346,13 @@ static int fips_cprng_get_random(struct crypto_rng *tfm, 
u8 *rdata,
 {
        struct prng_context *prng = crypto_rng_ctx(tfm);
 
-       return get_prng_bytes(rdata, dlen, prng, 1);
+       return get_prng_bytes(rdata, dlen, prng, true);
 }
 
 static int fips_cprng_reset(struct crypto_rng *tfm, u8 *seed, unsigned int 
slen)
 {
        u8 rdata[DEFAULT_BLK_SZ];
-       u8 *key = seed + DEFAULT_BLK_SZ;
+       u8 const *key = seed + DEFAULT_BLK_SZ;
        int rc;
 
        struct prng_context *prng = crypto_rng_ctx(tfm);
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to