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


Groups > linux.kernel > #1351019

[PATCH 2/3] crypto: af_alg - add AEAD operation type

From Tadeusz Struk <tadeusz.struk@intel.com>
Newsgroups linux.kernel
Subject [PATCH 2/3] crypto: af_alg - add AEAD operation type
Date 2016-03-06 02:30 +0100
Message-ID <r9vG9-6nu-3@gated-at.bofh.it> (permalink)
References <r9vG9-6nu-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 */

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] crypto: af_alg - add TLS type encryption Tadeusz Struk <tadeusz.struk@intel.com> - 2016-03-06 02:30 +0100
  [PATCH 2/3] crypto: af_alg - add AEAD operation type Tadeusz Struk <tadeusz.struk@intel.com> - 2016-03-06 02:30 +0100
  [PATCH 3/3] crypto: algif_aead - modify algif aead interface to  work with encauth Tadeusz Struk <tadeusz.struk@intel.com> - 2016-03-06 02:30 +0100
  [PATCH 1/3] crypto: authenc - add TLS type encryption Tadeusz Struk <tadeusz.struk@intel.com> - 2016-03-06 02:30 +0100
    Re: [PATCH 1/3] crypto: authenc - add TLS type encryption Cristian Stoica <cristian.stoica@nxp.com> - 2016-03-07 12:40 +0100
      Re: [PATCH 1/3] crypto: authenc - add TLS type encryption Tadeusz Struk <tadeusz.struk@intel.com> - 2016-03-07 15:40 +0100
        Re: [PATCH 1/3] crypto: authenc - add TLS type encryption Cristian Stoica <cristian.stoica@nxp.com> - 2016-03-08 09:40 +0100
          Re: [PATCH 1/3] crypto: authenc - add TLS type encryption Tadeusz Struk <tadeusz.struk@intel.com> - 2016-03-08 18:00 +0100

csiph-web