[linux] 03/04: crypto: {blk,giv}cipher: Set has_setkey (avoids regressing cryptsetup; see #815480)

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Sun Mar 6 22:44:32 UTC 2016


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch wheezy
in repository linux.

commit 4b40769da56d7befc9b3acb20b60778c7cf595f5
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Sun Mar 6 21:27:36 2016 +0000

    crypto: {blk,giv}cipher: Set has_setkey (avoids regressing cryptsetup; see #815480)
---
 debian/changelog                                   |  2 ++
 .../all/crypto-blk-giv-cipher-set-has_setkey.patch | 32 +++++++++++++++++++++
 .../debian/crypto-fix-abi-change-in-3.2.77.patch   | 33 +++++++++++++++++++---
 debian/patches/series                              |  1 +
 4 files changed, 64 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index f1f596f..b5f8aed 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -310,6 +310,8 @@ linux (3.2.78-1) UNRELEASED; urgency=medium
     - rtmutex: Have slowfn of rt_mutex_timed_fastlock() use
   * Revert "crypto: algif_skcipher - Do not dereference ctx without socket lock"
     (regression in 3.2.78)
+  * crypto: {blk,giv}cipher: Set has_setkey (avoids regressing cryptsetup;
+    see #815480)
 
  -- Ben Hutchings <ben at decadent.org.uk>  Wed, 02 Mar 2016 15:02:45 +0000
 
diff --git a/debian/patches/bugfix/all/crypto-blk-giv-cipher-set-has_setkey.patch b/debian/patches/bugfix/all/crypto-blk-giv-cipher-set-has_setkey.patch
new file mode 100644
index 0000000..2854d88
--- /dev/null
+++ b/debian/patches/bugfix/all/crypto-blk-giv-cipher-set-has_setkey.patch
@@ -0,0 +1,32 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Sun, 06 Mar 2016 19:52:46 +0000
+Subject: crypto: {blk,giv}cipher: Set has_setkey
+
+Commit a1383cd86a06 ("crypto: skcipher - Add crypto_skcipher_has_setkey")
+was incorrectly backported to the 3.2.y and 3.16.y stable branches.
+We need to set ablkcipher_tfm::has_setkey in the
+crypto_init_blkcipher_ops_async() and crypto_init_givcipher_ops()
+functions as well as crypto_init_ablkcipher_ops().
+
+Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
+---
+--- a/crypto/ablkcipher.c
++++ b/crypto/ablkcipher.c
+@@ -461,6 +461,7 @@ static int crypto_init_givcipher_ops(str
+ 	crt->givdecrypt = alg->givdecrypt ?: no_givdecrypt;
+ 	crt->base = __crypto_ablkcipher_cast(tfm);
+ 	crt->ivsize = alg->ivsize;
++	crt->has_setkey = alg->max_keysize;
+ 
+ 	return 0;
+ }
+--- a/crypto/blkcipher.c
++++ b/crypto/blkcipher.c
+@@ -458,6 +458,7 @@ static int crypto_init_blkcipher_ops_asy
+ 	}
+ 	crt->base = __crypto_ablkcipher_cast(tfm);
+ 	crt->ivsize = alg->ivsize;
++	crt->has_setkey = alg->max_keysize;
+ 
+ 	return 0;
+ }
diff --git a/debian/patches/debian/crypto-fix-abi-change-in-3.2.77.patch b/debian/patches/debian/crypto-fix-abi-change-in-3.2.77.patch
index 6f8907c..2919b3b 100644
--- a/debian/patches/debian/crypto-fix-abi-change-in-3.2.77.patch
+++ b/debian/patches/debian/crypto-fix-abi-change-in-3.2.77.patch
@@ -22,6 +22,14 @@ crypto_{ahash,ablkcipher}_has_setkey() functions.
  
  	return 0;
  }
+@@ -461,7 +460,6 @@ static int crypto_init_givcipher_ops(str
+ 	crt->givdecrypt = alg->givdecrypt ?: no_givdecrypt;
+ 	crt->base = __crypto_ablkcipher_cast(tfm);
+ 	crt->ivsize = alg->ivsize;
+-	crt->has_setkey = alg->max_keysize;
+ 
+ 	return 0;
+ }
 --- a/crypto/ahash.c
 +++ b/crypto/ahash.c
 @@ -369,7 +369,6 @@ static int crypto_ahash_init_tfm(struct
@@ -44,6 +52,16 @@ crypto_{ahash,ablkcipher}_has_setkey() functions.
  	if (alg->export)
  		hash->export = alg->export;
  	if (alg->import)
+--- a/crypto/blkcipher.c
++++ b/crypto/blkcipher.c
+@@ -458,7 +458,6 @@ static int crypto_init_blkcipher_ops_asy
+ 	}
+ 	crt->base = __crypto_ablkcipher_cast(tfm);
+ 	crt->ivsize = alg->ivsize;
+-	crt->has_setkey = alg->max_keysize;
+ 
+ 	return 0;
+ }
 --- a/crypto/shash.c
 +++ b/crypto/shash.c
 @@ -24,11 +24,12 @@
@@ -114,21 +132,28 @@ crypto_{ahash,ablkcipher}_has_setkey() functions.
  };
  
  struct aead_tfm {
-@@ -659,9 +658,18 @@ static inline int crypto_ablkcipher_setk
+@@ -659,9 +658,25 @@ static inline int crypto_ablkcipher_setk
  
  static inline bool crypto_ablkcipher_has_setkey(struct crypto_ablkcipher *tfm)
  {
 -	struct ablkcipher_tfm *crt = crypto_ablkcipher_crt(tfm);
 +	struct crypto_tfm *basetfm = crypto_ablkcipher_tfm(tfm);
- 
--	return crt->has_setkey;
++
 +	switch (crypto_tfm_alg_type(basetfm)) {
-+	case CRYPTO_ALG_TYPE_ABLKCIPHER: {
++	case CRYPTO_ALG_TYPE_ABLKCIPHER:
++	case CRYPTO_ALG_TYPE_GIVCIPHER: {
 +		struct ablkcipher_alg *alg = &basetfm->__crt_alg->cra_ablkcipher;
 +
 +		return alg->max_keysize != 0;
 +	}
 +
++	case CRYPTO_ALG_TYPE_BLKCIPHER: {
++		struct blkcipher_alg *alg = &basetfm->__crt_alg->cra_blkcipher;
++
++		return alg->max_keysize != 0;
++	}
+ 
+-	return crt->has_setkey;
 +	default:
 +		return false;
 +	}
diff --git a/debian/patches/series b/debian/patches/series
index f16aeff..2c01ecd 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1167,5 +1167,6 @@ bugfix/all/aufs-tiny-extract-a-new-func-xino_fwrite_wkq.patch
 bugfix/all/aufs-for-4.3-xino-handles-eintr-from-the-dying-proce.patch
 bugfix/all/af_unix-guard-against-other-sk-in-unix_dgram_sendmsg.patch
 debian/hrtimer-fix-abi-change-in-3.2.78.patch
+bugfix/all/crypto-blk-giv-cipher-set-has_setkey.patch
 debian/crypto-fix-abi-change-in-3.2.77.patch
 bugfix/all/revert-crypto-algif_skcipher-do-not-dereference-ctx-.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list