From: Steffen Klassert <steffen.klassert@secunet.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: David Miller <davem@davemloft.net>, linux-crypto@vger.kernel.org
Subject: [RFC] [PATCH v2 3/4] xfrm: Add a netlink attribute for software crypto accelerators
Date: Fri, 24 Apr 2009 12:28:28 +0200 [thread overview]
Message-ID: <20090424102828.GE12680@secunet.com> (raw)
In-Reply-To: <20090424102451.GB12680@secunet.com>
This patch adds a netlink attribute for software crypto
accelerators like pcrypt. This makes it possible to choose a
crypto accelerator template by it's name from the userspace.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
include/linux/xfrm.h | 10 ++++++++++
include/net/xfrm.h | 3 +++
net/xfrm/xfrm_user.c | 8 ++++++++
3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 2d4ec15..e20b74e 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -240,6 +240,15 @@ struct xfrm_encap_tmpl {
xfrm_address_t encap_oa;
};
+struct xfrm_accl {
+ char name[64];
+ __u8 type;
+#define XFRM_ACCL_ENC 1
+#define XFRM_ACCL_AUTH 2
+#define XFRM_ACCL_COMP 4
+#define XFRM_ACCL_AEAD 8
+};
+
/* AEVENT flags */
enum xfrm_ae_ftype_t {
XFRM_AE_UNSPEC,
@@ -283,6 +292,7 @@ enum xfrm_attr_type_t {
XFRMA_MIGRATE,
XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */
XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */
+ XFRMA_CRYPTO_ACCL, /* struct xfrm_accl */
__XFRMA_MAX
#define XFRMA_MAX (__XFRMA_MAX - 1)
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 2e9f5c0..b574147 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -171,6 +171,9 @@ struct xfrm_state
/* Data for care-of address */
xfrm_address_t *coaddr;
+ /* Data for crypto accelerator */
+ struct xfrm_accl *accl;
+
/* IPComp needs an IPIP tunnel for handling uncompressed packets */
struct xfrm_state *tunnel;
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index b95a2d6..5272cbc 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -359,6 +359,13 @@ static struct xfrm_state *xfrm_state_construct(struct net *net,
goto error;
}
+ if (attrs[XFRMA_CRYPTO_ACCL]) {
+ x->accl = kmemdup(nla_data(attrs[XFRMA_CRYPTO_ACCL]),
+ sizeof(*x->accl), GFP_KERNEL);
+ if (x->accl == NULL)
+ goto error;
+ }
+
err = xfrm_init_state(x);
if (err)
goto error;
@@ -1958,6 +1965,7 @@ static const struct nla_policy xfrma_policy[XFRMA_MAX+1] = {
[XFRMA_POLICY_TYPE] = { .len = sizeof(struct xfrm_userpolicy_type)},
[XFRMA_MIGRATE] = { .len = sizeof(struct xfrm_user_migrate) },
[XFRMA_KMADDRESS] = { .len = sizeof(struct xfrm_user_kmaddress) },
+ [XFRMA_CRYPTO_ACCL] = { .len = sizeof(struct xfrm_accl) },
};
static struct xfrm_link {
--
1.5.4.2
next prev parent reply other threads:[~2009-04-24 10:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-24 10:24 [RFC] [PATCH v2 0/4] Parallel IPsec Steffen Klassert
2009-04-24 10:26 ` [RFC] [PATCH v2 1/4] padata: generic interface for parallel processing Steffen Klassert
2009-04-27 8:56 ` Herbert Xu
2009-04-24 10:27 ` [RFC] [PATCH v2 2/4] pcrypt: Add pcrypt crypto parallelization engine Steffen Klassert
2009-04-27 8:56 ` Herbert Xu
2009-04-28 6:23 ` Steffen Klassert
2009-04-28 6:31 ` Herbert Xu
2009-04-28 6:41 ` Steffen Klassert
2009-04-24 10:28 ` Steffen Klassert [this message]
2009-04-27 8:53 ` [RFC] [PATCH v2 3/4] xfrm: Add a netlink attribute for software crypto accelerators Herbert Xu
2009-04-28 10:11 ` Steffen Klassert
2009-04-24 10:29 ` [RFC] [PATCH v2 4/4] esp: Use pcrypt if it is selected as software crypto accelerator Steffen Klassert
2009-04-25 8:38 ` [RFC] [PATCH v2 0/4] Parallel IPsec Evgeniy Polyakov
2009-04-25 9:21 ` Herbert Xu
2009-04-25 10:10 ` Evgeniy Polyakov
2009-04-25 10:56 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090424102828.GE12680@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.