summaryrefslogtreecommitdiffstats
path: root/crypto/ansi_cprng.c
diff options
context:
space:
mode:
authorStephan Mueller <smueller@chronox.de>2015-03-06 08:26:31 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2015-03-09 21:06:18 +1100
commitcde001e4c3c3625c60b68a83eb1f1c2572dee07a (patch)
tree6b0a069f9fdfa36c3741164564ea163f9cb69820 /crypto/ansi_cprng.c
parent4842234f83bfce83c93f84f5972a956ef2c87805 (diff)
downloadlinux-stable-cde001e4c3c3625c60b68a83eb1f1c2572dee07a.tar.gz
linux-stable-cde001e4c3c3625c60b68a83eb1f1c2572dee07a.tar.bz2
linux-stable-cde001e4c3c3625c60b68a83eb1f1c2572dee07a.zip
crypto: rng - RNGs must return 0 in success case
Change the RNGs to always return 0 in success case. This patch ensures that seqiv.c works with RNGs other than krng. seqiv expects that any return code other than 0 is an error. Without the patch, rfc4106(gcm(aes)) will not work when using a DRBG or an ANSI X9.31 RNG. Signed-off-by: Stephan Mueller <smueller@chronox.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/ansi_cprng.c')
-rw-r--r--crypto/ansi_cprng.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c
index 6f5bebc9bf01..765fe7609348 100644
--- a/crypto/ansi_cprng.c
+++ b/crypto/ansi_cprng.c
@@ -210,7 +210,11 @@ static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx,
byte_count = DEFAULT_BLK_SZ;
}
- err = byte_count;
+ /*
+ * Return 0 in case of success as mandated by the kernel
+ * crypto API interface definition.
+ */
+ err = 0;
dbgprint(KERN_CRIT "getting %d random bytes for context %p\n",
byte_count, ctx);