From patchwork Tue Mar 20 17:54:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Watson X-Patchwork-Id: 10297685 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 0600760386 for ; Tue, 20 Mar 2018 17:56:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7110283A6 for ; Tue, 20 Mar 2018 17:56:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB351288B9; Tue, 20 Mar 2018 17:56:17 +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 3C496283A6 for ; Tue, 20 Mar 2018 17:56:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751408AbeCTR4Q (ORCPT ); Tue, 20 Mar 2018 13:56:16 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:37780 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751394AbeCTR4O (ORCPT ); Tue, 20 Mar 2018 13:56:14 -0400 Received: from pps.filterd (m0044008.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2KHsV2K030707; Tue, 20 Mar 2018 10:55:35 -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=h+RMoEYX+Y04iQl29Sp5tqAMjMYYDVtB9AkofB9S5IX8181tOXjyOilHl6nGNvN9tBpE x+oqsMPMN34Rt0JyDHCE85VjpL4kb3PrGQjowCt6UrPoBWGKXDmflUrvQbiiVsBV+liU TaI/gK1gRAuTjg/yr7uaHL1Lm7kWKdIUOoM= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2gu56m8j5n-8 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 20 Mar 2018 10:55:35 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.30) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 20 Mar 2018 13:54:19 -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=e/iK5tp0FlNMgGhjtUMqF6N9MPN4ykKVMcb+0S9hp9GrECfG3Cd2NbkUz3pBedlyRqPUYRBgsSTsDRVtt4Vq7wptq5Njrv0qNKP/f+NOKBqyjbMLsVjPdhfudB9THlJBlJebXQC5pPYpDvbQDo0fCyVEjb3GgaYyUPs8VSiUKGc= Received: from localhost (2620:10d:c090:180::1:828d) by CY4PR15MB1126.namprd15.prod.outlook.com (2603:10b6:903:106::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Tue, 20 Mar 2018 17:54:16 +0000 Date: Tue, 20 Mar 2018 10:54:12 -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 net-next 4/6] tls: Refactor variable names Message-ID: <20180320175412.GA23906@davejwatson-mba.local> 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:180::1:828d] X-ClientProxiedBy: MWHPR19CA0076.namprd19.prod.outlook.com (2603:10b6:320:1f::14) To CY4PR15MB1126.namprd15.prod.outlook.com (2603:10b6:903:106::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 524bac6e-a930-4ee1-6e79-08d58e8b9939 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:CY4PR15MB1126; X-Microsoft-Exchange-Diagnostics: 1; CY4PR15MB1126; 3:q6jzyIxFUO2Jjl3FCdc2z7/O4OBBP/h91rnw2SJwref7rZbne5MRK3KqFVYaXZ0GzRkWixaOttVX+2/aG8qN8J2mMhSp5JB7U6nTDNihOGoSYgxxivXG6YgC/qXoUy/1BGKCwKJ9qpPsenS0Q9s/l/PQ2z3405OpmxrNcmMW623xXkU63ZJqPytRaW1EcaZ7chR0/Iv0K1YtPKP9ARlafFUKIa6Yk0k2HJ7WSoppwXFrOIpuk0GqsMCzM9kH48A8; 25:3VCJ/M8+AotTKOy9BddjHG57tqQ5xtO+YjJr1DZ5o+oaWglqXtzW8CIJ6UyXvkuR4+aWFFcpWI1aJdX+fQJwWkyQqq1irKgfe2tfWC46DRGVWuONeuU/ROqQ9erJZGVv2kx6Ppa8FYhsdcLO7JFgUfQOhpf+eJ18kZBl219ScD5jrNi3nvOuskl4snb38yxHw+5N8V3aU2S0+zYvt6rggfZIuKQ2KWJxulmjBPx8SVVSccyNodt/GrX5H4LVd9x5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05jkdQp++YdRNRsgdsZhM7KMeL+kwsPWtOn0P4uBpQWFvv8Y3NIlugEUGPTdUvnoZFDhbm1MQQvyA2gBc8nuPumKuBaUOl/1hDUb8so/cJcItQqQ1r4b6UlH8pe94vF30tl4b6YQ/a/DC1zXSye8bNCVJlUzgremuA7DRFZuVSOWg0LjCH7qtKOj015+U+51Xn9gYI+49U2xcNgw= 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)(5005006)(8121501046)(10201501046)(3231221)(11241501184)(944501313)(52105095)(93006095)(93001095)(3002001)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:CY4PR15MB1126; BCL:0; PCL:0; RULEID:; SRVR:CY4PR15MB1126; X-Forefront-PRVS: 061725F016 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(396003)(366004)(376002)(39380400002)(346002)(39860400002)(199004)(189003)(53936002)(316002)(6666003)(7736002)(2950100002)(76506005)(59450400001)(386003)(8936002)(86362001)(97736004)(98436002)(52396003)(81166006)(76176011)(6496006)(8676002)(52116002)(81156014)(50466002)(33656002)(4326008)(9686003)(8656006)(68736007)(23726003)(5660300001)(478600001)(54906003)(110136005)(25786009)(58126008)(16586007)(6116002)(106356001)(47776003)(7416002)(16526019)(1076002)(33896004)(6486002)(305945005)(186003)(46003)(39060400002)(2906002)(105586002)(18370500001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR15MB1126; 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; CY4PR15MB1126; 23:4EE9nBW7V5X076suPbFT6LL/RPeDblNG8QPs4pf8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hkclWabCc840nfAITTt8V9Jkf7pch1R8ZZ/DMcE8=; 5:dwq4SgmB9SlfBB0wvMNJcxrI4A5GdNLekw/qIwJq+APZ39kb/nKFYHc8NkrYzzGZPdraucawIBgWqQWtUO5OO7dH/S5IrEmyR36Rp+sLUSwwMgg/0ULPyrD+tztJ0/sLvkX75m08paQazklis2L9FJpd4xMwIlxTUXBzJpSrt7I=; 24:E5UKsXjKz32Ww3T0B41C3RSHdlNcRTRHi+kLmzATr4jjStVZ56cL9yGypzUKviBknSpMgmq9DlFF7fqfY7mq6t2l/dnAjkzjsFq9rb0tHmc=; 7:XRuNG7Xo7qyUoacOwP28Fo8hscGEvNSJ9cGdYTv5qmy9lv1ccHND7rigkWDrQsjSZs8U+bpjBpjrqdqdz34lA4otdlIUKH05xZVIbo8sg2oTcVT7COraZ9aeIHp5nOkUQ4mp8jy0+OAWWX6j6sofHS/9hAJ9mclT8cQWJbawMzJUwnie3aNf1XARO6zMKx5F6kBNJjs1gALXwDfHIpQ5X6rJ1la1B/VeCE77pwc0vyx4vKe0FjhjbaUgjU8a2a3Q SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR15MB1126; 20:jeCGl8YHRJvwXtk4tcn0p7GAL7YB8U3g6DBDp8RHlQ1XC99hMViQAF+h96LOZkpxXLG4TjfrYkAVpq+YRLZ8MaF2U2BmhO+Scn11HyKQ9s2BrOwnkyy/8UQq8CscsXaazSXZQ8ke9zzmX/enrPiZc6UqZ9eaTmq1B20AyrEYniQ= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2018 17:54:16.3038 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 524bac6e-a930-4ee1-6e79-08d58e8b9939 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR15MB1126 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-20_06:, , 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;