[PATCH 3/5] Add "alg_name" operation to af_alg_type.

Miloslav Trmač mitr at redhat.com
Wed Nov 24 17:05:53 UTC 2010


Signed-off-by: Miloslav Trmač <mitr at redhat.com>
---
 crypto/algif_hash.c     |    6 ++++++
 crypto/algif_skcipher.c |    6 ++++++
 include/crypto/if_alg.h |    1 +
 3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
index f08a42c..3a61e9d 100644
--- a/crypto/algif_hash.c
+++ b/crypto/algif_hash.c
@@ -243,6 +243,11 @@ static void hash_release(void *private)
 	crypto_free_ahash(private);
 }
 
+static const char *hash_alg_name(void *private)
+{
+	return crypto_tfm_alg_name(crypto_ahash_tfm(private));
+}
+
 static int hash_setkey(void *private, const u8 *key, unsigned int keylen)
 {
 	return crypto_ahash_setkey(private, key, keylen);
@@ -296,6 +301,7 @@ static int hash_accept_parent(void *private, struct sock *sk)
 static const struct af_alg_type algif_type_hash = {
 	.bind		=	hash_bind,
 	.release	=	hash_release,
+	.alg_name	=	hash_alg_name,
 	.setkey		=	hash_setkey,
 	.accept		=	hash_accept_parent,
 	.ops		=	&algif_hash_ops,
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index 4069460..e14c8be 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -561,6 +561,11 @@ static void skcipher_release(void *private)
 	crypto_free_ablkcipher(private);
 }
 
+static const char *skcipher_alg_name(void *private)
+{
+	return crypto_tfm_alg_name(crypto_ablkcipher_tfm(private));
+}
+
 static int skcipher_setkey(void *private, const u8 *key, unsigned int keylen)
 {
 	return crypto_ablkcipher_setkey(private, key, keylen);
@@ -619,6 +624,7 @@ static int skcipher_accept_parent(void *private, struct sock *sk)
 static const struct af_alg_type algif_type_skcipher = {
 	.bind		=	skcipher_bind,
 	.release	=	skcipher_release,
+	.alg_name	=	skcipher_alg_name,
 	.setkey		=	skcipher_setkey,
 	.accept		=	skcipher_accept_parent,
 	.ops		=	&algif_skcipher_ops,
diff --git a/include/crypto/if_alg.h b/include/crypto/if_alg.h
index 336b9f2..092c599 100644
--- a/include/crypto/if_alg.h
+++ b/include/crypto/if_alg.h
@@ -49,6 +49,7 @@ struct af_alg_control {
 struct af_alg_type {
 	void *(*bind)(const char *name, u32 type, u32 mask);
 	void (*release)(void *private);
+	const char *(*alg_name)(void *private);
 	int (*setkey)(void *private, const u8 *key, unsigned int keylen);
 	int (*accept)(void *private, struct sock *sk);
 
-- 
1.7.3.2




More information about the Linux-audit mailing list