From patchwork Mon Feb 12 19:49:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Watson X-Patchwork-Id: 10214305 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 0D70860467 for ; Mon, 12 Feb 2018 19:50:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E87E828D5E for ; Mon, 12 Feb 2018 19:50:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB8FB28D57; Mon, 12 Feb 2018 19:50:21 +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 2509628D41 for ; Mon, 12 Feb 2018 19:50:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751124AbeBLTuS (ORCPT ); Mon, 12 Feb 2018 14:50:18 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:55272 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751208AbeBLTuO (ORCPT ); Mon, 12 Feb 2018 14:50:14 -0500 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 w1CJmweX018061; Mon, 12 Feb 2018 11:49:53 -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=2NUlFlXDHQ0LB6pW5K+yT/zsB4TGP/FKF8AVgMEBqSg=; b=Gc49IMZHi23g6UgvYAvmNc+safabcYbTFMrwEVF+nWubSmGJ7549G1WZFwKUxvOFp5PH fN4gEcIVhMBgbyfmbEQqcbxUF9YllgMFDMlj8bkYYXpS3STzd7cT886wcDZxnZIbPaQE R5eFiiJ+NdmYT4OpLoV6uxLsyGLfXW+lGL0= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2g3fh28ctg-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 12 Feb 2018 11:49:53 -0800 Received: from NAM01-BN3-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; Mon, 12 Feb 2018 14:49:51 -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=2NUlFlXDHQ0LB6pW5K+yT/zsB4TGP/FKF8AVgMEBqSg=; b=j44nAW+0/kQlfYYKRikvoZSWRKkLm3mxRpXU/B4UZ1Qgsw0K4y/uTn9+ZSOPYcWksyflF+AN6NXbuDNlXRlklhRR+wj+FCzU3Jf3liCXUY7Eyn5iDnhMcKqaRc2j0rJdlreocSDuHEi7HSWeks6jb4UPtUKcj9qUu+ewk0NJ8Lw= Received: from localhost (2620:10d:c090:200::6:842f) 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; Mon, 12 Feb 2018 19:49:49 +0000 Date: Mon, 12 Feb 2018 11:49:42 -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 07/14] x86/crypto: aesni: Split AAD hash calculation to separate macro Message-ID: <20180212194942.GA60838@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: CY4PR18CA0047.namprd18.prod.outlook.com (10.173.177.33) To DM5PR15MB1755.namprd15.prod.outlook.com (10.174.246.137) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c6d4dcdd-5fba-4b4d-1b6d-08d57251c699 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:fgZ0kf1/vGtxj9mc92NNsEJF9VolPL/JiCPCrIQLozXTNS9Ampv7JQpp4YzJUVqBIDVp1WshMjjQqMecKFjQpYn9GR70A2NGSXX2874TeKn5DK+2WIBBvFv8i1+8QW/ey0w/vkAlGKMemW64V3TZFtz5TOdra3/l8ZAzPWU4ABnxJP7TYZMwmr+ln4WC9w0RlH50noWFI1X1mpORWpyU+a/OuJB23Y6ptTSHBab1CQpTn3v708vE4wEgyOOirmXU; 25:iQsfdex3vDd2HgRN8e+9DMymvLEuociqiIZhQ1qH+c7J3Hbw6NBqyYiXPeWMgDXzA5TKUTdw+OibZxlmEcPCf9f3YASBeF/V6ZGmm964HDwaiJ708qYT9UZCqdOn1ZxIjbObl7U8zfd+7pHGq5v//BZ2OY9cgSMRn0Rm7X48MMvHEvRNKvLA2/TCkR41o5umkcQyazss7McUVJ3RAjRuDP25VlBPKf8dEAY8VvVDNNDdwyWND+frwKTRnwAgFL71JO2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HP4SV2+/MHnRPYE0k2hwRbavccLFLl4iDKDnOoPhzpkUys6SU/MHLshgKlQ5dLQ0NUK3G4KPgywPaC8heogZtdc7XGkF+4PVwTuh4nlh2mRyaufhjqxXGeU7Q/FSJE3SJL3qjUeJMxMCoMBe7YNYKiwbhBhtK3CyhNpYhe0WXr/InYF6rOBTa0RpB2e39+p5ZGE= 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)(10201501046)(3002001)(93006095)(93001095)(6041288)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR15MB1755; BCL:0; PCL:0; RULEID:; SRVR:DM5PR15MB1755; X-Forefront-PRVS: 0581B5AB35 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(396003)(376002)(39860400002)(366004)(39380400002)(346002)(199004)(189003)(23726003)(6116002)(1076002)(8936002)(9686003)(50466002)(81156014)(81166006)(8676002)(186003)(16526019)(86362001)(2906002)(98436002)(33656002)(478600001)(33896004)(97736004)(52396003)(6496006)(106356001)(386003)(68736007)(105586002)(5660300001)(76176011)(47776003)(6486002)(58126008)(110136005)(6666003)(7736002)(316002)(16586007)(54906003)(52116002)(76506005)(4326008)(25786009)(305945005)(2950100002)(7416002)(83506002)(53936002)(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:K5zXaj9LQuC+7Q9ZJWCoXLmUZ+8rtHC3w1Y0Jzv9J?= =?us-ascii?Q?5nc+d5AuE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Sv/A6OczjR8qt5uWfdf2bjgA=; 7:n70imhvTbqf88ijLSOGWGnkLaykgnHORNTwWP+J+M7V1iTGKnE1mVxTl9ynfKWhNAL2BrGrcMdopvZaG5pTKOEFI1PAL+PLcDturDxXu3MbAoFPYcoznj5pJXdlNv1kn5NRl3H7hudA2IU9R0FReY2feVWb4uAXN6Etb3VGkWdVV/uNi3ntqGOvecbeSTgvNwmitsEemGWlsyjwRzotSOJnt75OyhXEcl4D9pEA+xGu+P1zzrBnngEiC+NMyriVI SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1755; 20:+jWammbjKVVHBNSWQbnQjYEbbsW6oIcHU4wt/JrzXl49Iz4yOqGoI4QCf8IEkCwK4IULS0WG8cidd1yoNtXEbteVFku2k/MjZSE62OcbcKonlDRUD4XuWPyxHp5IA8lPMAdXAYV9cUcSUyC3VRJQlk/d1DHNRcV1a4I7HEgN4P8= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2018 19:49:49.0914 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c6d4dcdd-5fba-4b4d-1b6d-08d57251c699 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-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 AAD hash only needs to be calculated once for each scatter/gather operation. Move it to its own macro, and call it from GCM_INIT instead of INITIAL_BLOCKS. Signed-off-by: Dave Watson --- arch/x86/crypto/aesni-intel_asm.S | 71 ++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S index 6c5a80d..58bbfac 100644 --- a/arch/x86/crypto/aesni-intel_asm.S +++ b/arch/x86/crypto/aesni-intel_asm.S @@ -229,6 +229,10 @@ ALL_F: .octa 0xffffffffffffffffffffffffffffffff mov %arg5, %r13 # %xmm13 holds HashKey<<1 (mod poly) and $-16, %r13 mov %r13, %r12 + + CALC_AAD_HASH %xmm13 %xmm0 %xmm1 %xmm2 %xmm3 %xmm4 \ + %xmm5 %xmm6 + mov %r13, %r12 .endm # GCM_ENC_DEC Encodes/Decodes given data. Assumes that the passed gcm_context @@ -496,51 +500,62 @@ _read_next_byte_lt8_\@: _done_read_partial_block_\@: .endm -/* -* if a = number of total plaintext bytes -* b = floor(a/16) -* num_initial_blocks = b mod 4 -* encrypt the initial num_initial_blocks blocks and apply ghash on -* the ciphertext -* %r10, %r11, %r12, %rax, %xmm5, %xmm6, %xmm7, %xmm8, %xmm9 registers -* are clobbered -* arg1, %arg3, %arg4, %r14 are used as a pointer only, not modified -*/ - - -.macro INITIAL_BLOCKS_ENC_DEC TMP1 TMP2 TMP3 TMP4 TMP5 XMM0 XMM1 \ -XMM2 XMM3 XMM4 XMMDst TMP6 TMP7 i i_seq operation - MOVADQ SHUF_MASK(%rip), %xmm14 - mov arg8, %r10 # %r10 = AAD - mov arg9, %r11 # %r11 = aadLen - pxor %xmm\i, %xmm\i - pxor \XMM2, \XMM2 +# CALC_AAD_HASH: Calculates the hash of the data which will not be encrypted. +# clobbers r10-11, xmm14 +.macro CALC_AAD_HASH HASHKEY TMP1 TMP2 TMP3 TMP4 TMP5 \ + TMP6 TMP7 + MOVADQ SHUF_MASK(%rip), %xmm14 + mov arg8, %r10 # %r10 = AAD + mov arg9, %r11 # %r11 = aadLen + pxor \TMP7, \TMP7 + pxor \TMP6, \TMP6 cmp $16, %r11 jl _get_AAD_rest\@ _get_AAD_blocks\@: - movdqu (%r10), %xmm\i - PSHUFB_XMM %xmm14, %xmm\i # byte-reflect the AAD data - pxor %xmm\i, \XMM2 - GHASH_MUL \XMM2, \TMP3, \TMP1, \TMP2, \TMP4, \TMP5, \XMM1 + movdqu (%r10), \TMP7 + PSHUFB_XMM %xmm14, \TMP7 # byte-reflect the AAD data + pxor \TMP7, \TMP6 + GHASH_MUL \TMP6, \HASHKEY, \TMP1, \TMP2, \TMP3, \TMP4, \TMP5 add $16, %r10 sub $16, %r11 cmp $16, %r11 jge _get_AAD_blocks\@ - movdqu \XMM2, %xmm\i + movdqu \TMP6, \TMP7 /* read the last <16B of AAD */ _get_AAD_rest\@: cmp $0, %r11 je _get_AAD_done\@ - READ_PARTIAL_BLOCK %r10, %r11, \TMP1, %xmm\i - PSHUFB_XMM %xmm14, %xmm\i # byte-reflect the AAD data - pxor \XMM2, %xmm\i - GHASH_MUL %xmm\i, \TMP3, \TMP1, \TMP2, \TMP4, \TMP5, \XMM1 + READ_PARTIAL_BLOCK %r10, %r11, \TMP1, \TMP7 + PSHUFB_XMM %xmm14, \TMP7 # byte-reflect the AAD data + pxor \TMP6, \TMP7 + GHASH_MUL \TMP7, \HASHKEY, \TMP1, \TMP2, \TMP3, \TMP4, \TMP5 + movdqu \TMP7, \TMP6 _get_AAD_done\@: + movdqu \TMP6, AadHash(%arg2) +.endm + +/* +* if a = number of total plaintext bytes +* b = floor(a/16) +* num_initial_blocks = b mod 4 +* encrypt the initial num_initial_blocks blocks and apply ghash on +* the ciphertext +* %r10, %r11, %r12, %rax, %xmm5, %xmm6, %xmm7, %xmm8, %xmm9 registers +* are clobbered +* arg1, %arg2, %arg3, %r14 are used as a pointer only, not modified +*/ + + +.macro INITIAL_BLOCKS_ENC_DEC TMP1 TMP2 TMP3 TMP4 TMP5 XMM0 XMM1 \ + XMM2 XMM3 XMM4 XMMDst TMP6 TMP7 i i_seq operation + + movdqu AadHash(%arg2), %xmm\i # XMM0 = Y0 + xor %r11, %r11 # initialise the data pointer offset as zero # start AES for num_initial_blocks blocks