From patchwork Wed Feb 14 17:38:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Watson X-Patchwork-Id: 10219527 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 59117601D7 for ; Wed, 14 Feb 2018 17:39:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A0D528BF1 for ; Wed, 14 Feb 2018 17:39:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AD9128BE5; Wed, 14 Feb 2018 17:39:22 +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 77F1D28BE5 for ; Wed, 14 Feb 2018 17:39:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161276AbeBNRjS (ORCPT ); Wed, 14 Feb 2018 12:39:18 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:36334 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1161274AbeBNRjQ (ORCPT ); Wed, 14 Feb 2018 12:39:16 -0500 Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.16.0.22/8.16.0.22) with SMTP id w1EHcxHa022566; Wed, 14 Feb 2018 09:38:59 -0800 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=36uJdR9lPY7GmpKoGSIlKmvtbkvIJdirlCxiap2VIBM=; b=nVtdRi8ujBjrgItVp6/As70w0RAGBRmo+vpRxKcmXvK6wxTEa/nNBjVDr5OwuYB+0uHj fXJWsATFO6H3qNES2Un0ieWzA8/cCrtbhTMXQ1uxeyVMK3YRpz/r+9FepRNEGjO/E9LD qeiDdWTMXcWJkxO1VWiZpN9Pj5Bhwa110dc= Received: from mail.thefacebook.com ([199.201.64.23]) by m0001303.ppops.net with ESMTP id 2g4qsq98dy-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 14 Feb 2018 09:38:58 -0800 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.16) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 14 Feb 2018 09:38:40 -0800 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=36uJdR9lPY7GmpKoGSIlKmvtbkvIJdirlCxiap2VIBM=; b=Vb98RWhWEscq0Rgsabyn9+Sr6ezqKLZiS92Pz7NucsFzJ5oKKwbbh4uvn0pPLRSsqBs6uwtdkSnexKInr9qiuL3dq3+ENjHXDRjthTr+kxt7SF/rsHubQJxkCABNa09Rklt3pZClmhQs8Yw2Epd0NoZwSek7mBH9VJ7d7joo+Lk= Received: from localhost (2620:10d:c090:180::622a) by DM5PR15MB1755.namprd15.prod.outlook.com (10.174.246.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Wed, 14 Feb 2018 17:38:38 +0000 Date: Wed, 14 Feb 2018 09:38:35 -0800 From: Dave Watson To: Herbert Xu , Junaid Shahid , Steffen Klassert , CC: "David S. Miller" , Hannes Frederic Sowa , Tim Chen , Sabrina Dubroca , , Stephan Mueller , Ilya Lesokhin Subject: [PATCH v2 02/14] x86/crypto: aesni: Macro-ify func save/restore Message-ID: <20180214173835.GA61851@davejwatson-mba> 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::622a] X-ClientProxiedBy: MWHPR20CA0013.namprd20.prod.outlook.com (10.171.151.151) To DM5PR15MB1755.namprd15.prod.outlook.com (10.174.246.137) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 58c6e310-4e6e-41c7-5c62-08d573d1c850 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7153060)(7193020); SRVR:DM5PR15MB1755; X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1755; 3:sVpH0VR5P1mZWP4bkxyyxha/xQW+MJBoQvHp4WSAemGuYydwqSZCZlt3hx7j1k6atl6pb7huMiT9/+xRoW7o8MWw8JDF2sJH+YR/apyw0o3ja67oW3PRyBcxQKE3foINVb9un5TkyYqkMLEkPu0BNjE75pGX0LQoF6ipHewvOPaKg2XFZczTH+MvbnC6GST/YJNfBxk62AJzWWI3UBvss4s1elGo0x+ndv8K2w/J8UnF9JbSuTOQtfAbsswMwMv7; 25:MnLaWfsJ/EUrRKLOkreV8VDUL6InasKmA1GlNvHUHGg75TGiN2CXe/pppB9KYntjknVmImMQI69As9sDrhgwwTbt2x1PaKNW6GgIFnskZJFFPjJBuxfCBHjuZeoAm0g17XG9A+Q9jv4gaxUMjuabz1cqn81q4Cg7PIc5s/+OJDNGLk3wemJvVDyUXJkjUF2DPuVc4QDIFILm6x8LiLJU1cjrU8QSXcAo2XmxNTblqiNs95Ei9kUqZORl/xXwQG2zNJhYg0KCqoFIEgrxn2SXJT4n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VfEuVuVeXl0AUAnjaXF0nVquj28ekmWMbvhUHkwZH6uE4lynQbfax05uuP22agOPf4Syez5DLKzw0W5If6eIz6TV8bPpgT9gUVQLstwzn+mOqzrB9Ys3jO4TbhS2w2ZoNi6y8lySfhY8Lyvi3kj7G5JGxnBeZo3UFRx6K5yjEAxSQs0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484)(266576461109395); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(3231101)(11241501184)(944501161)(10201501046)(6041288)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM5PR15MB1755; BCL:0; PCL:0; RULEID:; SRVR:DM5PR15MB1755; X-Forefront-PRVS: 0583A86C08 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(7916004)(376002)(39380400002)(39860400002)(346002)(366004)(396003)(199004)(189003)(9686003)(53936002)(6486002)(6666003)(2950100002)(4326008)(59450400001)(52396003)(52116002)(6496006)(16526019)(76176011)(33896004)(186003)(105586002)(478600001)(5660300001)(316002)(58126008)(386003)(16586007)(25786009)(50466002)(106356001)(33716001)(76506005)(8936002)(83506002)(110136005)(54906003)(97736004)(86362001)(8676002)(47776003)(1076002)(6116002)(7736002)(33656002)(305945005)(23726003)(81166006)(81156014)(7416002)(68736007)(2906002)(18370500001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR15MB1755; 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; DM5PR15MB1755; 23:ak3Ujoq/esmKUDOzLge5w4AlS0kGKHWE3n/3Ak1nw?= =?us-ascii?Q?6+GH5uii2q8HlnAABH0axobOlqVSt+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zjyJ2AtfCHuBvizyA6oHyKaWGmWyvKRtjCdxrVH2UvWzMnKPY63CAwKX9qZcywEJweY0=; 7:DpaYFWhHp01bDKku6jiM/b0V4UC4XQkQMNHVCB0Jj8zPe9JMUJiKpde+xcHOfqbNP8hlin8KNNrPrtz9bNsPb/mLxPNoAH1a1T+WjKBAnx4JaQ47GAPdU4hgKodUpjQTi3JmfBnVvT7U2o1EbsOsgmKRs2ANWgQaRFc2d11XKa3D24wDcS5BQSIpPLYpf5aJDraPjJwZSFs6jSGCuQLLR7ihTuDE0gGBAeDYcGV8TZ7GMY+izzhdQKSwj3tR7PaA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1755; 20:81QRGnDofi3JxEn30a2ZgtMSTGwfWP1IJXCjqK/6QxqMzQo8NJps3IbL9nQcMQZe+qmBBEkQar5psCyUo6U6o6WEH2Lk9jIdqWXe9Sk1XBNY0eMUFj9IPlWmXbPQKuP9hMHuRj7p7qxv2WNwJHCbgb1qokyv/7W8Njga1/LpiwI= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2018 17:38:38.7143 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 58c6e310-4e6e-41c7-5c62-08d573d1c850 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR15MB1755 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-02-14_07:, , 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 Macro-ify function save and restore. These will be used in new functions added for scatter/gather update operations. Signed-off-by: Dave Watson --- arch/x86/crypto/aesni-intel_asm.S | 53 ++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S index 48911fe..39b42b1 100644 --- a/arch/x86/crypto/aesni-intel_asm.S +++ b/arch/x86/crypto/aesni-intel_asm.S @@ -170,6 +170,26 @@ ALL_F: .octa 0xffffffffffffffffffffffffffffffff #define TKEYP T1 #endif +.macro FUNC_SAVE + push %r12 + push %r13 + push %r14 + mov %rsp, %r14 +# +# states of %xmm registers %xmm6:%xmm15 not saved +# all %xmm registers are clobbered +# + sub $VARIABLE_OFFSET, %rsp + and $~63, %rsp +.endm + + +.macro FUNC_RESTORE + mov %r14, %rsp + pop %r14 + pop %r13 + pop %r12 +.endm #ifdef __x86_64__ /* GHASH_MUL MACRO to implement: Data*HashKey mod (128,127,126,121,0) @@ -1130,16 +1150,7 @@ _esb_loop_\@: * *****************************************************************************/ ENTRY(aesni_gcm_dec) - push %r12 - push %r13 - push %r14 - mov %rsp, %r14 -/* -* states of %xmm registers %xmm6:%xmm15 not saved -* all %xmm registers are clobbered -*/ - sub $VARIABLE_OFFSET, %rsp - and $~63, %rsp # align rsp to 64 bytes + FUNC_SAVE mov %arg6, %r12 movdqu (%r12), %xmm13 # %xmm13 = HashKey movdqa SHUF_MASK(%rip), %xmm2 @@ -1309,10 +1320,7 @@ _T_1_decrypt: _T_16_decrypt: movdqu %xmm0, (%r10) _return_T_done_decrypt: - mov %r14, %rsp - pop %r14 - pop %r13 - pop %r12 + FUNC_RESTORE ret ENDPROC(aesni_gcm_dec) @@ -1393,22 +1401,12 @@ ENDPROC(aesni_gcm_dec) * poly = x^128 + x^127 + x^126 + x^121 + 1 ***************************************************************************/ ENTRY(aesni_gcm_enc) - push %r12 - push %r13 - push %r14 - mov %rsp, %r14 -# -# states of %xmm registers %xmm6:%xmm15 not saved -# all %xmm registers are clobbered -# - sub $VARIABLE_OFFSET, %rsp - and $~63, %rsp + FUNC_SAVE mov %arg6, %r12 movdqu (%r12), %xmm13 movdqa SHUF_MASK(%rip), %xmm2 PSHUFB_XMM %xmm2, %xmm13 - # precompute HashKey<<1 mod poly from the HashKey (required for GHASH) movdqa %xmm13, %xmm2 @@ -1576,10 +1574,7 @@ _T_1_encrypt: _T_16_encrypt: movdqu %xmm0, (%r10) _return_T_done_encrypt: - mov %r14, %rsp - pop %r14 - pop %r13 - pop %r12 + FUNC_RESTORE ret ENDPROC(aesni_gcm_enc)