Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1329754 > unrolled thread

[PATCH 3.2 74/87] crypto: skcipher - Add crypto_skcipher_has_setkey

Started byBen Hutchings <ben@decadent.org.uk>
First post2016-02-09 01:20 +0100
Last post2016-02-09 01:20 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3.2 74/87] crypto: skcipher - Add crypto_skcipher_has_setkey Ben Hutchings <ben@decadent.org.uk> - 2016-02-09 01:20 +0100

#1329754 — [PATCH 3.2 74/87] crypto: skcipher - Add crypto_skcipher_has_setkey

FromBen Hutchings <ben@decadent.org.uk>
Date2016-02-09 01:20 +0100
Subject[PATCH 3.2 74/87] crypto: skcipher - Add crypto_skcipher_has_setkey
Message-ID<r04c9-4m5-7@gated-at.bofh.it>
3.2.77-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Herbert Xu <herbert@gondor.apana.org.au>

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>
---
--- a/crypto/ablkcipher.c
+++ b/crypto/ablkcipher.c
@@ -379,6 +379,7 @@ static int crypto_init_ablkcipher_ops(st
 	}
 	crt->base = __crypto_ablkcipher_cast(tfm);
 	crt->ivsize = alg->ivsize;
+	crt->has_setkey = alg->max_keysize;
 
 	return 0;
 }
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -346,6 +346,7 @@ struct ablkcipher_tfm {
 
 	unsigned int ivsize;
 	unsigned int reqsize;
+	bool has_setkey;
 };
 
 struct aead_tfm {
@@ -656,6 +657,13 @@ static inline int crypto_ablkcipher_setk
 	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;
+}
+
 static inline struct crypto_ablkcipher *crypto_ablkcipher_reqtfm(
 	struct ablkcipher_request *req)
 {

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web