From patchwork Thu Mar 22 17:10:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Watson X-Patchwork-Id: 10301941 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0139860216 for ; Thu, 22 Mar 2018 17:12:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0A2028814 for ; Thu, 22 Mar 2018 17:12:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEB782890B; Thu, 22 Mar 2018 17:12:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72E4B288DD for ; Thu, 22 Mar 2018 17:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751625AbeCVRLU (ORCPT ); Thu, 22 Mar 2018 13:11:20 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:42962 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752095AbeCVRLQ (ORCPT ); Thu, 22 Mar 2018 13:11:16 -0400 Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2MH0Hug027588; Thu, 22 Mar 2018 10:10:37 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=facebook; bh=MP09+HLPbQHRAWXz5NPLjtye1TddXEm7AvPFVIlwAIA=; b=ergKTCTGMbfN8Oh26sXZOtlPmxQWVGJDeoOtSz8gao/IPIYyL1rcYR65qmIe8ffDx1Su 7ZY7BEz6l7RrgR8rg0Uee3lGGnQUlj5mRfWI/SyuY9mgM+MMWY8iOpQMyWoNkDrew4RH caCn2MjdmY4QQ/Q1T0Y+r06lNv989AGU3Ng= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2gvg5pg3u3-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 22 Mar 2018 10:10:36 -0700 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.25) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 22 Mar 2018 13:10:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=MP09+HLPbQHRAWXz5NPLjtye1TddXEm7AvPFVIlwAIA=; b=IlXSJQIbzYKI4dIuJ9cevKKf4b9oc6G/GYyGzPY8r6wChk39igk63CKEnCcW7X3uIWC6XzBIqBVr4LR2O76cFqTYtJ9lfNeev3cGkhWAf9e0y4ZBaPTuCb/uJDTJMEorPYv4yZ4UQqmA3Kh2YlsxWlPxQowne1tK82pFw+qgpSo= Received: from localhost (2620:10d:c090:200::6:9ccb) by MWHPR15MB1136.namprd15.prod.outlook.com (2603:10b6:320:22::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Thu, 22 Mar 2018 17:10:30 +0000 Date: Thu, 22 Mar 2018 10:10:26 -0700 From: Dave Watson To: "David S. Miller" , Tom Herbert , Alexei Starovoitov , , , , CC: Atul Gupta , Vakul Garg , Hannes Frederic Sowa , Steffen Klassert , John Fastabend , Daniel Borkmann Subject: [PATCH v2 net-next 4/6] tls: Refactor variable names Message-ID: <20180322171026.GA67889@GeorgeHnsiPhone.dhcp.thefacebook.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0 (2016-04-01) X-Originating-IP: [2620:10d:c090:200::6:9ccb] X-ClientProxiedBy: SN2PR01CA0070.prod.exchangelabs.com (2603:10b6:800::38) To MWHPR15MB1136.namprd15.prod.outlook.com (2603:10b6:320:22::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a3841e56-2aab-4e7f-5488-08d59017d0cb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:MWHPR15MB1136; X-Microsoft-Exchange-Diagnostics: 1; MWHPR15MB1136; 3:WNyWySbIQ2FtDcTNuilwfBGqfjlgERgU4F1E66aMQ0Pbp3Ct4MvfPjfB5bkBfTkv4dbiFhAl+BlvmmkEcPcSw6umC6fHQIikvNIWK28b3QOBdty3/DF8OlmMGfA+Y/na3Oz5dxzpuID3MNki9UpfOiu2JTatRy44RR0lBzoYk72AtvcRjg60d3foVCOzO5XV0quPwFPQn4czGl6CVRBVlUPMPk4DwcqW/lUrdoD/FeDQ76BZz05ltCkVp0kXod4K; 25:gh9MPyrcUdq4xEXvQJNH/wr93XspQgC6czuC0X+XodKJkMPuSV5fSPwNM/hi1OjB5A+BldEAT54ZdLl1gbWJWDrA8/d3ol5zSkTlVqZxq6oBzTKUqEyMtpxbHjJL5erNcui3o0hjAkWniBpKB8EhlQwHNIdFDMBj+TK8Qkddpc2Rvl6v2NSVMu0iAEp/iXvv/GSrEapJ0tkutSMxXzXBRJwgEA0YcvEePu9uZ6+OEeVfIXc1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6Wv8ZNXvC1WCCtRWCpQBqx3/ClDpiaFxssFKqcJK+yULxvpZiaGtBdhOASA8mBEdd29zex1XtjNfWA/tJAqDdXjOjtsYySwNnaAI+ou4RL9aZAjvNG9fIj9KNQvneG3R6E0pLx/qR0QSCHFzNx2xgCpmFo6WCL4UAcs/jf54QZgpVN2q2K3iI3xUX5AK+46vIk0FNIO7TGJO/t9bK6k= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484)(266576461109395); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231221)(11241501184)(944501327)(52105095)(93006095)(93001095)(10201501046)(6041310)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:MWHPR15MB1136; BCL:0; PCL:0; RULEID:; SRVR:MWHPR15MB1136; X-Forefront-PRVS: 0619D53754 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(39860400002)(39380400002)(366004)(346002)(376002)(396003)(199004)(189003)(76506005)(16586007)(52116002)(81156014)(58126008)(9686003)(6496006)(110136005)(50466002)(52396003)(59450400001)(33896004)(86362001)(76176011)(53936002)(5660300001)(97736004)(446003)(6666003)(16526019)(6486002)(54906003)(46003)(7736002)(305945005)(386003)(8656006)(105586002)(47776003)(23726003)(7416002)(478600001)(8676002)(33656002)(8936002)(4326008)(316002)(6116002)(186003)(1076002)(106356001)(2906002)(68736007)(39060400002)(25786009)(11346002)(81166006)(18370500001); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR15MB1136; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR15MB1136; 23:tr1Txxgmj6LNlNFyX6GWA4xO9j0WiG9ruc4w58481?= =?us-ascii?Q?bXTlFRp3NxI8vbHe/zR0Y9V5Xi4vxukJXAPhqqgLr4pJi2so3U93UXlboLVj?= =?us-ascii?Q?qusgdpoH13xS1qhDwANj3VKJr4vVvEgWNud2Ykm1PdUeaEVICdD3ThQr6z6d?= =?us-ascii?Q?4okv8kbdKxNEfkNwUdPxff+GXBxWD7TmwasoY00reYnwgu5ZV/jsyuPNOmNL?= =?us-ascii?Q?ZspFjgDX3YsCbMKDNCe8aJbnk4tXiS9qWb5C2ADy5zVPOD679hLIgGk1bSvb?= =?us-ascii?Q?7mWhSibn1ZfJA9CqSdVWV6u6aDDOIrf9gekGFnqMddF6qqKP123AOLlx58RG?= =?us-ascii?Q?kQLAPntUkRT9zagQioF4WaU2gERAzHz2oe/nUK73T8V78N+Zr/DE09UnyxaJ?= =?us-ascii?Q?dXpqubn7Rm4EtFc8WfuyzcJT6PmbaDreDob+LVZ4CWrYVbnbtDPOf64MklPt?= =?us-ascii?Q?4VuJJotuITe6HF4r7GCtNZJYokzn7d2mb2GVjS1RinYlP2wHRCFNzX8IeQH1?= =?us-ascii?Q?DNKWaozAnxcwlBwll22M5+snRo1YtgYm1EzxV8MkfbGSfuyRr49zlZc2vYyo?= =?us-ascii?Q?/v1vblBCl94TwkwZmES7bZJGkglIcA0OzOY6YAEIY+FvcOsuaQmVblKhgh/L?= =?us-ascii?Q?QF8njUvFaUM7UC8bMAswFCH+uraL6lumfAwxqoNvc4xq49ShcrAbq89y/03N?= =?us-ascii?Q?MvM2TDjZE3fXPcgwJs8tRiupCrMafVnxprlIqH49Ii2dWONz4E8DV2ruWB3d?= =?us-ascii?Q?Keyo4DnUg2V5tF8O08NwbkLfMlpvQeGWh2mQBCsfuiUFLGaAYTdsXV20iaNO?= =?us-ascii?Q?/oYowpfHyxXZlfyC7SeX1Po5mhp+I1tKTgmrYhcZMRMaOyOQHt1oVn/+MMDC?= =?us-ascii?Q?agT4nhEshLRBzLSPw8mdkqKaDWwPoKWJUF/57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QUBBJ47c4hPglqxASr+nk=; 5:fbgcZHhhPPngGRHhA+bKpaB6a9VsuvFz2nNvlZ6ww04hzi5Vul7/3hrFi6brcBEDXY1GZcsOFZfweV6Uso9tojtOnBX3NSKpjRORpyYq8OrcJBwxvt21LnGJ+aSmAX4pzCS0+NbBYvEYt3bnDLsvuf/zQDRGwfGWEWE1Zx34cpM=; 24:TD9ENb7/f+EqR8vUSnUcVjAyjaS2UhCEdR2eg3sJBNXeGHy4kDBWLY9v1PkGpL3WGfRZhK2L5dN93PFrhHO2Xwkm5yJ8h2/0NFmJ3tyaga4=; 7:6tPCROx5tDdfo3IblDvQCGFz6r00forEH235XvwwpPSGAyHRQK7wbNCmQXelax3nIgGUWbsoy2sDDT2knGcMSTqFRW0n5h18LAI7D7/MbZeyypiS1iAWiuZg7U42Y0xI7IOMMcS3QYzuBMNBgIjJgmvc3iRmoK6YLER/d5n7t//EKjMjLtV1BGAu4NDx62ovzM17ipzX3oZPWy847i8/XDd1ga2VakRKDkDpllUfoaYj/fIu+co9q90YyRwid2pZ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR15MB1136; 20:hBxGFlpG8G8pU2OlqM/X+PeDCaxTy3g1ZY4DoFPkNMQd7n1VnmkeTI8O3JZzw8DgPP6Ar490Xq0nTjblp/owPWxZhS5v2W71n4FbXymI1tZGdZ92oqeV3ePZvDtQF5cNLEMp9cjEmukXjnu1FQS9p9wd1/0LDAton8AJgxXTLFs= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2018 17:10:30.2375 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3841e56-2aab-4e7f-5488-08d59017d0cb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1136 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-22_09:, , signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Several config variables are prefixed with tx, drop the prefix since these will be used for both tx and rx. Signed-off-by: Dave Watson --- include/net/tls.h | 2 +- net/tls/tls_main.c | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/net/tls.h b/include/net/tls.h index 6b44875..095b722 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -99,7 +99,7 @@ struct tls_context { void *priv_ctx; - u8 tx_conf:2; + u8 conf:2; struct cipher_context tx; diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c index c671560..c405bee 100644 --- a/net/tls/tls_main.c +++ b/net/tls/tls_main.c @@ -52,7 +52,7 @@ enum { }; enum { - TLS_BASE_TX, + TLS_BASE, TLS_SW_TX, TLS_NUM_CONFIG, }; @@ -65,7 +65,7 @@ static inline void update_sk_prot(struct sock *sk, struct tls_context *ctx) { int ip_ver = sk->sk_family == AF_INET6 ? TLSV6 : TLSV4; - sk->sk_prot = &tls_prots[ip_ver][ctx->tx_conf]; + sk->sk_prot = &tls_prots[ip_ver][ctx->conf]; } int wait_on_pending_writer(struct sock *sk, long *timeo) @@ -238,7 +238,7 @@ static void tls_sk_proto_close(struct sock *sk, long timeout) lock_sock(sk); sk_proto_close = ctx->sk_proto_close; - if (ctx->tx_conf == TLS_BASE_TX) { + if (ctx->conf == TLS_BASE) { kfree(ctx); goto skip_tx_cleanup; } @@ -262,7 +262,7 @@ static void tls_sk_proto_close(struct sock *sk, long timeout) kfree(ctx->tx.rec_seq); kfree(ctx->tx.iv); - if (ctx->tx_conf == TLS_SW_TX) + if (ctx->conf == TLS_SW_TX) tls_sw_free_tx_resources(sk); skip_tx_cleanup: @@ -371,7 +371,7 @@ static int do_tls_setsockopt_tx(struct sock *sk, char __user *optval, struct tls_crypto_info *crypto_info; struct tls_context *ctx = tls_get_ctx(sk); int rc = 0; - int tx_conf; + int conf; if (!optval || (optlen < sizeof(*crypto_info))) { rc = -EINVAL; @@ -418,11 +418,11 @@ static int do_tls_setsockopt_tx(struct sock *sk, char __user *optval, /* currently SW is default, we will have ethtool in future */ rc = tls_set_sw_offload(sk, ctx); - tx_conf = TLS_SW_TX; + conf = TLS_SW_TX; if (rc) goto err_crypto_info; - ctx->tx_conf = tx_conf; + ctx->conf = conf; update_sk_prot(sk, ctx); ctx->sk_write_space = sk->sk_write_space; sk->sk_write_space = tls_write_space; @@ -465,12 +465,12 @@ static int tls_setsockopt(struct sock *sk, int level, int optname, static void build_protos(struct proto *prot, struct proto *base) { - prot[TLS_BASE_TX] = *base; - prot[TLS_BASE_TX].setsockopt = tls_setsockopt; - prot[TLS_BASE_TX].getsockopt = tls_getsockopt; - prot[TLS_BASE_TX].close = tls_sk_proto_close; + prot[TLS_BASE] = *base; + prot[TLS_BASE].setsockopt = tls_setsockopt; + prot[TLS_BASE].getsockopt = tls_getsockopt; + prot[TLS_BASE].close = tls_sk_proto_close; - prot[TLS_SW_TX] = prot[TLS_BASE_TX]; + prot[TLS_SW_TX] = prot[TLS_BASE]; prot[TLS_SW_TX].sendmsg = tls_sw_sendmsg; prot[TLS_SW_TX].sendpage = tls_sw_sendpage; } @@ -513,7 +513,7 @@ static int tls_init(struct sock *sk) mutex_unlock(&tcpv6_prot_mutex); } - ctx->tx_conf = TLS_BASE_TX; + ctx->conf = TLS_BASE; update_sk_prot(sk, ctx); out: return rc;