diff mbox

[4.2.y-ckt,stable] Patch "crypto: skcipher - Add crypto_skcipher_has_setkey" has been added to the 4.2.y-ckt tree

Message ID 1458838293-26814-1-git-send-email-kamal@canonical.com
State New
Headers show

Commit Message

Kamal Mostafa March 24, 2016, 4:51 p.m. UTC
This is a note to let you know that I have just added a patch titled

    crypto: skcipher - Add crypto_skcipher_has_setkey

to the linux-4.2.y-queue branch of the 4.2.y-ckt extended stable tree 
which can be found at:

    http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-4.2.y-queue

This patch is scheduled to be released in version 4.2.8-ckt7.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 4.2.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

---8<------------------------------------------------------------

From ce16553eb5b0d4157f7c189acb11db7d5c3736a8 Mon Sep 17 00:00:00 2001
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Mon, 11 Jan 2016 21:26:50 +0800
Subject: crypto: skcipher - Add crypto_skcipher_has_setkey

commit a1383cd86a062fc798899ab20f0ec2116cce39cb upstream.

This patch adds a way for skcipher users to determine whether a key
is required by a transform.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[bwh: Backported to 3.2: add to ablkcipher API instead]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 crypto/ablkcipher.c    | 1 +
 include/linux/crypto.h | 8 ++++++++
 2 files changed, 9 insertions(+)

--
2.7.0
diff mbox

Patch

diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c
index e5b5721..71b4b2e 100644
--- a/crypto/ablkcipher.c
+++ b/crypto/ablkcipher.c
@@ -377,6 +377,7 @@  static int crypto_init_ablkcipher_ops(struct crypto_tfm *tfm, u32 type,
 	}
 	crt->base = __crypto_ablkcipher_cast(tfm);
 	crt->ivsize = alg->ivsize;
+	crt->has_setkey = alg->max_keysize;

 	return 0;
 }
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 81ef938..ab5f912 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -552,6 +552,7 @@  struct ablkcipher_tfm {

 	unsigned int ivsize;
 	unsigned int reqsize;
+	bool has_setkey;
 };

 struct blkcipher_tfm {
@@ -922,6 +923,13 @@  static inline int crypto_ablkcipher_setkey(struct crypto_ablkcipher *tfm,
 	return crt->setkey(crt->base, key, keylen);
 }

+static inline bool crypto_ablkcipher_has_setkey(struct crypto_ablkcipher *tfm)
+{
+	struct ablkcipher_tfm *crt = crypto_ablkcipher_crt(tfm);
+
+	return crt->has_setkey;
+}
+
 /**
  * crypto_ablkcipher_reqtfm() - obtain cipher handle from request
  * @req: ablkcipher_request out of which the cipher handle is to be obtained