linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tadeusz Struk <tadeusz.struk@intel.com>
To: herbert@gondor.apana.org.au
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	davem@davemloft.net, tadeusz.struk@intel.com
Subject: [PATCH 2/3] crypto: af_alg - add AEAD operation type
Date: Sat, 05 Mar 2016 17:20:55 -0800	[thread overview]
Message-ID: <20160306012055.6369.73799.stgit@tstruk-mobl1> (raw)
In-Reply-To: <20160306012044.6369.63924.stgit@tstruk-mobl1>

We need to allow the user to set the authentication type.
This adds a new operation that sets IPSec or TLS authentication mode.

Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
---
 crypto/af_alg.c             |    6 ++++++
 include/crypto/if_alg.h     |    1 +
 include/uapi/linux/if_alg.h |    4 ++++
 3 files changed, 11 insertions(+)

diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index f5e18c2..cc5f2b0 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -464,6 +464,12 @@ int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con)
 			con->op = *(u32 *)CMSG_DATA(cmsg);
 			break;
 
+		case ALG_SET_AEAD_TYPE:
+			if (cmsg->cmsg_len < CMSG_LEN(sizeof(u32)))
+				return -EINVAL;
+			con->op_type = *(u32 *)CMSG_DATA(cmsg);
+			break;
+
 		case ALG_SET_AEAD_ASSOCLEN:
 			if (cmsg->cmsg_len < CMSG_LEN(sizeof(u32)))
 				return -EINVAL;
diff --git a/include/crypto/if_alg.h b/include/crypto/if_alg.h
index a2bfd78..d76ea0c 100644
--- a/include/crypto/if_alg.h
+++ b/include/crypto/if_alg.h
@@ -45,6 +45,7 @@ struct af_alg_completion {
 struct af_alg_control {
 	struct af_alg_iv *iv;
 	int op;
+	int op_type;
 	unsigned int aead_assoclen;
 };
 
diff --git a/include/uapi/linux/if_alg.h b/include/uapi/linux/if_alg.h
index f2acd2f..cef00de 100644
--- a/include/uapi/linux/if_alg.h
+++ b/include/uapi/linux/if_alg.h
@@ -34,9 +34,13 @@ struct af_alg_iv {
 #define ALG_SET_OP			3
 #define ALG_SET_AEAD_ASSOCLEN		4
 #define ALG_SET_AEAD_AUTHSIZE		5
+#define ALG_SET_AEAD_TYPE		6
 
 /* Operations */
 #define ALG_OP_DECRYPT			0
 #define ALG_OP_ENCRYPT			1
 
+/* AEAD operation type */
+#define ALG_AEAD_IPSEC			0 /* First encrypt then authenticate */
+#define ALG_AEAD_TLS			1 /* First authenticate then encrypt */
 #endif	/* _LINUX_IF_ALG_H */

  parent reply	other threads:[~2016-03-06  1:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-06  1:20 [PATCH 0/3] crypto: af_alg - add TLS type encryption Tadeusz Struk
2016-03-06  1:20 ` [PATCH 1/3] crypto: authenc " Tadeusz Struk
2016-03-07  9:05   ` Cristian Stoica
2016-03-07 14:31     ` Tadeusz Struk
2016-03-08  8:20       ` Cristian Stoica
2016-03-08 16:49         ` Tadeusz Struk
2016-03-06  1:20 ` Tadeusz Struk [this message]
2016-03-06  1:21 ` [PATCH 3/3] crypto: algif_aead - modify algif aead interface to work with encauth Tadeusz Struk
2016-04-05 11:29 ` [PATCH 0/3] crypto: af_alg - add TLS type encryption Herbert Xu
2016-04-06 17:56   ` Tadeusz Struk
2016-04-08  2:52     ` Herbert Xu
2016-04-08  2:58       ` Tom Herbert
2016-04-12 11:13         ` Fridolin Pokorny
2016-04-13 22:46           ` Tadeusz Struk
2016-04-14  6:47             ` Nikos Mavrogiannopoulos

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=20160306012055.6369.73799.stgit@tstruk-mobl1 \
    --to=tadeusz.struk@intel.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).