lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 15 Jul 2008 11:31:40 -0400
From:	Neil Horman <nhorman@...driver.com>
To:	linux-kernel@...r.kernel.org
Cc:	akpm@...ux-foundation.org, herbert@...dor.apana.org.au,
	mingo@...e.hu, nhorman@...driver.com
Subject: [cyrpto]: fix bad ERRPTR check in prng

Patch to correct a bad return code check from crypto_alloc_blkcipher
Also correct Kconfig to pull in the needed ciphers to make prng work when its
enabled

Signed-off-by: Neil Horman <nhorman@...driver.com


 Kconfig |    3 +++
 prng.c  |    8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)


diff --git a/crypto/Kconfig b/crypto/Kconfig
index ea50357..91e0d07 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -670,6 +670,9 @@ comment "Random Number Generation"
 
 config CRYPTO_PRNG
 	tristate "Pseudo Random Number Generation for Cryptographic modules"
+	select CRYPTO_AES
+	select CRYPTO_CTR
+	depends on CRYPTO
 	help
 	  This option enables the generic pseudo random number generator
 	  for cryptographic modules.  Uses the Algorithm specified in
diff --git a/crypto/prng.c b/crypto/prng.c
index 11b9306..b28f89a 100644
--- a/crypto/prng.c
+++ b/crypto/prng.c
@@ -300,6 +300,9 @@ struct prng_context *alloc_prng_context(void)
 	struct prng_context *ctx = kzalloc(sizeof(struct prng_context),
 					GFP_KERNEL);
 
+	if (!ctx)
+		return NULL;
+
 	spin_lock_init(&ctx->prng_lock);
 
 	if (reset_prng_context(ctx, NULL, NULL, NULL, NULL)) {
@@ -357,9 +360,10 @@ int reset_prng_context(struct prng_context *ctx,
 		crypto_free_blkcipher(ctx->tfm);
 
 	ctx->tfm = crypto_alloc_blkcipher("rfc3686(ctr(aes))", 0, 0);
-	if (!ctx->tfm) {
+	if (IS_ERR(ctx->tfm)) {
 		dbgprint(KERN_CRIT "Failed to alloc tfm for context %p\n",
-			ctx->tfm);
+			ctx);
+		ctx->tfm = NULL;
 		goto out;
 	}
 

-- 
/****************************************************
 * Neil Horman <nhorman@...driver.com>
 * Software Engineer, Red Hat
 ****************************************************/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ