Received: by 10.223.185.116 with SMTP id b49csp976044wrg; Wed, 14 Feb 2018 09:40:39 -0800 (PST) X-Google-Smtp-Source: AH8x227M1XPXSrWIXURqdrUKMRziT0p626m4FbxL3SqGvb9jeIVO8RO1qPbHW0Vqh3yXu9sq/478 X-Received: by 2002:a17:902:bf0c:: with SMTP id bi12-v6mr5054961plb.143.1518630038962; Wed, 14 Feb 2018 09:40:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518630038; cv=none; d=google.com; s=arc-20160816; b=i+OiDOH4Z18mvKTG9AhsMkfdFgiGvWwzTbQrZKJzjDZB/X37an3cdiQqMXOCNijHBQ SV8q1xnCj/sMIDsdwqz7usAc6IgdgD3hZ3mbgZ5xX+opF0XZe9QNxl7xY8veo5HiB95Z V3Lv40P1Nolx9hs8uqA2NwIePyV1k+be8/nfeD/LazbqX4DQL0MOC+VfrUMtrZdu3vaV OLnC9u45lG5ati+6xMBE3nd59I5P+3KD7mYfgtUa65KaLh0mT5VZ7uycbVamscx4BP5X i247e3HXIl499VO2aP7hnLGr3C2AzXAKZdszgYVWe7WTADrwED04Jx+zFl77aZ4PThDo bsYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature:arc-authentication-results; bh=eky+osceLfKQMy0gfexcMfakBpF8QJm/IyST3JZfp7w=; b=ruNfI9WViG/z/PBH/wFv2BsJ56BjAAnNPjd0JeOuBjkwUx5IizM7Fw6t5Il14FO6LL W8svxQjjR9Z1KenISpBv9nmEkWp0IuUPDnWoB9iA6Gt9zUG3FG9NapiU/1Yjx7bH7h6n 9ntaIn0dIOiaiij0al7A8oducFS30rLENXsKs2RcwZCRKoVjVU0Uop7fSBUHFtamn6AT 6/FiQmW9W1gw5bfrZ2GWSIg8YeQ9krrfUBhNdwx08vjV2yXCQLY1miBFSNfx37ytHWin CCeytLn63oO0idSiRjVX7Iy7jL4kGh3712b4V33P3N/LwJQCEhQ3aAfCUOaZMabOBpsj lZ2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=PCjCFdQw; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=GGeaFzQ5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p14-v6si1466476plr.282.2018.02.14.09.40.23; Wed, 14 Feb 2018 09:40:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=PCjCFdQw; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=GGeaFzQ5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161328AbeBNRj3 (ORCPT + 99 others); Wed, 14 Feb 2018 12:39:29 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:55750 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161296AbeBNRjT (ORCPT ); Wed, 14 Feb 2018 12:39:19 -0500 Received: from pps.filterd (m0109334.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1EHcR8k024497; Wed, 14 Feb 2018 09:38:57 -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=eky+osceLfKQMy0gfexcMfakBpF8QJm/IyST3JZfp7w=; b=PCjCFdQwHRgnkwr7yxZuJohwG1y3ELZzFF9a5UBlvSZmgPr8x5SOcfQH01frhpn2voa0 LVDl5AMfDQvMLhu0IRDUOmGSLQ/KrTWyou7so7mZrrPZI8WmIUCsbqJzisCD3lZcKmKs Jh0dv9Pvs9KSpu0ZZWgXetAWAl2a42BvTK0= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2g4rthrndx-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 14 Feb 2018 09:38:57 -0800 Received: from NAM02-SN1-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; Wed, 14 Feb 2018 12:38:54 -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=eky+osceLfKQMy0gfexcMfakBpF8QJm/IyST3JZfp7w=; b=GGeaFzQ5BLdoanQjV58lRbQd6nBVmKIbYJ059T63TDQECsYW1f7uJ7DjCObCb7LRVgkXjAzASvxRFjM55jt5UveJi6CnpCHD4ftliuS1l2LfFY/ajNqiINxhxcd+8/gsbupPO8OPLg3Is4w+EbN6hqsrT4Yl5A4mXtESEyXPlRw= Received: from localhost (2620:10d:c090:180::622a) by MWHPR15MB1758.namprd15.prod.outlook.com (10.174.255.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.506.18; Wed, 14 Feb 2018 17:38:51 +0000 Date: Wed, 14 Feb 2018 09:38:45 -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 03/14] x86/crypto: aesni: Add GCM_INIT macro Message-ID: <20180214173845.GA61871@davejwatson-mba> References: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" 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: CO2PR06CA0054.namprd06.prod.outlook.com (10.165.93.12) To MWHPR15MB1758.namprd15.prod.outlook.com (10.174.255.11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0fa9f206-f091-47fe-4bea-08d573d1d004 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:MWHPR15MB1758; X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1758;3:HUcdx/rxjTiLW5uz/0gdd4HCy7GLfARriV7zbbCh8lm+MvAp5M4sXYr49Drsm10BSYeTee4Ofi8t7YAnwnj4k/v9YAVJS5iPtTcpZ/3l1cDHdu2fiXlkQu83w9z1XkL7EopEPIdvGGNnw9OSfXI4TuL/SSWjvHft1GY3UoBgI8tMGyzmqEP9Z8c+BFsXIg4FlIJv7evRYaWWUbGWHSDM9ec59so9Zx8X7L4ju0jU5BCeTqWzlUzUVBk76H227f/y;25:XcxWfJtL0ehy/jjgSOgWqDyTVxPWJOPnwPbDIeCw45Nb4ih4b3k2IYqJ27mVvRh35uAauSQdeL8TzSeujRNOusavd5NRknEZVRcY4VC+8eXySXThQzB0+Toz3oCumI+L9IRpnq13jUw+C4cK9qB+jO2ORKLL/u3/RLwgoRQywLxnYiBeDHF4FnAKClvMMbr/77S/dXEJrinRWyYRiq5gxoyOQ7g4Dof9bLE76XqF+0TCMx8P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EC8PqUS9expC45NE/GuvoG6zvp1L2/dFfJ9n/zjhLcCgCEF4OmKPCne8IHKbuE1jKWPElUdFtpuBUTSSgZBGt1GyeS2NZCmPUvKMt34/5X3/kapBOdkXVyRd/P1/X29Ef3uQMsQH88EzVdvxvGLRrklJv84JZuySb3/414D00PzP5jJ6q9A6SdktzxR2uj6XQoiFhqc00VjxPIN5L5Q= 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)(3231101)(11241501184)(944501161)(93006095)(93001095)(10201501046)(3002001)(6041288)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(6072148)(201708071742011);SRVR:MWHPR15MB1758;BCL:0;PCL:0;RULEID:;SRVR:MWHPR15MB1758; X-Forefront-PRVS: 0583A86C08 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(7916004)(346002)(376002)(39860400002)(366004)(39380400002)(396003)(199004)(189003)(305945005)(52396003)(47776003)(81156014)(16526019)(8676002)(50466002)(6496006)(52116002)(9686003)(6116002)(53936002)(106356001)(83506002)(54906003)(105586002)(7416002)(316002)(478600001)(33656002)(16586007)(110136005)(58126008)(76176011)(33896004)(81166006)(7736002)(1076002)(8936002)(386003)(186003)(33716001)(86362001)(6486002)(2906002)(97736004)(25786009)(5660300001)(6666003)(76506005)(4326008)(23726003)(2950100002)(68736007)(18370500001);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR15MB1758;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;MWHPR15MB1758;23:Jzgy6pCdndFuCAlFM36J+XReemtvWsFbPQe4XQDpl?= =?us-ascii?Q?+1pib8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GUjYqwPuU+/2v2dW2R8W/jXcNd8G53RI=;7:ukkRloHZPv0/aMyHqwhb9hWz+AGlDJ3+sCXr0UohKumo+D7/GJ69YCe8nVOwZWkL2HuAzQWCcCPyc27322E10TZKcE9X+xtGlKjZKCr4AL75YTy46Sqsl9YT8871xL/Vl8nNRmqsWyxdabLz9mIfca+DdJbXEPQwE4r/2M0AnYWkEAIJk681qnWy0l3JR19YK18CeOYmJ3YeB10my/cLqHoL+Kgmx5FmT9U9CflSqtbJT4nvOW51/F2ehozPbHip SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1758;20:OYppi0640TVCLqrDjdTcijnfCQujPVkP+ZVAt+8i0w78VVXC06V3cAfgjF1n+SI5Wq564tFr1jIaRlnKERPEN3Vx/LudXyni9sJk5YSKAojrkwsOmO7RXhZVP+WnQFKpbymU7MyBRjHrsa0d9KqbMl6DFgyeWEPcFcTas3AbU6I= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2018 17:38:51.7157 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0fa9f206-f091-47fe-4bea-08d573d1d004 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1758 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reduce code duplication by introducting GCM_INIT macro. This macro will also be exposed as a function for implementing scatter/gather support, since INIT only needs to be called once for the full operation. Signed-off-by: Dave Watson --- arch/x86/crypto/aesni-intel_asm.S | 84 +++++++++++++++------------------------ 1 file changed, 33 insertions(+), 51 deletions(-) diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S index 39b42b1..b9fe2ab 100644 --- a/arch/x86/crypto/aesni-intel_asm.S +++ b/arch/x86/crypto/aesni-intel_asm.S @@ -191,6 +191,37 @@ ALL_F: .octa 0xffffffffffffffffffffffffffffffff pop %r12 .endm + +# GCM_INIT initializes a gcm_context struct to prepare for encoding/decoding. +# Clobbers rax, r10-r13 and xmm0-xmm6, %xmm13 +.macro GCM_INIT + 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 + psllq $1, %xmm13 + psrlq $63, %xmm2 + movdqa %xmm2, %xmm1 + pslldq $8, %xmm2 + psrldq $8, %xmm1 + por %xmm2, %xmm13 + + # reduce HashKey<<1 + + pshufd $0x24, %xmm1, %xmm2 + pcmpeqd TWOONE(%rip), %xmm2 + pand POLY(%rip), %xmm2 + pxor %xmm2, %xmm13 + movdqa %xmm13, HashKey(%rsp) + mov %arg4, %r13 # %xmm13 holds HashKey<<1 (mod poly) + and $-16, %r13 + mov %r13, %r12 +.endm + #ifdef __x86_64__ /* GHASH_MUL MACRO to implement: Data*HashKey mod (128,127,126,121,0) * @@ -1151,36 +1182,11 @@ _esb_loop_\@: *****************************************************************************/ ENTRY(aesni_gcm_dec) FUNC_SAVE - mov %arg6, %r12 - movdqu (%r12), %xmm13 # %xmm13 = HashKey - movdqa SHUF_MASK(%rip), %xmm2 - PSHUFB_XMM %xmm2, %xmm13 - - -# Precompute HashKey<<1 (mod poly) from the hash key (required for GHASH) - - movdqa %xmm13, %xmm2 - psllq $1, %xmm13 - psrlq $63, %xmm2 - movdqa %xmm2, %xmm1 - pslldq $8, %xmm2 - psrldq $8, %xmm1 - por %xmm2, %xmm13 - - # Reduction - - pshufd $0x24, %xmm1, %xmm2 - pcmpeqd TWOONE(%rip), %xmm2 - pand POLY(%rip), %xmm2 - pxor %xmm2, %xmm13 # %xmm13 holds the HashKey<<1 (mod poly) + GCM_INIT # Decrypt first few blocks - movdqa %xmm13, HashKey(%rsp) # store HashKey<<1 (mod poly) - mov %arg4, %r13 # save the number of bytes of plaintext/ciphertext - and $-16, %r13 # %r13 = %r13 - (%r13 mod 16) - mov %r13, %r12 and $(3<<4), %r12 jz _initial_num_blocks_is_0_decrypt cmp $(2<<4), %r12 @@ -1402,32 +1408,8 @@ ENDPROC(aesni_gcm_dec) ***************************************************************************/ ENTRY(aesni_gcm_enc) 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 - psllq $1, %xmm13 - psrlq $63, %xmm2 - movdqa %xmm2, %xmm1 - pslldq $8, %xmm2 - psrldq $8, %xmm1 - por %xmm2, %xmm13 - - # reduce HashKey<<1 - - pshufd $0x24, %xmm1, %xmm2 - pcmpeqd TWOONE(%rip), %xmm2 - pand POLY(%rip), %xmm2 - pxor %xmm2, %xmm13 - movdqa %xmm13, HashKey(%rsp) - mov %arg4, %r13 # %xmm13 holds HashKey<<1 (mod poly) - and $-16, %r13 - mov %r13, %r12 + GCM_INIT # Encrypt first few blocks and $(3<<4), %r12 -- 2.9.5