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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1410766234-1634-6-git-send-email-behanw@converseincode.com>
Date:	Mon, 15 Sep 2014 00:30:27 -0700
From:	behanw@...verseincode.com
To:	agk@...hat.com, clm@...com, davem@...emloft.net,
	dm-devel@...hat.com, fabf@...net.be, herbert@...dor.apana.org.au,
	jbacik@...com, snitzer@...hat.com, tadeusz.struk@...el.com
Cc:	akpm@...ux-foundation.org, bruce.w.allan@...el.com,
	d.kasatkin@...sung.com, james.l.morris@...cle.com,
	john.griffin@...el.com, linux-btrfs@...r.kernel.org,
	linux-crypto@...r.kernel.org,
	linux-ima-devel@...ts.sourceforge.net,
	linux-ima-user@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
	linux-raid@...r.kernel.org, linux-security-module@...r.kernel.org,
	neilb@...e.de, qat-linux@...el.com, serge@...lyn.com,
	thomas.lendacky@....com, zohar@...ux.vnet.ibm.com,
	torvalds@...ux-foundation.org,
	Behan Webster <behanw@...verseincode.com>
Subject: [PATCH v3 05/12] crypto: LLVMLinux: Remove VLAIS from crypto/n2_core.c

From: Behan Webster <behanw@...verseincode.com>

Replaced the use of a Variable Length Array In Struct (VLAIS) with a C99
compliant equivalent. This patch allocates the appropriate amount of memory
using a char array using the SHASH_DESC_ON_STACK macro.

The new code can be compiled with both gcc and clang.

Signed-off-by: Behan Webster <behanw@...verseincode.com>
Reviewed-by: Mark Charlebois <charlebm@...il.com>
Reviewed-by: Jan-Simon Möller <dl9pf@....de>
---
 drivers/crypto/n2_core.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c
index 7263c10..f8e3207 100644
--- a/drivers/crypto/n2_core.c
+++ b/drivers/crypto/n2_core.c
@@ -445,10 +445,7 @@ static int n2_hmac_async_setkey(struct crypto_ahash *tfm, const u8 *key,
 	struct n2_hmac_ctx *ctx = crypto_ahash_ctx(tfm);
 	struct crypto_shash *child_shash = ctx->child_shash;
 	struct crypto_ahash *fallback_tfm;
-	struct {
-		struct shash_desc shash;
-		char ctx[crypto_shash_descsize(child_shash)];
-	} desc;
+	SHASH_DESC_ON_STACK(shash, child_shash);
 	int err, bs, ds;
 
 	fallback_tfm = ctx->base.fallback_tfm;
@@ -456,15 +453,15 @@ static int n2_hmac_async_setkey(struct crypto_ahash *tfm, const u8 *key,
 	if (err)
 		return err;
 
-	desc.shash.tfm = child_shash;
-	desc.shash.flags = crypto_ahash_get_flags(tfm) &
+	shash->tfm = child_shash;
+	shash->flags = crypto_ahash_get_flags(tfm) &
 		CRYPTO_TFM_REQ_MAY_SLEEP;
 
 	bs = crypto_shash_blocksize(child_shash);
 	ds = crypto_shash_digestsize(child_shash);
 	BUG_ON(ds > N2_HASH_KEY_MAX);
 	if (keylen > bs) {
-		err = crypto_shash_digest(&desc.shash, key, keylen,
+		err = crypto_shash_digest(shash, key, keylen,
 					  ctx->hash_key);
 		if (err)
 			return err;
-- 
1.9.1

--
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