From patchwork Mon Feb 12 19:48:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Watson X-Patchwork-Id: 10214295 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 434E060467 for ; Mon, 12 Feb 2018 19:49:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C05428BCB for ; Mon, 12 Feb 2018 19:49:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20CDE28C2B; Mon, 12 Feb 2018 19:49:05 +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=unavailable 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 668E028BCB for ; Mon, 12 Feb 2018 19:49:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753463AbeBLTss (ORCPT ); Mon, 12 Feb 2018 14:48:48 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:59618 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752320AbeBLTsn (ORCPT ); Mon, 12 Feb 2018 14:48:43 -0500 Received: from pps.filterd (m0001255.ppops.net [127.0.0.1]) by mx0b-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1CJkqvo029291; Mon, 12 Feb 2018 11:48:25 -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=qYca0mroUym1iWYXGlv3LTmJOIUW4nvYD0VWcPWuxR3PJBqCWJC/nCwnlTbaGc2g4Vq1 vlFPmq+3DoKQfczdsjHpfKiIDWKwdt0l7fpY2dq4wSk14JhPUCCtqBSRN9QSR5dz6caR ZeUPTIw48NBuxQhkxKfMPMo4CoBrhS6cwAQ= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0b-00082601.pphosted.com with ESMTP id 2g3bcq12md-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 12 Feb 2018 11:48:25 -0800 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.21) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 12 Feb 2018 14:48:23 -0500 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=N1cfZ+CB/MyNRppOmUX2W4JHSaAexH6R/ZECD9pEb4G01YLCkRkP6V88kbejl3PlNZuC2D+Ns/nAPkh4zGYmm/eQXDORAgCY8oz5Mdzsa0tvxattmf4yD24AqyItogc17Q/1zY/UXRpUDdKHggf5j4dMaQlQnRP5GhJcxofBhjY= Received: from localhost (2620:10d:c090:200::6:842f) by MWHPR15MB1759.namprd15.prod.outlook.com (10.174.255.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Mon, 12 Feb 2018 19:48:20 +0000 Date: Mon, 12 Feb 2018 11:48:15 -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 02/14] x86/crypto: aesni: Macro-ify func save/restore Message-ID: <20180212194815.GA60401@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:200::6:842f] X-ClientProxiedBy: SN4PR0501CA0130.namprd05.prod.outlook.com (10.167.128.47) To MWHPR15MB1759.namprd15.prod.outlook.com (10.174.255.12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81a152a7-abdc-4423-140d-08d572519207 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:MWHPR15MB1759; X-Microsoft-Exchange-Diagnostics: 1; MWHPR15MB1759; 3:erWwjhYsS37qVaeKMpMbHlROj8bpiS7bOPNvVJOSBIUDyRj+ucZlnGj3EEJLLtmZgs2fyUrHI6VQ4cUyGDoofXpgaVvAYgok26CwEMfkHshugX6pDj82xHY80xpedggGvI/Y8WVO0pCXC0wvABbglPPBWjLfGv6/fq4JlRkoXu8FQ5Nwm9SyTA66QfLXQzyZW/Uvl5obFKIOJ7GBGYmTTA07SOlicr/rWr/CCDS6wV82Rx7tZDhlOvctwJIjX+S5; 25:z4YVXMTY/3eRBMT6gzaZN0zwhT5pmicRnr8e9loGjS/mVQAAkp2HQdf/zQdBHmjiArcZosPO/gWLHUNj7Mx6786nFzdPckAsMb9AqTShX9zFPKRialD3YJtpXbJ9pzFHipeyakA+1p72UDvrezsg+2U9ul77EXIJF7bG87jBqJ2uT3TDalz8XJ99u9pXGzC/0JcFSdzZkegrag+u0hAFYW3WsOJ/o9GTAzEpE/+I3pxgRsETJ20+8huN9QG0qnaYaFn6i7xPK3ndBg9w32He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+AmShbQTSDfZvrAeyh/C5ZIq+QRBdntoUkLMR0z2o0b5Gc2uguicdCV5+LTMgR/E/g1uDSbwwFpc3nZci7aswSGX6L1GLcpulOc9zVBiksIyTO1qooZJNxr2uih/sjkyDuUvhIL1Tc++4OLFcYUsvqDrLUpjZtWTFTKepREmnlo= 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)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231101)(11241501184)(2400082)(944501161)(6041288)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:MWHPR15MB1759; BCL:0; PCL:0; RULEID:; SRVR:MWHPR15MB1759; X-Forefront-PRVS: 0581B5AB35 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(39380400002)(346002)(376002)(39860400002)(366004)(396003)(199004)(189003)(6496006)(25786009)(4326008)(59450400001)(50466002)(1076002)(7416002)(52116002)(52396003)(8936002)(76506005)(98436002)(83506002)(316002)(33656002)(386003)(68736007)(2906002)(6666003)(86362001)(16586007)(105586002)(2950100002)(76176011)(110136005)(47776003)(58126008)(53936002)(33896004)(106356001)(7736002)(81166006)(478600001)(8676002)(6116002)(16526019)(186003)(81156014)(305945005)(23726003)(97736004)(5660300001)(54906003)(6346003)(9686003)(6486002)(18370500001); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR15MB1759; 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; MWHPR15MB1759; 23:65+BQRCG8bYWl8Jhu4PlWZrs8bZaPI+1TLzAdxN8O?= =?us-ascii?Q?ItoBcrTjHgS49OCNi86H/5wE2Cwg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cy7qcY35FAdlG1m3c87NSBETLWUpqAW80zmtku1NeeaK8=; 7:qugr4gJTVmi0LztahVxfKkAE/mezc7fSPTuOtYWB8h8SYJ7pgrHfTVnT2fiyEbJQLk6sJP+LR12FXMuGoHc6FlKBqgC7HBffcTNcrUHS6tI85Z8hqpKwdnP6tCSMQIQQ1npbMwqB5yPwzPak4shCGjbft1AnHU1nM5NmZ1MY5KuSZYTX3UVAoZc6dUOvpcBEUrGnr539ilJgEb9b57SX0jI6N3pgS8n6Yoar+1+cynfMLGYzjOe77FtgXCIskczs SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR15MB1759; 20:LSkWByKuBFrpOcHW9MzLP7Xhls4b8Db8+yoK+zUuQ4L0tHSEaAOguEHOdwOjvUiY5DMDbmgfA14K5MK8KiGJPo9JI1bosxlCu0D+kIh3zPp2SWBYYu13z65RlEu1jh6YxRgCS3DNMyV1YjKvbuUl7/fojVljQOtXZR52y9BGYxc= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2018 19:48:20.8304 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81a152a7-abdc-4423-140d-08d572519207 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1759 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-02-12_08:, , 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)