Skip to contentSkip to conversation

Patch "crypto: ahash - ensure statesize is non-zero" has been added to the 4.1-stable tree

PATCH [email protected] 1 participant 1 message Oct 23, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

crypto: ahash - ensure statesize is non-zero

to the 4.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
crypto-ahash-ensure-statesize-is-non-zero.patch
and it can be found in the queue-4.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 8996eafdcbad149ac0f772fb1649fbb75c482a6a Mon Sep 17 00:00:00 2001

From: Russell King <[email protected]>
Date: Fri, 9 Oct 2015 20:43:33 +0100
Subject: crypto: ahash - ensure statesize is non-zero

From: Russell King <[email protected]>

commit 8996eafdcbad149ac0f772fb1649fbb75c482a6a upstream.

Unlike shash algorithms, ahash drivers must implement export and import as their descriptors may contain hardware state and cannot be exported as is. Unfortunately some ahash drivers did not provide them and end up causing crashes with algif_hash.

This patch adds a check to prevent these drivers from registering ahash algorithms until they are fixed.

---
 crypto/ahash.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
crypto/ahash.c +2 -1
@@ -544,7 +544,8 @@ static int ahash_prepare_alg(struct ahas
 	struct crypto_alg *base = &alg->halg.base;
 
 	if (alg->halg.digestsize > PAGE_SIZE / 8 ||
-	    alg->halg.statesize > PAGE_SIZE / 8)
+	    alg->halg.statesize > PAGE_SIZE / 8 ||
+	    alg->halg.statesize == 0)
 		return -EINVAL;
 
 	base->cra_type = &crypto_ahash_type;

Patches currently in stable-queue which might be from [email protected] are

queue-4.1/crypto-ahash-ensure-statesize-is-non-zero.patch