From patchwork Sun Mar 6 01:20:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tadeusz Struk X-Patchwork-Id: 8512071 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 714029F314 for ; Sun, 6 Mar 2016 01:25:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9BE01201EC for ; Sun, 6 Mar 2016 01:25:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A0AD62020F for ; Sun, 6 Mar 2016 01:25:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751208AbcCFBZb (ORCPT ); Sat, 5 Mar 2016 20:25:31 -0500 Received: from mga01.intel.com ([192.55.52.88]:25121 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750801AbcCFBZ1 (ORCPT ); Sat, 5 Mar 2016 20:25:27 -0500 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 05 Mar 2016 17:25:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,543,1449561600"; d="scan'208";a="758829321" Received: from talam-mobl5.amr.corp.intel.com (HELO [127.0.1.1]) ([10.254.24.76]) by orsmga003.jf.intel.com with ESMTP; 05 Mar 2016 17:25:26 -0800 Subject: [PATCH 2/3] crypto: af_alg - add AEAD operation type From: Tadeusz Struk To: herbert@gondor.apana.org.au Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net, tadeusz.struk@intel.com Date: Sat, 05 Mar 2016 17:20:55 -0800 Message-ID: <20160306012055.6369.73799.stgit@tstruk-mobl1> In-Reply-To: <20160306012044.6369.63924.stgit@tstruk-mobl1> References: <20160306012044.6369.63924.stgit@tstruk-mobl1> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- crypto/af_alg.c | 6 ++++++ include/crypto/if_alg.h | 1 + include/uapi/linux/if_alg.h | 4 ++++ 3 files changed, 11 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 */