From patchwork Fri Aug 7 16:19:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Botila X-Patchwork-Id: 253181 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA501C433E0 for ; Fri, 7 Aug 2020 16:23:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 854EA21744 for ; Fri, 7 Aug 2020 16:23:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="MvyMCRnl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726393AbgHGQVp (ORCPT ); Fri, 7 Aug 2020 12:21:45 -0400 Received: from mail-eopbgr140057.outbound.protection.outlook.com ([40.107.14.57]:4231 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725893AbgHGQVn (ORCPT ); Fri, 7 Aug 2020 12:21:43 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gg/i1CQ5kjyQ5Or1+Zay3AmsZnMD55UWypqe6QaLPscTX3Qk750PlqjpxA0qUMdNzqWx67jQmZ/hbUxnfOMPNbdSvpqvk2ItXbNEMQVBgjWWS1wWL/4mAZ0fQfbqajbMLjLrMRf7CwNfn7Fq1oqSojHVVkwagOqOfyrAfxANRQRtzIWNNRhkBMmA+8MpGDGehWYU9WphBxf1H0efz9hIeKmkKxQecRSuofhsXaJCAxOmjAk4iSt2We2B7sRG26MEz2EbZkY9gvApPaoTpMfhVxCSY0CrLErVAbWbUMP0b+OpraSnFwNxTVuf8SUVxZykLWYL3mIgcaw2caaN9ssNcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YPYv2itGQcwrWyNwsRoUTLKkbMT1wg5R2IXe3MyBWv8=; b=jMn1yAQBi66+f0j34wrBqwOaxX0ao6vmpB6BUl4LgW0r/i9psuct5tOA+zAdrD1y3f/8+o2SvcC+88HCyAwRQs6kh3teNyt6Vmt66bIa7xhjPS+0Y0nrbEMMQ1BoAs+BNYKbLueaCT1onm+s32/oNA7CHgZcPSbkcmAiJdlQcLFuC46Da90ah+13j3xSeFGPJ8WKx6FSViNXrnYhdI7ooQR17S+ZvBs0hS1SXlqQ4fQpvykhZPTWDYIOOk6dEh0Hm0LHbqZJTZaHfjRg7xXHyiD8tSnLITXWQk5DNMkM6byJiE99wiHXelrF8zP6hu3xfwLTSuV5ZLA3dr/KNzwgpA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YPYv2itGQcwrWyNwsRoUTLKkbMT1wg5R2IXe3MyBWv8=; b=MvyMCRnlc70HAU5RLwJ8qe3LZzra/0l/CVqqmo3S/fqRLXkZ1OQKIVoRjcDxyA/WYu6tvcP4RP61G2+NLAorOVBXRze4pnU/T+CPqtycInc030lnS6BHtonwIPIGI/WuYI8DF4R900AqWlC2xpgTkwGdRGq1pXoVrZCqHG/W47g= Authentication-Results: gondor.apana.org.au; dkim=none (message not signed) header.d=none; gondor.apana.org.au; dmarc=none action=none header.from=oss.nxp.com; Received: from VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) by VE1PR04MB7359.eurprd04.prod.outlook.com (2603:10a6:800:1a0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18; Fri, 7 Aug 2020 16:21:39 +0000 Received: from VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d]) by VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d%6]) with mapi id 15.20.3261.019; Fri, 7 Aug 2020 16:21:39 +0000 From: Andrei Botila To: Herbert Xu , "David S. Miller" Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-arm-kernel@axis.com, Andrei Botila , Russell King Subject: [PATCH 01/22] crypto: arm/aes-ce - add check for xts input length equal to zero Date: Fri, 7 Aug 2020 19:19:49 +0300 Message-Id: <20200807162010.18979-2-andrei.botila@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200807162010.18979-1-andrei.botila@oss.nxp.com> References: <20200807162010.18979-1-andrei.botila@oss.nxp.com> X-ClientProxiedBy: AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) To VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv15007.swis.ro-buh01.nxp.com (83.217.231.2) by AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.15 via Frontend Transport; Fri, 7 Aug 2020 16:21:38 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [83.217.231.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 52d27dcb-7553-4d1b-c25f-08d83aedf69a X-MS-TrafficTypeDiagnostic: VE1PR04MB7359: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7826N4gn8oUxpE+6mblzB6xT1VKKyGvJhIknb/XgfNUr9TrICKw8gWjxbm96XqAkJMK62iG3ehJxpsII3Nq2yiJiOyakvRiKOM9AO/vjyZ3UiN4VYCVuKp3mWHcTSWtyDQihDUpke3xzPk1LmPXtXgM26vv8McKfd5jun9rOeqlEpapSMhbBoaJrUzuih1+zJ5/uQAM3xxQE3BgUxD+HbTTQu6nNNxZ0TNYZKo5TsBExRNTbhuxIoKbuvSaFtin5DbrO7Jb47K1sS6t3UXS7Kl65a2l/15AhjOlTLXQAw3Ca/cNUTKnOAc+4jKxBq5SMUO2tMCPyPBJTH+ew2jhZ0g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6608.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(366004)(136003)(346002)(396003)(376002)(44832011)(66556008)(66476007)(110136005)(7416002)(54906003)(1076003)(6506007)(4326008)(66946007)(83380400001)(8936002)(316002)(26005)(956004)(186003)(16526019)(478600001)(4744005)(86362001)(5660300002)(6666004)(6512007)(2906002)(8676002)(2616005)(52116002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: /TNIYmfFIgyhtULMYTgFAsGfScfkFq7YD0b+JNnaQSdr+5blOz2mRjm3NND7/tZ5FjoGu83/8B/DQi86HVOGb1wt8VZ0R9ljdmWX8JQXnwWNADhFRGGIi1qiz1S6ot/WrbIMTpa1UlMP+bk68oLmjFmKf+CMmEdwrUkLWyC1W6dFjuzaIfuCRlMei3wZHUE18Tlr4KWXe/Z2VpjyIRJ8x+VIBKzbD4WHTvF5oyzZe1EyCRL7SehC1cULdyyQ+udfoIg2kclsgj+OIh2aT852m+RvLHbnz9I5DquD8PBdoW6Tng2fLbSdhJRVAmXd0RD0lMifEjZoAaH9YlnSYnjCAlBRWTACGDTj0LZXSU91IGcmeyZGNckdgxB1x8xQLMdaQoPngl8IiYaO3tMSi21Ein4Au9nlFCQpuvN/mpHJOFppmfjY80vfJaNP6tJEq7fMkspzABPryxvnZevvjGmGFQ4/mH84geZjVAjG6aiOQJ8GPcaWpYFwVE6JNYiR1c6PubkfIjZq+63n6K6M5Q81eG1bawclZmWiPGkHhYK72yK9ummsAKT5kUl2yooQKrNxQ4xMu8wW/kN7OUcJE/LbpLPKEacjfxhjAaB665TQLi79PozzStocrPkvkdbKNnDKff8MkAa9e3RwsGYk5nDxYQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52d27dcb-7553-4d1b-c25f-08d83aedf69a X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6608.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 16:21:39.4441 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HcmITPa+uegEfalX5ZDVKgdRcXHxD872TJKI65R2puY8uuaCk78SWqGstYoEGa/YSzGXHiM8lvnr3kZj/KD0QQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7359 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Andrei Botila Standardize the way input lengths equal to 0 are handled in all skcipher algorithms. All the algorithms return 0 for input lengths equal to zero. Cc: Russell King Signed-off-by: Andrei Botila --- arch/arm/crypto/aes-ce-glue.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/crypto/aes-ce-glue.c b/arch/arm/crypto/aes-ce-glue.c index b668c97663ec..57a9cf7fe98a 100644 --- a/arch/arm/crypto/aes-ce-glue.c +++ b/arch/arm/crypto/aes-ce-glue.c @@ -452,6 +452,9 @@ static int xts_encrypt(struct skcipher_request *req) struct scatterlist *src, *dst; struct skcipher_walk walk; + if (!req->cryptlen) + return 0; + if (req->cryptlen < AES_BLOCK_SIZE) return -EINVAL; @@ -524,6 +527,9 @@ static int xts_decrypt(struct skcipher_request *req) struct scatterlist *src, *dst; struct skcipher_walk walk; + if (!req->cryptlen) + return 0; + if (req->cryptlen < AES_BLOCK_SIZE) return -EINVAL; From patchwork Fri Aug 7 16:19:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Botila X-Patchwork-Id: 253191 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03F7EC433E0 for ; Fri, 7 Aug 2020 16:21:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE6F122CF8 for ; Fri, 7 Aug 2020 16:21:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="JVzmN+Ku" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726644AbgHGQVz (ORCPT ); Fri, 7 Aug 2020 12:21:55 -0400 Received: from mail-eopbgr140057.outbound.protection.outlook.com ([40.107.14.57]:4231 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726061AbgHGQVx (ORCPT ); Fri, 7 Aug 2020 12:21:53 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=itJZ/ayVxDV6b0vUH63pYmh4iJfhNZuqmgU+AAaJPgYRWFg/XUNO76BsvI7N328LOoc6NV/VJetT/wVsYwRedBf/Y9S5s6a/PN3DfxOQSU99Z310c2WOVsrNmeSbInIFDQoMfuSLRrh944EuCuDQYdK7ODcRqlu4yKpddhYSyE6vUoKhL/dV+hSqrNodFRLhE/E88RYo53/zKl8stxBLofJ32CnZFcyWqWwlaWBBLIB2bG2KarqW3jK/ic0Rqria2C01Ckgqdhbuwr5fuIqeqZHpI8ZKpfl4DhtlgZpmzCMqscwc/r/vR16P6Ln2JnNERYqsMhIzXqa0AsGPApDbfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3mSyozIYxpTr4iLhAEcKEO/usjLA+Nbis/QrBJkUzJc=; b=RKI6st3zHQ+LJHzSpdPT2RyrCgZ72iWh8vVPBwJA4xs9fF7MMIoefAxXn1ZkxuZD7VeSufgFAPVWUzUmaROrJ06VGk7iSh4SXX1Xt8ZcLxv1/1EETEPQjHhZsa5W2GP7YnLWYQmCJT7MJm3+XeZ0ngpll4ogE67LbkeN2H9boTCYA7BtJZBiuVI8LUqQ8i9g6DIdOxIr2Jo67aKa5P1JzbNPjoyxf8oW816VB2tJuFPgAIp1yTM7ZGD9IxU1EfVtsMQDm9IszrKlYF5sg1ndG8X8goaA/41xOWvxoirsnoydWJNci2MlhXDgVc/5M7GZR21BTaKKQByqHaWwHuA4TA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3mSyozIYxpTr4iLhAEcKEO/usjLA+Nbis/QrBJkUzJc=; b=JVzmN+KuaXg1wi5gcOSHs/Q8UNgz+BroBm4uTgpDk3fl4G50lIOloTrLPv4aF1435dsIKfNgDkbPuNj4SAjHxgxJYtjyLm+/Qk8PLQzvwe3fiDpmfrCvT8GWZpS80LEfcJVBCdCB8N3dlrSYVI9Y6b3o9lmlMuru5nlg3W1nGCQ= Authentication-Results: gondor.apana.org.au; dkim=none (message not signed) header.d=none; gondor.apana.org.au; dmarc=none action=none header.from=oss.nxp.com; Received: from VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) by VE1PR04MB7359.eurprd04.prod.outlook.com (2603:10a6:800:1a0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18; Fri, 7 Aug 2020 16:21:46 +0000 Received: from VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d]) by VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d%6]) with mapi id 15.20.3261.019; Fri, 7 Aug 2020 16:21:46 +0000 From: Andrei Botila To: Herbert Xu , "David S. Miller" Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-arm-kernel@axis.com, Andrei Botila , Catalin Marinas , Will Deacon Subject: [PATCH 04/22] crypto: arm64/aes-neonbs - add check for xts input length equal to zero Date: Fri, 7 Aug 2020 19:19:52 +0300 Message-Id: <20200807162010.18979-5-andrei.botila@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200807162010.18979-1-andrei.botila@oss.nxp.com> References: <20200807162010.18979-1-andrei.botila@oss.nxp.com> X-ClientProxiedBy: AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) To VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv15007.swis.ro-buh01.nxp.com (83.217.231.2) by AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.15 via Frontend Transport; Fri, 7 Aug 2020 16:21:45 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [83.217.231.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: fa1fcf7b-bd37-486d-5677-08d83aedfac5 X-MS-TrafficTypeDiagnostic: VE1PR04MB7359: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qnOkP+mtiuyFK3Ar4lYwASTBLMs5VIovTWz+3PriHcxpSmWHnYmjkw6CneDNFX2qWuUM/6CTVFpATtxHVfF7vHIeVzB0jaEx+IXGQY+k0W/eYmOP2o9I1wuunV5Onl2LBA7krqsAMTondwJUeR6QC6e1ddZ1O4Xz3oaBGsy0lib/htjI99Lp2tgoetGWPgjJPxYd5n3bBdwRlX3bsLSYk36PDwXfBsKul9vj0ii8liJtz8Hg+oBPVJDj0PBv5IQQ7kNbPp/kMaO9tvJZBNiTL0aRQaG43y9WkhLoc/DWSiWqDwC/tSaN6IUZt7FpuQYzu7ilZGji3sJa6CsqGg+HLA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6608.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(366004)(136003)(346002)(396003)(376002)(44832011)(66556008)(66476007)(110136005)(7416002)(54906003)(1076003)(6506007)(4326008)(66946007)(83380400001)(8936002)(316002)(26005)(956004)(186003)(16526019)(478600001)(4744005)(86362001)(5660300002)(6666004)(6512007)(2906002)(8676002)(2616005)(52116002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 0kJfl4HgZ/fOh3bkuF6n+i5JVN05X1PbW9wkNExix42d1CJLrThZh7xn7BlRdTLvtAnAqGrgFqKBcXHvwsRR9wMyhcs3keQcz2Mi9rPlrw7fjyWtKVQvU9nh9bMHiCTrntUgDfZjhB0kp4KBYfzC+B4vZss7BduM1Mf2nZezRj9MZPYuhggZYC8mAG+5hPDvkw1BYSdNTjC4TnEdQ1ZhpffMqcJxRR+yZdQa1B25nR1qx2YZKIiXQ7Q5GVH94jZZ+9U34JuwfosB9BIuoBDxa/ofsRwLA3HC4DJAGNecCej1XI5fnglnwo5AujTOw2RPFg1p6QDkOFckJaAT3G0gTcOS8RM46+PR092oxR+2CtL8q2KE+8A09cyTu1QP1gUmGuZzbFnU0fUD7VPzNf7jR+MYveRK/PMejgypvFlLtArlaEYA6DGDYp/SKmd9KsVYId4VKUI1kC8Osrp6ycMAGyENIoM1LUVLZ0z4PlhhOv6kjZ4CQnQB9Qef09RRI811x9kEsijMRdaUhHYpnHyOJxkkDdQeTIB0CpYkaFIPWB6MUefqicJwRduRn4koHaWwICbg/hCISvuAkXU/d0WmOvQvu4fgA2ZlQYaRNVDFKMffgyhbq0LG0Nm4vfU5BL6RMrIkJSNRFYPKYsw4QKSOAg== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa1fcf7b-bd37-486d-5677-08d83aedfac5 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6608.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 16:21:46.3750 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gpyozUUlEUH2XUmrXhZJcC0qK7Z1gwrmvrsVWyovdENAx2OKCZ5pBgP68zjcWYf5grSidsL4U0XW+8o6Dm0tkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7359 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Andrei Botila Standardize the way input lengths equal to 0 are handled in all skcipher algorithms. All the algorithms return 0 for input lengths equal to zero. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Andrei Botila --- arch/arm64/crypto/aes-neonbs-glue.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/crypto/aes-neonbs-glue.c b/arch/arm64/crypto/aes-neonbs-glue.c index fb507d569922..197bf24e7dae 100644 --- a/arch/arm64/crypto/aes-neonbs-glue.c +++ b/arch/arm64/crypto/aes-neonbs-glue.c @@ -330,6 +330,9 @@ static int __xts_crypt(struct skcipher_request *req, bool encrypt, int first = 1; u8 *out, *in; + if (!req->cryptlen) + return 0; + if (req->cryptlen < AES_BLOCK_SIZE) return -EINVAL; From patchwork Fri Aug 7 16:19:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Botila X-Patchwork-Id: 253190 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9AFAC433DF for ; Fri, 7 Aug 2020 16:22:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8253222D2C for ; Fri, 7 Aug 2020 16:22:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="jx77oLku" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726862AbgHGQWA (ORCPT ); Fri, 7 Aug 2020 12:22:00 -0400 Received: from mail-eopbgr140057.outbound.protection.outlook.com ([40.107.14.57]:4231 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725900AbgHGQV4 (ORCPT ); Fri, 7 Aug 2020 12:21:56 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mouT2c/u1+DBJKizOBD5TQZvVpExZTTcNpdMnz/DyMRLCJMWPOLJNRXhG0NhT4LiVsQv6cch2wXZr2QxVT/yAUDu6/HkwZENkRKUserg3WwiC65Gf6bIm9qmeu3PLbZ6ZKBzJ/WyldJ3V8fZgvsdGgrkzVe0wvsXtig2ych6nMWk/87kx72JB67YgenhrVzAfUKXcvnKw4QJL53Za0Uq+AFAto3xewZ+atThiVs8A7pPwJhwXiCTTGpTg0FHalNSkrpNbKUhMwwfnbwL9P9P0CQSkjVl+8TWcYHBPtmfR6rHBnfkmQZVW3teDDeFrrXuBsRheItnVM+2yVzi29UQxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MOsgevlBUBBEz/eyig9c+f8iUh8LaYgPHgmviFsTopA=; b=GQVZ1F235EiAIhkgbsKOZ/o+IAG8BBYVbKfLCgUma0IcKXMvkTyz4cR6pi/qCDML0pRj6GK9Y46uGCWYLjVhpG8+dDgAw8pahylXz/SQY3QKekpN3oPXpbNG2B7xxbbKcNYIAoZXCpQ51o0CbpPseRoE76YNoOeaOS4NsYtvaALm/ODJH6TNwbKQCrxZrIoJmBYxrC/9qgcuKYqQtcklbXcus7ZX4e6Bo1jYyCB4VSiMz2q4FKxDDMPyEIUgQ202oLETZWB0n6Pn79Vm0kJxJlSUQ92vxshSJ9wWGoRoqd1DsXAWeZW/QQZKDSnqTk4wIgh1TbYJZdunn3odHQ0tKg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MOsgevlBUBBEz/eyig9c+f8iUh8LaYgPHgmviFsTopA=; b=jx77oLkuH7NJl8eqRmB4U/hjfz/9Z3qv8/vgGCgnGLlCuMyKBjQjgn0yJVZtKlvnM1yLsIcnMQ+s+RtDKjzropnC1rNJvB4Ih7whfJ1djRKuzMi0r/uN8YdezQwZJWyoZm16cIDLr5mkpOZbgvhuVVjsgLV0ap34rH1WIuD/AVE= Authentication-Results: gondor.apana.org.au; dkim=none (message not signed) header.d=none; gondor.apana.org.au; dmarc=none action=none header.from=oss.nxp.com; Received: from VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) by VE1PR04MB7359.eurprd04.prod.outlook.com (2603:10a6:800:1a0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18; Fri, 7 Aug 2020 16:21:48 +0000 Received: from VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d]) by VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d%6]) with mapi id 15.20.3261.019; Fri, 7 Aug 2020 16:21:48 +0000 From: Andrei Botila To: Herbert Xu , "David S. Miller" Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-arm-kernel@axis.com, Andrei Botila , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Subject: [PATCH 05/22] crypto: powerpc/aes-spe - add check for xts input length equal to zero Date: Fri, 7 Aug 2020 19:19:53 +0300 Message-Id: <20200807162010.18979-6-andrei.botila@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200807162010.18979-1-andrei.botila@oss.nxp.com> References: <20200807162010.18979-1-andrei.botila@oss.nxp.com> X-ClientProxiedBy: AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) To VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv15007.swis.ro-buh01.nxp.com (83.217.231.2) by AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.15 via Frontend Transport; Fri, 7 Aug 2020 16:21:47 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [83.217.231.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a0a2904b-c726-48b8-9361-08d83aedfc29 X-MS-TrafficTypeDiagnostic: VE1PR04MB7359: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SlMo3UkERYXaNTRbHivDoBTwPH2QHtZ7DPiFvk3FsRAWLh4olJS+ji9JgECPxsiD11bRJe2wGeU2VKcaP+TbbG/EZ/n713cVOTy1g6iSb5UqRRZ+Ij387Hn17bc2PD/qQTTvo7RYUDqSQcyr6pRKQvv1vzzGvSHYyvZn4Leuq2Sk86auB9j4nN38GyX+5z9DakNuvkaQ3UORdHV+StQvDZe2Pvloh8JvYpXxEjwUnew65U3ykop5R15MXFWm2DpM5vgokgcDrEnE6B4CRv6227rGtelcKAybNUYVWlEygZXOh2uF8irDccBo+OeaxI2/cXI7OHYdglpzrF7PN1BMLw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6608.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(366004)(136003)(346002)(396003)(376002)(44832011)(66556008)(66476007)(110136005)(7416002)(54906003)(1076003)(6506007)(4326008)(66946007)(83380400001)(8936002)(316002)(26005)(956004)(186003)(16526019)(478600001)(86362001)(5660300002)(6666004)(6512007)(2906002)(8676002)(2616005)(52116002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 80uQ+mR8lo2leMv25PYS5ntfEGVoPyFwoHUYixix5va1WNCMacazOP/oLi0GOdc5OvAyh7n+evnfZySeeui3U27gAdNCkAYKTnSTP3wKclOcM85BQ4p0ghjjA9hDobwqYxIoxAWK3rlH4pSjkoYYQ8IUwrz4+JgTh9cH33Wo0dpSCmEcWVTgCOk+yCkJTtXMcuAb6FB7bHqld7IgP2ij993rvSh/+IzrNKa0X7KjNS8i+5wBmOSTsH+Yr/b1kfwnCob/2feZnuZuemwGvsPHrkRyD8YFDI1tnBbUfl+4Ludaznp0FRgfNfAu7x+llofMIwife3RWkHMdLMcUY1XKfeHDGOfgH3mg7G952MC/U7g4CMRqAL7BZJZ4sHP4ouFbjhbTzV7v/yF31XHTXuHUuv0jyivC5lOszeD6eBV0vwkH9GEPwf64+fPHAj5GvvXhqkigPN7qdsL9tS9+WLuSGkbd7BefI/iAlKqPj8B/ie6iWIPqvkjg6/bXn6Vyu8UDvUHJQ56pU65K27V7OaK6SzhJdO2ktxptqUGHieBqDSEyRfpDsOarMTKRWQHjmXi1wpF0V7awBD5nR6Diy1FOT4kUY0dCdF/1bK9Pq0O44NNdNGZwmWuG08ttx3TJEGBDWn4M+Pbi/tKBlpKn/46LqA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a0a2904b-c726-48b8-9361-08d83aedfc29 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6608.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 16:21:48.7117 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QWHxSCJHobGip8nPC0v3p21ehJjwuTt23qqmeX0HUXHPpJzfyhLcYIs6M/hgIzqJgpG5ODKSmBV457M3B56+rQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7359 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Andrei Botila Standardize the way input lengths equal to 0 are handled in all skcipher algorithms. All the algorithms return 0 for input lengths equal to zero. Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Signed-off-by: Andrei Botila --- arch/powerpc/crypto/aes-spe-glue.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/powerpc/crypto/aes-spe-glue.c b/arch/powerpc/crypto/aes-spe-glue.c index c2b23b69d7b1..f37d8bef322b 100644 --- a/arch/powerpc/crypto/aes-spe-glue.c +++ b/arch/powerpc/crypto/aes-spe-glue.c @@ -327,6 +327,9 @@ static int ppc_xts_encrypt(struct skcipher_request *req) u8 b[2][AES_BLOCK_SIZE]; int err; + if (!req->cryptlen) + return 0; + if (req->cryptlen < AES_BLOCK_SIZE) return -EINVAL; @@ -366,6 +369,9 @@ static int ppc_xts_decrypt(struct skcipher_request *req) le128 twk; int err; + if (!req->cryptlen) + return 0; + if (req->cryptlen < AES_BLOCK_SIZE) return -EINVAL; From patchwork Fri Aug 7 16:19:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Botila X-Patchwork-Id: 253189 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24CB1C433DF for ; Fri, 7 Aug 2020 16:22:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0008E22D2A for ; Fri, 7 Aug 2020 16:22:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="ixO/4pj9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726061AbgHGQWI (ORCPT ); Fri, 7 Aug 2020 12:22:08 -0400 Received: from mail-eopbgr140057.outbound.protection.outlook.com ([40.107.14.57]:4231 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726891AbgHGQWE (ORCPT ); Fri, 7 Aug 2020 12:22:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=koRfX+ELIry8gzN36D4+VCbXKEK+oiebuagAJbFX5mS/TLfxfNn8djPyY7wAnbaNYj8znM8wFCN7fNi2gPngpKbaXsy0eTN/YHM+kAuVyOdX1IBkeZoebaPRyynD68PNR4Pj3X+dPO+9tuegMQ4Bnk3lg6uUgIBlxAFZjZ8ttsCC+4r8kdp+51ATuYpqeNOJrRADSdqQNmpNr++9m99VHeenQjtukvn3bcZNyaG9CaaDw6a7qd4p45RrZPh+eqtlJE9pmn99XwDdIejzpyNn/tUQa+2W//Lf6F+veGITpVOUrsViEVAXYjAgCiSDMZbtxfSncjiWmj0BeEycPOL1XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w9ehk/al5YldKkn6kPZlc7yCIC51d6sPnLi7zv7o5MQ=; b=TA02ZiLu2kSNyppoqtiH1lTzU1Yg63++Sjz4bcIS0RreAnNd/6VcXjA2W55B9Ds0xOBs2g/Y3IIjuG5LfSIRiKsQ6VU+PUB7nE6THZHX35CO3Vnj08Jffw9z62+cltygdVI9TZF0ljhdzM50a0TCOffX2gBzmtuAoQw+MJznmgHlaTB7zpBJJPCm/hBPC1zNdfHNo3ND9TRvIDo15FnhwUH0cOpIqawfS5Ydbj/kqBCbQ/olLmmqRYsxy4NrBe1rWd54PKCk8rQOhDbTKm7iLd91Ie9EHfsX5hANZume9KOz3aDbxSj2+ZAhCGKQnzQWxAmZeZmYmykt7Nc8FWSGjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w9ehk/al5YldKkn6kPZlc7yCIC51d6sPnLi7zv7o5MQ=; b=ixO/4pj9sQPI/UVNiEnreOZN2kqwYPRnexa6eSvmasqSVojOKnlw2CAud9s67F48n9dUNCQxDxvUCilsKGU2eR3vUJpmHZVO2WaYWAlUhYZffGByMh0J7yec9uiw1gewPJcikybji/Sc68oFvcxqvGH1YGSvcpNHZiAGeqg9eiY= Authentication-Results: gondor.apana.org.au; dkim=none (message not signed) header.d=none; gondor.apana.org.au; dmarc=none action=none header.from=oss.nxp.com; Received: from VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) by VE1PR04MB7359.eurprd04.prod.outlook.com (2603:10a6:800:1a0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18; Fri, 7 Aug 2020 16:21:53 +0000 Received: from VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d]) by VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d%6]) with mapi id 15.20.3261.019; Fri, 7 Aug 2020 16:21:53 +0000 From: Andrei Botila To: Herbert Xu , "David S. Miller" Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-arm-kernel@axis.com, Andrei Botila , Heiko Carstens , Vasily Gorbik , Christian Borntraeger Subject: [PATCH 07/22] crypto: s390/paes - add check for xts input length equal to zero Date: Fri, 7 Aug 2020 19:19:55 +0300 Message-Id: <20200807162010.18979-8-andrei.botila@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200807162010.18979-1-andrei.botila@oss.nxp.com> References: <20200807162010.18979-1-andrei.botila@oss.nxp.com> X-ClientProxiedBy: AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) To VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv15007.swis.ro-buh01.nxp.com (83.217.231.2) by AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.15 via Frontend Transport; Fri, 7 Aug 2020 16:21:52 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [83.217.231.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9325de9d-1130-4bde-e6c0-08d83aedfee8 X-MS-TrafficTypeDiagnostic: VE1PR04MB7359: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xwG8XlwbJs/hww0tE8xCdhTAO9ATvOBwD+x/Ojy0NW1xaY0tmtrIqaEec6F4GWHeQSdzMiqm1F0sruEFvs1fdLz5VhSLd8tm62ZMcELsGRIuT/nmIccXHIogmtoOfVFOequAwr9fIC3c3dict3uOgjdanmDrbVe4O3MYr08NyZ747WHrIKa2RKkscQ+IsIMLyydxJ2/wRL2YK5Qvf0heWbHc8HOU8KIsOgwKSy/GxXpJs1GnVS4LnoMDceVTJfZ5ZNL3F+t9l7RTb+6Q4M4whprg6OeMtEsx4Zm78qi+0oUUk34OXfxFDaMjZ7bj7NvkACiPyqerl7wL0QWGiQ3wow== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6608.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(366004)(136003)(346002)(396003)(376002)(44832011)(66556008)(66476007)(110136005)(7416002)(54906003)(1076003)(6506007)(4326008)(66946007)(83380400001)(8936002)(316002)(26005)(956004)(186003)(16526019)(478600001)(4744005)(86362001)(5660300002)(6512007)(2906002)(8676002)(2616005)(52116002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: b0gRcUDAUPn9zlDJ+oJQOX1SY4FOixk8zoR6ynwWNhkSQosARDIOO3Xncp+xiFctcG3aHC6lXx04F4qYXrSn1u+saG589b4hx/QNFhs8T4AsJnw8vk5Xw7yuo+zl4MlFApisHiAcSj9f2kEbPf3CSuqiskenojvHgHmMiLCK72BCLIYeQ20R6EpT+zsxYOYauuYupiPgDCrRgedot97twK8+eJedcl0asvi1+Xu8U+hGUTPjLK6ucoZJZQ1uJWf5/EPTcV+x7PWhOfT0MHSHd5tvaZ/IxjiZjA4IAF7f0NIMSfDjOLugXgCvu7lHMYcr/9U/bhvMDKPdKjm+am7jzcHWZInbRg8hAZOkS6jI7/+iTViDf9rrhdV3oxibj5TqvlHHtDdRetdJim6pztry3gSAuoqSXcH/KC6i1ceKddlapXVmmHc+/afir73O0vpDIEJMVxIxtxVCPpDTYIBpQnvRwdfDFpmBPMWJ2ArBBU8rj5UIrERo0xTfe9cv5F51qIOtfd8pLg4VHnxgI0QYGRFMwqfSyfs/X82V25xdladQ75HMEAFQSlDWnF7/fgqv5kw2wsiGr08uXWvohLkE6VZFUCb2HfYSHEKxMuRLbkbZVgtUHshyCe8tW1HtZKdCH2F3ClJrmZ6/rxwm4RWIcQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9325de9d-1130-4bde-e6c0-08d83aedfee8 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6608.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 16:21:53.3300 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XyEk4SFo4p/DP/2GZhNfsFgmRZcR0ccOtJ/TExqOYb8JO1/ahBBlI+Z/1x+SfJeUb0R7y/jy4u73EJ1jjSHdlw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7359 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Andrei Botila Standardize the way input lengths equal to 0 are handled in all skcipher algorithms. All the algorithms return 0 for input lengths equal to zero. Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Christian Borntraeger Signed-off-by: Andrei Botila --- arch/s390/crypto/paes_s390.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/s390/crypto/paes_s390.c b/arch/s390/crypto/paes_s390.c index f3caeb17c85b..7f0861c6f019 100644 --- a/arch/s390/crypto/paes_s390.c +++ b/arch/s390/crypto/paes_s390.c @@ -494,6 +494,9 @@ static int xts_paes_crypt(struct skcipher_request *req, unsigned long modifier) u8 init[16]; } xts_param; + if (!req->cryptlen) + return 0; + ret = skcipher_walk_virt(&walk, req, false); if (ret) return ret; From patchwork Fri Aug 7 16:19:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Botila X-Patchwork-Id: 253187 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B73CDC433DF for ; Fri, 7 Aug 2020 16:22:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 98B5822D02 for ; Fri, 7 Aug 2020 16:22:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="csn46IjW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727044AbgHGQW1 (ORCPT ); Fri, 7 Aug 2020 12:22:27 -0400 Received: from mail-eopbgr140057.outbound.protection.outlook.com ([40.107.14.57]:4231 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726929AbgHGQWI (ORCPT ); Fri, 7 Aug 2020 12:22:08 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uj+bl0hWv38k+Ko7q3PtXnFHFlTM+6Pi/3rGdH3EgRnU7mWYcQ4xwhxZ7idaJUoUntO8kQet4j8LnqF1YnuudvP1pYxm04xHFpvwhByXeuaMi6MvXcDLU+YjI1QycwHHGZ0eSp/uds0WZYbl2dsvZcvuajItrIAhZrTXwOPu+Vcr/QBA0h3ATiG2ywJOtesBWPMdSx4gHaUkMcp1mbAncpFB9kFqjtFFP6fzIOia4y4EnFccK9GQpphOJXQnBBvdFJtcrz9yikg3AjgD8uDiHBFWg7cCyqoKaTqZ9ZoLIV/0bEECKniy8PCDPEZR9SSunTUzA9hXl44exiN2mXTGNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nrZKNq9DZSJg/8lM9Akg9mQ7matGo6hu9ue2IJwmlwg=; b=KAiNYwoOf4OQM0giUwHEgjsIKSFi7775UWb6JGQMTWtSHZqc9pg0wzxm7o80qrX9Hj5XV39i+waC2++YeQnA6OPbbWeFcZs3KmEOjvtxWOcIWQrEdTWVB4ufjaJkP+Kyn+COugN871nQYRMi1WuYpN4Am9T5D3WNaAaVch2yevq4WICn9vnMspPPVJGtW/C0G+6/JsZW8O1l0Pr3RKz5xOFJ0hPLB7MP33cyEnn8hCdYs6w7MZvE9nuLncnPpSHz/wWOYhsTw/eP0vyOhFQALWJRzo2Dz/DnTh/8wgxoKHn6CeJSOw1VL0SKncmq6eAum5SwXHB1QrL8zJI/tzLLCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nrZKNq9DZSJg/8lM9Akg9mQ7matGo6hu9ue2IJwmlwg=; b=csn46IjWEujcEbNld5nMqlkVNJ1oRIdmHT1Pcu1mdzEUkLY48jA5vQjZS8QNNzJlbkYPjCgK3NjVk2bBEa8GAknHwml9BVNxjwyimhmAY3kE1HB+wHRo9Trg1vV3KQ6f0VYoi0ebWIWwftGWnLuSLwrm4CYBVxAu+eOphiZtYiI= Authentication-Results: gondor.apana.org.au; dkim=none (message not signed) header.d=none; gondor.apana.org.au; dmarc=none action=none header.from=oss.nxp.com; Received: from VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) by VE1PR04MB7359.eurprd04.prod.outlook.com (2603:10a6:800:1a0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18; Fri, 7 Aug 2020 16:21:56 +0000 Received: from VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d]) by VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d%6]) with mapi id 15.20.3261.019; Fri, 7 Aug 2020 16:21:56 +0000 From: Andrei Botila To: Herbert Xu , "David S. Miller" Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-arm-kernel@axis.com, Andrei Botila , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" Subject: [PATCH 08/22] crypto: x86/glue_helper - add check for xts input length equal to zero Date: Fri, 7 Aug 2020 19:19:56 +0300 Message-Id: <20200807162010.18979-9-andrei.botila@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200807162010.18979-1-andrei.botila@oss.nxp.com> References: <20200807162010.18979-1-andrei.botila@oss.nxp.com> X-ClientProxiedBy: AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) To VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv15007.swis.ro-buh01.nxp.com (83.217.231.2) by AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.15 via Frontend Transport; Fri, 7 Aug 2020 16:21:54 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [83.217.231.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ff60be81-d101-48d1-24e0-08d83aee0078 X-MS-TrafficTypeDiagnostic: VE1PR04MB7359: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IpXISqCWvOq/6h5skve1p7RYEqqimRYuIlBZJ+qWWMqP6om7+SHLPGPpv/Xlc02yjDGo3Ad8gEdyDR+dFJU6cKG1I8RvS7IwMedZmCfoKqHVpNG0A+Qpzp6MXaeukSUBCKYTOpPegJu0IAFYHDKKwWGXk+50AMFuVnkAIMATh6WbyYS9lR2bVBoesSh78kBMM+RUSB17vuKXnRM9Ds9jTMFsINdbLqyvdAPSpM4IC4VL9JpNOPUcMgQ4c9/bfJ5BInrIO4L0nKLdRLWjDqGMlbMl7LuT9QdJ+GCprfY2UJzYhHgCqqxDfyhOwAMkNI6mtOSWmltpb1p42UEDi6xOBg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6608.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(366004)(136003)(346002)(396003)(376002)(44832011)(66556008)(66476007)(110136005)(7416002)(54906003)(1076003)(6506007)(4326008)(66946007)(83380400001)(8936002)(316002)(26005)(956004)(186003)(16526019)(478600001)(4744005)(86362001)(5660300002)(6512007)(2906002)(8676002)(2616005)(52116002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: AwEDIqsj/ePUA4tBWZ3fzM+HhVyebB2vAqoKm2BJkPXmxF5ylcbxTIhap1rU4X1q+P0xnZeWZT1j211lkKC4kmlTuJmT4/SmylprVpDTcsokySyBsFvswsHcGfT4XHNQkVqs9eQdDc/E6punaZk14GxLo1x6wZRYZaF+o5J0lh5rfJ7Imvk8lD/P9Gkgb4QtaMD9TCARXA1XLvHe/ec6MJHjmRCHpErKbU32TX/FVaOJdKzlcfDKxt6h7zQLLzgir9CEt6x6fN14PGqitCTxdzhe2jkI4Cm2epY3x2KT3PHWHJl/6pDSYoq/OzK7sNqOk7BnAWlj68+0LiQDaODK0nga5PeJq59qUmA+WmT5lf27JPT+Yhl5gALMmP/YWB53eVZW0waOB2mmq7vG9w2jl/zA8VUoUoN/JT0p5ucPJNoXKQNWaDVMWzPt43IF8q9zpd6XetG3XTaRYaTCNNudDGzARWxgJ5S3qi6UOU8tZdcX+ZI6d/S8RdxqWqalSHVuEVG1SKJ9IBYVFFedYuv/4l0NI2RiiSPPCCcZHw13kmwIjW0YzqiPkFSv0y64+q/VdO8OB4aD7Vu4N3rGP9jYvceBNmMaznZgt45YGhXs8+qX4EbNqRxBAdIkSGg2iS/lKTeuSDvXqiBm6+QzVuc58w== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff60be81-d101-48d1-24e0-08d83aee0078 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6608.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 16:21:55.9415 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rsD9cH37+giH3iLqApQdOeVUQIXillRiUWeJTvAfCoYQXlMaNgyNbIXcr3exZWYjhBNfTn61d/3vzpUy28UyVg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7359 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Andrei Botila Standardize the way input lengths equal to 0 are handled in all skcipher algorithms. All the algorithms return 0 for input lengths equal to zero. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Signed-off-by: Andrei Botila --- arch/x86/crypto/glue_helper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/crypto/glue_helper.c b/arch/x86/crypto/glue_helper.c index d3d91a0abf88..cc5042c72910 100644 --- a/arch/x86/crypto/glue_helper.c +++ b/arch/x86/crypto/glue_helper.c @@ -275,6 +275,9 @@ int glue_xts_req_128bit(const struct common_glue_ctx *gctx, unsigned int nbytes, tail; int err; + if (!req->cryptlen) + return 0; + if (req->cryptlen < XTS_BLOCK_SIZE) return -EINVAL; From patchwork Fri Aug 7 16:19:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Botila X-Patchwork-Id: 253188 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5EC6C433E3 for ; Fri, 7 Aug 2020 16:22:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9064A22CF8 for ; Fri, 7 Aug 2020 16:22:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="gd6IPzId" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727001AbgHGQWT (ORCPT ); Fri, 7 Aug 2020 12:22:19 -0400 Received: from mail-eopbgr140057.outbound.protection.outlook.com ([40.107.14.57]:4231 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726891AbgHGQWQ (ORCPT ); Fri, 7 Aug 2020 12:22:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TqOigEwgpG0rYl3UnxtkqMWeWQwTW/C8qUALHW0Vx1mfUEVFbSnxu34qxFOUnN+j6vVkxdnsfifqgPMSeVQdRQk+PgAK6tUgTrMLt+jJbD3XEImKyklNiTJYPNHB2K2hhDHbh7Uv+FSYeC5hW9NpE/4qLHegT941eWKnJybpwnCgzER3aCTA9gtIUFlAapKZuYytN+3l9TeRbwmsYAssf4YwwAPFZPYgviNUrNJGcPpoaHTttD2Ra7dPcVgX2Qckp5JH7a4xblxXRz9FgJm+xtBhchFEFOrqF33qs6oL7jgm9NQzGumoXZSWQkNJvwTgddurVOfdP6W2k/xNcio90w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gKUbz7IwokmTEaHfqLuPQ6Re62bDmfVBxGj27TTbExw=; b=IaGqoReGCJJV5rl3+yiwFX8W6/MOIjwJePJh7HRh6ZenRMfm2yxIF+xTNRme92tZcQYUeVfcU46JB9gMf/o4tkuMvlLgB+CKFjdRIoqvrNhoLELTl8m5/qomk8EUYcKUrOi2iJvKAHBlnyjgSTEiWedTPoIoz4RHhZ7xBJWQPRGyFQy16eDLOQ5iWJ3+Goy6nXk4Gw5V1pv0RaLvDQQrUj7dhX8+IWDg6hUBD2rCYoN3HoV1NFE6MBbYg9JUl/slH5CLyqoGqlBoDskg8xq19e7Z+2y1J3nB+5NLpJf83Ri7962o2WbbO5QN+bb5ZBYomDGP1NOoa2Z0O6DIc+u4Fg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gKUbz7IwokmTEaHfqLuPQ6Re62bDmfVBxGj27TTbExw=; b=gd6IPzId1uxHzMNgmsFcKJNDjlomAVSTW3dcjFz0lF1SBG0UuLxpAwNGtdHLUQyd5nlIQXZzk03VNA1bqyPPTMR8mhY/LLXMH1PhjKx3pZUYPKwK6a5T0rY6P2B4ZHcN2dYg5iLq8oAzPmcnn1whe/BlivMaWAKduRcMvGypPoE= Authentication-Results: gondor.apana.org.au; dkim=none (message not signed) header.d=none; gondor.apana.org.au; dmarc=none action=none header.from=oss.nxp.com; Received: from VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) by VE1PR04MB7359.eurprd04.prod.outlook.com (2603:10a6:800:1a0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18; Fri, 7 Aug 2020 16:22:02 +0000 Received: from VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d]) by VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d%6]) with mapi id 15.20.3261.019; Fri, 7 Aug 2020 16:22:02 +0000 From: Andrei Botila To: Herbert Xu , "David S. Miller" Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-arm-kernel@axis.com, Andrei Botila , Jesper Nilsson , Lars Persson Subject: [PATCH 11/22] crypto: artpec6 - add check for xts input length equal to zero Date: Fri, 7 Aug 2020 19:19:59 +0300 Message-Id: <20200807162010.18979-12-andrei.botila@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200807162010.18979-1-andrei.botila@oss.nxp.com> References: <20200807162010.18979-1-andrei.botila@oss.nxp.com> X-ClientProxiedBy: AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) To VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv15007.swis.ro-buh01.nxp.com (83.217.231.2) by AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.15 via Frontend Transport; Fri, 7 Aug 2020 16:22:01 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [83.217.231.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9736d86e-1695-47ec-dbad-08d83aee0467 X-MS-TrafficTypeDiagnostic: VE1PR04MB7359: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bUTiw1FsFK5h8IO1jarwWN92L+W80dIsWjCYtxjGRz0X0CuvLOHEme7vCBYuSwnkl9rVlj1R3Ks61YYiTogtkiCqMFRZTvEBEIgINvPgZ9HrWcI+fhkzmMDZRdTMLp1OnZJla9iogD7OJ92D8SbPk64Qe0WaUW9kttIMtaFScWEg8XiUPqyTTheamehHykSa9bKzIpbUzIag6gwfxUn58i50XOutCq8dpN8ej9JCqjM5C6zXqFG3GyQG1zM6FlMvFAF9cu+17prDzpTPK+OZZlVlNmnW7kTscz9eaVfiHZABq9iiY6Ov9lbiLEohmw9Pi48RwxQEToSsdef1zre17Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6608.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(366004)(136003)(346002)(396003)(376002)(44832011)(66556008)(66476007)(110136005)(7416002)(54906003)(1076003)(6506007)(4326008)(66946007)(83380400001)(8936002)(316002)(26005)(956004)(186003)(16526019)(478600001)(86362001)(5660300002)(6512007)(2906002)(8676002)(2616005)(52116002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: G6hI3qlLow7u3mB3XZA+7xFn5wI3dQwrMA8ZEMNV7+oC8Gf75ZQxCQLYetBdz9bDaGJPlN8PZly0H8plS+gwFlY1M/7q6qabZEn54celwp/rsqOOQSswYINdvPIXU0K53KbWu5v9tm93dWRA2sA4fxdLvTieU+jzIyngvdnyZsKG6Dj50uvn/yideCzlYp16lob1jruXku/mNgSBsmclE892KG17USdBjDL+h7blIN0z0RWAtlU01U8yRrn/61YbtrH5ZXokU+PoDWC/u8OnTwEN2F/d7vqSn+GBMM9i/WfY6uBGBPiY4HePx9w2TB1BKWf6CrPGy+kL8egG3vRJxAyNRw7pQl57bly8TUCZffjSGK6pWhRxaIURdUl8MjuPsiFAH9+fyJ9Ek60KAX45l/BfgUISgOKyTjWrv1KSaPysYzxPeQfmed0BpbxinfmP/T4jjJY0mFxJJ7rSPgZcCCpWy4LTkmL1XlO1Xcy5Sh0HvPlD02L30uC5NtV7yU8pO6gFnf7mdiEQAXpbPtXoaQItE6359Swn9ke8scKltWZ/pCU2CTEqXQVNyG91MjDoT4W5q4FFN7tpgqCRpji0/bB4qPTz+DX8wqUFUpbXFNVElbNVi/A1UFftRhddSWdtPnkkBJHthV4Zjvixmb1uDA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9736d86e-1695-47ec-dbad-08d83aee0467 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6608.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 16:22:02.5496 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ltQA+Aleb/fZ10gSG4RH2omcYxmBBjuR40NT49MsUI5l3yKmWaDLanAHV40uSD9Pqwl7T37fq0bPcmJsLUSzXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7359 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Andrei Botila Standardize the way input lengths equal to 0 are handled in all skcipher algorithms. All the algorithms return 0 for input lengths equal to zero. Cc: Jesper Nilsson Cc: Lars Persson Signed-off-by: Andrei Botila --- drivers/crypto/axis/artpec6_crypto.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/crypto/axis/artpec6_crypto.c b/drivers/crypto/axis/artpec6_crypto.c index 1a46eeddf082..243880c97629 100644 --- a/drivers/crypto/axis/artpec6_crypto.c +++ b/drivers/crypto/axis/artpec6_crypto.c @@ -1090,6 +1090,9 @@ static int artpec6_crypto_encrypt(struct skcipher_request *req) void (*complete)(struct crypto_async_request *req); int ret; + if (!req->cryptlen) + return 0; + req_ctx = skcipher_request_ctx(req); switch (ctx->crypto_type) { @@ -1135,6 +1138,9 @@ static int artpec6_crypto_decrypt(struct skcipher_request *req) struct artpec6_crypto_request_context *req_ctx = NULL; void (*complete)(struct crypto_async_request *req); + if (!req->cryptlen) + return 0; + req_ctx = skcipher_request_ctx(req); switch (ctx->crypto_type) { From patchwork Fri Aug 7 16:20:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Botila X-Patchwork-Id: 253183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7328C433E1 for ; Fri, 7 Aug 2020 16:23:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B2EC022CA1 for ; Fri, 7 Aug 2020 16:23:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="Cd0dPLXi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727028AbgHGQWZ (ORCPT ); Fri, 7 Aug 2020 12:22:25 -0400 Received: from mail-eopbgr140070.outbound.protection.outlook.com ([40.107.14.70]:64918 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726970AbgHGQWR (ORCPT ); Fri, 7 Aug 2020 12:22:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fm6dviwwAf2PjOB+mj1d9s6J1T86JrwHmg9/mC8lNdxFIvh+L9YOAght/wlNtDiWzHRutdlGoQKi9kheE7s12hdv+JNRRhnTVUPv2DzRPqn4kErCS573HRK8/9Od7CNswrucK7/TPjDQibiddOnhQw/ENdyKYansUHmCf85LDMyM78c9SXcw32PLaT7WLTZSRq1sEFVzP3iIvoeOZNEZ7SaAVyZuARMUyA4/aYEzGRIL8qlELaV+3d/LCnBPRV7m6pmcp7cCLRhbO82Rw4kvr1kWWeA0y/3TYCL/iDeeAb4roWZ07BklEZEq1KCQRx5DTBURQnYyiRLJKS4oSq7OZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L7FjjUWWehnnDflGEiGda3DXaSAdif7NU6dr7Lr/AJk=; b=BggAoPc1XhHVXPOWhS/DXxmbWZLWRZewKNFM7crWGdxOU0kSvt9VEoSXhBL2WBOU4dyZfHNRBCNgbVQhcvM+owrnlj2f57ImhyJBLYcl4L6Zm42uX1J18jo5B0MHblUjOREIaDivl3vyh7kQVwzatTrgWULgjzun/4DfYwnit/kdO2NbUAyR/eWVINqN3cNNC59wh8XLNAil/4pxCDuABtxgg3ys1M7uJW7sVf7OfhvMWbp0oKIIFu0LU70zLVo0y34iwDpn4PwcTXN30F8+Uu5E4ikU2FgeyHnfZWLMy90+aZ0WS0sdU/Ez6MHsGvDYgKUes1PFZeRm2uhIHGwasg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L7FjjUWWehnnDflGEiGda3DXaSAdif7NU6dr7Lr/AJk=; b=Cd0dPLXigtW0eK7CVynIeYSAV5ePimIL3dnWJ6ICBpKffXbkmfoj3H3zZMnBMpt5Wn5B/UUm9FgqRjkHkSkYxv80AsT3ibK2flWZT2cuLLH9vjKgJOA7AgKkG41IfEy4EKPhRIB+h/7JeHrM5bLyy9LCvteHSDSR3YO2Ct0V8wU= Authentication-Results: gondor.apana.org.au; dkim=none (message not signed) header.d=none; gondor.apana.org.au; dmarc=none action=none header.from=oss.nxp.com; Received: from VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) by VE1PR04MB7359.eurprd04.prod.outlook.com (2603:10a6:800:1a0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18; Fri, 7 Aug 2020 16:22:04 +0000 Received: from VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d]) by VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d%6]) with mapi id 15.20.3261.019; Fri, 7 Aug 2020 16:22:04 +0000 From: Andrei Botila To: Herbert Xu , "David S. Miller" Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-arm-kernel@axis.com, Andrei Botila , Zhang Shengju , Tang Bin Subject: [PATCH 12/22] crypto: bcm - add check for xts input length equal to zero Date: Fri, 7 Aug 2020 19:20:00 +0300 Message-Id: <20200807162010.18979-13-andrei.botila@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200807162010.18979-1-andrei.botila@oss.nxp.com> References: <20200807162010.18979-1-andrei.botila@oss.nxp.com> X-ClientProxiedBy: AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) To VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv15007.swis.ro-buh01.nxp.com (83.217.231.2) by AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.15 via Frontend Transport; Fri, 7 Aug 2020 16:22:03 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [83.217.231.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bcd8064f-e894-43b4-82e5-08d83aee05ae X-MS-TrafficTypeDiagnostic: VE1PR04MB7359: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GYKwBFf/wr0EZZ4HND7bVGK/8n88Ut2NxifFN3OIzcItBnreE3+9t3JML2rJfvX477CHf/l0Z4rsojXnfBmOh0V8xYaSpJZyNMvAI96lXfhkBQMBHJ7GWueWs5nN9XE5uEGafByn7tSalgnq97M4CkcSBvlUC3ksbpgpdDlG4X/sP6U8vAvSR5p1N/Vl8CNN9+kJUslKE+g1WUjpHReUnAsOM/RJ09vzq4BlwYSVCl9EM/mbUKm0fPjRkvZa+w/Bk1jW5jf1pwmxmcH0l2TlPgRKiA6cYqP5F/cmrzjyU4DKk3Cs8rsVwYV++qSvlWSKibbfP28xxTP+R7IzC//3SQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6608.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(366004)(136003)(346002)(396003)(376002)(44832011)(66556008)(66476007)(110136005)(7416002)(54906003)(1076003)(6506007)(4326008)(66946007)(83380400001)(8936002)(316002)(26005)(956004)(186003)(16526019)(478600001)(4744005)(86362001)(5660300002)(6512007)(2906002)(8676002)(2616005)(52116002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hdHLo9wY47r5JM2hO7BQ4IakkKwJxVz8OsWlwFyjcMwE9euD8IN8jQSckfVi9S/vxU0G9vKujh+3YaOC9Q3I0wDb7+7eC/U4t6eh5I5s0Hu4JHUU6fAYiRDutsd0rsbwPIflf6M6qOyuDqQL/RTZ0J80xTd8tyapvTQA8/6rXIQ8SoNxYNz1v/SXtxX5UY7RCKhvSAuuSCgW7ngrrRhfhzKLLEL3M5q9w5UrePlnz0yyd9MpKOnCwQN3zQ3cMEhg6S5sE8Htxsp3tDoiuN4nlW2AIzG0meWjslgRSdu4bBYLAriGzaxSVzNNFD317uvFtjd50Ja8RQ7rI+XgDa5RtDrXH1ia4qPMS+eclYQNubsbsQMiAwtsfLHAHyVovzYntPIyPTpttdr0a0NyJm4OgWK4YH7tTWFdKkD5ljR3U6EFR7DxCSHp9em6Eji9Bm97qSaKJ15PliU1O6GK4LbLLT71mZIfN3c4gXahtXVqBMRvGieKaDfe73Fw+6MSxbzw+zs9g10ZT8mkfPBbfdS1T9q0ewSh9h9qij+UgSVcSQFNP2qhxf7XA3IijdfmFbsQfTs1RoYnT1F2MY9XqyNwyYbIHdKCsP+rlif+Ha0m8Ca0WirXsTi/Hai9as7V7kfOeaTaUxe8oO1RrTmpsBfnAQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bcd8064f-e894-43b4-82e5-08d83aee05ae X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6608.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 16:22:04.7314 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: x5IyhQrkTWoKKjiYoM0xUQxeYOlUNCmuVcwXU6x1yA7JJ+M0X6hWnRA5vN/idIYliipCPuA8GsGJydlVWIspVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7359 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Andrei Botila Standardize the way input lengths equal to 0 are handled in all skcipher algorithms. All the algorithms return 0 for input lengths equal to zero. Cc: Zhang Shengju Cc: Tang Bin Signed-off-by: Andrei Botila --- drivers/crypto/bcm/cipher.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c index 8a7fa1ae1ade..8a6f225f4db7 100644 --- a/drivers/crypto/bcm/cipher.c +++ b/drivers/crypto/bcm/cipher.c @@ -1754,6 +1754,9 @@ static int skcipher_enqueue(struct skcipher_request *req, bool encrypt) crypto_skcipher_ctx(crypto_skcipher_reqtfm(req)); int err; + if (!req->cryptlen && ctx->cipher.mode == CIPHER_MODE_XTS) + return 0; + flow_log("%s() enc:%u\n", __func__, encrypt); rctx->gfp = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG | From patchwork Fri Aug 7 16:20:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Botila X-Patchwork-Id: 253182 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E84AC433E0 for ; Fri, 7 Aug 2020 16:23:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55C5922D3E for ; Fri, 7 Aug 2020 16:23:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="NMIiw8Qs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726198AbgHGQXS (ORCPT ); Fri, 7 Aug 2020 12:23:18 -0400 Received: from mail-eopbgr140057.outbound.protection.outlook.com ([40.107.14.57]:4231 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726891AbgHGQWZ (ORCPT ); Fri, 7 Aug 2020 12:22:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h6VV9adG7OG5XmenVcK2+QMCOxpwrqceRBjhbo/bwfBp18ImDp87KljFnU30VnGcyNC4qo4S6kJ4cgdVDrq/vh0fxD6uD2AUp1slzFKfmgpJ51xvzncAblidyHKOoZdTGmG09qUseVB5DgvtSDG+05Z8yEe/jUn20QfqV7uxmceDLirJU0j7oKBDyXLH8TXPZSAJgiXp89xusmxZ0oIG+T2ZFbWusC4KkSNJ1Qj3Fzjsede/iooRNScRJlm2GOmhhVcapdnzxSdHse2aAAUBwQ99riWZID9Hs4hNta0u0i5Je8O8IEsAAeahM1Hjd1u+lCxGMqtZM8ZAkzMg/PQ3GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YZ3ZDCBgSVsJI0JDqY88ayzFFjlNBfrKFO6cSXTsXF4=; b=QV95tgfp37O2Rxn4ujyxliCy5jUDXJtuQLeh3nsLzvqmexBbQpVZsC7QN9pvCHKlnmceKJ5txGVvviKtpp3oDrL4nNkdoMCK+o4uOLGspV9YDB5tUqgchSLKUC4EJFEQUmJzp1geBve+3UT2PmoBquRmnHZMN+Ay5SV2obUEm09XoviuybGNhr+TrJPWlJCnWWSWOAbTrTE6hF2TazTpHbp25U62vjjzJ9RELSyXyATI+oqmLC83RnIwFJ3sI47ZzUD7sRzLOTS7cFLYIaREt240Cn0oFutNVr5755fdWDR6/YNSQ7+TeB9SNMmj/qYHvSmlnxNulnImVS62reMKJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YZ3ZDCBgSVsJI0JDqY88ayzFFjlNBfrKFO6cSXTsXF4=; b=NMIiw8QslRG2OmklIbK1+3v1X5J6DtavEUZjE1D1f+gkjbj4sS35YiFWyuLTgux3jdzMrWnQgsBE0zgeAXtJvHsekotgGWYQ/fVBuunlMN9kIEPr+FE9YgvfsNWmfGw3lDDjRLpwfXOwgGjvTQKD3s5X8XEn0KHza8XbBsuRrF0= Authentication-Results: gondor.apana.org.au; dkim=none (message not signed) header.d=none; gondor.apana.org.au; dmarc=none action=none header.from=oss.nxp.com; Received: from VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) by VE1PR04MB7359.eurprd04.prod.outlook.com (2603:10a6:800:1a0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18; Fri, 7 Aug 2020 16:22:13 +0000 Received: from VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d]) by VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d%6]) with mapi id 15.20.3261.019; Fri, 7 Aug 2020 16:22:13 +0000 From: Andrei Botila To: Herbert Xu , "David S. Miller" Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-arm-kernel@axis.com, Andrei Botila , Gilad Ben-Yossef Subject: [PATCH 16/22] crypto: ccree - add check for xts input length equal to zero Date: Fri, 7 Aug 2020 19:20:04 +0300 Message-Id: <20200807162010.18979-17-andrei.botila@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200807162010.18979-1-andrei.botila@oss.nxp.com> References: <20200807162010.18979-1-andrei.botila@oss.nxp.com> X-ClientProxiedBy: AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) To VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv15007.swis.ro-buh01.nxp.com (83.217.231.2) by AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.15 via Frontend Transport; Fri, 7 Aug 2020 16:22:12 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [83.217.231.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 99b176c6-0428-4cd1-a9eb-08d83aee0ad1 X-MS-TrafficTypeDiagnostic: VE1PR04MB7359: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ixNqRZSK4QN+sfYUbv6XiexCApbcaIdXcqQAobZy9cXHXuL2syRwt0aJ+DsenlWQJJL+e+lOH/oVs0gcL3r5XstwkiC16km6fH/9tQXYO/U5vs63/GYOAf1UqqJOyq43PfNbFOq/TAB6eCOvQ3YLW2x4u0a8DXR85URzT8J+5xdbGbwxNwu5kkRMLeCyE+CDRhiu7QTwLHw59ZLrzhPwVzjJrkZprdGmywtTZvqQUd8+1L55cEYA8mASSWsglHKKuMBW/Eb2uj5xOalvHZa7tcR6j13T/2vqtO1bhda3hhJV8ttCq0w40yyY0ew1FCYXyamzT+/fuWkRVGZsl+YnsA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6608.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(366004)(136003)(346002)(396003)(376002)(44832011)(66556008)(66476007)(110136005)(7416002)(54906003)(1076003)(6506007)(4326008)(66946007)(83380400001)(8936002)(316002)(26005)(956004)(186003)(16526019)(478600001)(86362001)(5660300002)(6666004)(6512007)(2906002)(8676002)(2616005)(52116002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 8DnA2Z9Se0k0eZNaFIAUoxRr+kC20wDvBK7yi5Jb5VSE/CxcBm/A/HANo4z/mw4lFLfWWla8IbB7JH9oH5C1EDgRp23RBoA6hvIMlGtpRhCt1sL4vPwodAq9zjXvmRmk2nmWu1sekjyBc+XKe4moPCbOqpVVB+Ty8B1YoLv8wHMVLnykpy08V1ztT/Iu5a1uavM/S/5C7BwVortV66NieTK7oHr9PC45QSu/sMbfo/Rcoh8/LhdDxcZm+7F0Wa1As+hzxf9sI1jnbJm0llXUG3rAkQ5uJMZcW1RUZv15VlSlZA19PLp0zYkmJEq5jm8IratFAi0WaQdYwh/AJNm705+DejXbim9SfWMLgKNaQ9wnSK9nph1xCYBeH4HxoaqO7Ffy0QUE5QCGUJdIbdAEC5X19WRmEJNBZT1NoWZuw/e+zUCkJWP6ro0lPLe9AQPljn4ZD6OZd/d0syggt4FiiMe87LRa7xOopXyZIyubFPlP3l2O4RkOXRX9uZ8auxcBUrBJlb+wQ13vOhfqIj3UpZitZEekzxAp7aRAmtYJ5oLR9dkZDwtTbRy4Dd4I5i9Khdgca6sWMRaz+kuedipLD4fMli6GegGU8/WawfG8WouD1El9LM1QaHnzqCxCSuSPWcNBri5BVHxh9S/MQReGWg== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99b176c6-0428-4cd1-a9eb-08d83aee0ad1 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6608.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 16:22:13.3124 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SvCACcrqPgUXZJJAaN447+0qSCBO1ch5ByD/fkXrSO+yjsXOXzV1bytAMRBZUigrkKgnhEJsEAQEJ0soFPS6VQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7359 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Andrei Botila Standardize the way input lengths equal to 0 are handled in all skcipher algorithms. All the algorithms return 0 for input lengths equal to zero. This change has implications not only for xts(aes) but also for cts(cbc(aes)) and cts(cbc(paes)). Cc: Gilad Ben-Yossef Signed-off-by: Andrei Botila --- drivers/crypto/ccree/cc_cipher.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c index 076669dc1035..112bb8b4dce6 100644 --- a/drivers/crypto/ccree/cc_cipher.c +++ b/drivers/crypto/ccree/cc_cipher.c @@ -912,17 +912,18 @@ static int cc_cipher_process(struct skcipher_request *req, /* STAT_PHASE_0: Init and sanity checks */ - if (validate_data_size(ctx_p, nbytes)) { - dev_dbg(dev, "Unsupported data size %d.\n", nbytes); - rc = -EINVAL; - goto exit_process; - } if (nbytes == 0) { /* No data to process is valid */ rc = 0; goto exit_process; } + if (validate_data_size(ctx_p, nbytes)) { + dev_dbg(dev, "Unsupported data size %d.\n", nbytes); + rc = -EINVAL; + goto exit_process; + } + if (ctx_p->fallback_on) { struct skcipher_request *subreq = skcipher_request_ctx(req); From patchwork Fri Aug 7 16:20:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Botila X-Patchwork-Id: 253184 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B163C433E0 for ; Fri, 7 Aug 2020 16:23:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3611622CA1 for ; Fri, 7 Aug 2020 16:23:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="mrWLRnUX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727837AbgHGQXF (ORCPT ); Fri, 7 Aug 2020 12:23:05 -0400 Received: from mail-eopbgr140070.outbound.protection.outlook.com ([40.107.14.70]:64918 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727033AbgHGQW1 (ORCPT ); Fri, 7 Aug 2020 12:22:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lg95exFM9j4y9d3P/BoHQwM6CIYRDikzRHVsgiEgTuAu7xe3gKQ+bQG1Ihwa3KFvywaCXMIOyim6tVMvMdBEL0b6VcRTxhDJ+UmQQATN11CzDv+Sg1E3P53YXG0f4cV/HOrBqbjmVvkciOpx6aSSgC+cyujDG3w7wrDDE5E+fuoHFaj6IDhL0ZQOjmeDaYg9XLiTx3yBjJpla7PQyvxUfhEvzd006G24Oo3/YRxh+LB0hJn4mMeG2WqESGmolofazT4DJZnqmQC9ym0M/OA60wDOVxvby/xZLnIpmCoJoW4SU+ILII1gZi0R4+/04zqd+FcHO5M3dYNODi6CzvHT2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hpg8Nx28v9Y3qiGKaO61tWq46U1TYFDx1EYMYEMkVd8=; b=Vd3Xh75SlOvyWdziEpCeMOlFQawXq4JYxPRNzDTAQcI5zlmR0Y2HzU0rxW1ZA9EZvlRiOL2cnIduxDW+ZSh1Vrudan+NAWImrZZTZ5RQltG/qd2HXN7RF7qZvLPxVVV+Zui2ATS5zup5wCk2M1fYPGo+9jKKXU5lkF5+6PndJfbprHFcu/rqOI9Oz96eme7MpaPRvQ05md4S42F+SHQDw6Lasw+vO7XTBnkG2xMhlV9H23ViKCkWyTIcnvDJLH6V5xVX6f8CcxawcmYfbrdSCHxpEZhEA/6ZsowwbnCcFzPTNIyeoWUW1VYjK5HYZb7U8Qt7OGsYhuFOkQsg60u42w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hpg8Nx28v9Y3qiGKaO61tWq46U1TYFDx1EYMYEMkVd8=; b=mrWLRnUXAfXV/a8vp9wMOjTvlwpS3PalS0YXoBCI0XmueoZu6pmyrKXiYKK4ka0B4wxaq+x2dCgBX1aQjm5JH2rx5DBQ3YozAjQ32kPa4mgNt12lUMnY+G8sb0Wo4zsnjcuEXjhY/r5q9Y1WKgB+/0bsbHsK8EExG9w+TIB6Vco= Authentication-Results: gondor.apana.org.au; dkim=none (message not signed) header.d=none; gondor.apana.org.au; dmarc=none action=none header.from=oss.nxp.com; Received: from VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) by VE1PR04MB7359.eurprd04.prod.outlook.com (2603:10a6:800:1a0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18; Fri, 7 Aug 2020 16:22:15 +0000 Received: from VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d]) by VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d%6]) with mapi id 15.20.3261.019; Fri, 7 Aug 2020 16:22:15 +0000 From: Andrei Botila To: Herbert Xu , "David S. Miller" Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-arm-kernel@axis.com, Andrei Botila , Ayush Sawal , Vinay Kumar Yadav , Rohit Maheshwari Subject: [PATCH 17/22] crypto: chelsio - add check for xts input length equal to zero Date: Fri, 7 Aug 2020 19:20:05 +0300 Message-Id: <20200807162010.18979-18-andrei.botila@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200807162010.18979-1-andrei.botila@oss.nxp.com> References: <20200807162010.18979-1-andrei.botila@oss.nxp.com> X-ClientProxiedBy: AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) To VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv15007.swis.ro-buh01.nxp.com (83.217.231.2) by AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.15 via Frontend Transport; Fri, 7 Aug 2020 16:22:14 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [83.217.231.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: dc83552f-7752-45e9-9073-08d83aee0c30 X-MS-TrafficTypeDiagnostic: VE1PR04MB7359: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2733; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lT4qwYOPsRK0wiJNrfhOFFc3vQG0oLtlI/cQC1UI6Nq4ogXm8T7sCUwuNk/f79obl3TpzR0cKvYmDOuOBuEaDWHkYEHbw6Tss6LXcbfjUJA+KCbSpBQDT9s1HfL8wPTbf2zQLvhz/ewmZo2jiF6pH2OsFrU2wYBHu2pQBg0CEF+U5Qwp6jG47I3cZGl65s2EXikREsCmkvlA36f0ZHPNmQyLVofplrjt9jpZGnrLf0150sUsPXh5kKxdj+G82hVHBLAFsLOquBxvQeK7hUQP/vMytXfL197Yag2NSVysSbrSbuRUEN6kW4FoQ24sq/Fv X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6608.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(366004)(136003)(346002)(396003)(376002)(44832011)(66556008)(66476007)(110136005)(7416002)(54906003)(1076003)(6506007)(4326008)(66946007)(83380400001)(8936002)(316002)(26005)(956004)(186003)(16526019)(478600001)(86362001)(5660300002)(6666004)(6512007)(2906002)(8676002)(2616005)(52116002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: AyX5k+2lft2zwCHIxKPeJhcKk7RPzkFE+7ZwHxxePGS2A9Z13+kDBYb07GqNO3iYgT4g0POcVUsN0ggGaspgWmuLFTEQ5185R/b8Q53QZAjQcmEA/JvF4CoJtvXtRPsB+57XtdJ/Aoxhxtx2uZsVaPeSXYzEnDw0q1uzpWuc9j7DpREqrH1OkuPhv3BsicsrqFUDoQE0aZIWaQ1tGGnJE/ve0hBnPMu3NFXyvluNdMPGs21qn3bP6JXVh07XM0pjHHcup+arl7epLM5U0hMpR3e+l9+/c1zI8UkRsobcH1UbsfzDS5W7s8wABVOquLBZkHP59cyzjWaGkxsFgQIKyWEMubaQaX6sOamX5Mhr3T75kksaiDYyGRPsOW8EnAOQVksvCovdVqqUzABXzVZiYE5L+GFgRhhVOI/4D2xVof1mgU+Cvx9QHwVivvWoV7qITpBZ5KT37E1mlnwCM/jcFq7pO8q9FYeag8CcdXjH+dk9hrD5mDi1mxGL54WOk0HV3jifFbcj+G+8Mvr+HsjA49+x7ERjuAhRpT+ng/9eHrHYLvMRJtZcdNwxl8iRXdLsq8RKeXPa3PbM2iLIxGeP2h3PdJmW2t4OhGH/5kyLvl0JPP6w43z4/RuzMR83k0EQy9GJjrPMvTgY8xKc9TIm9g== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc83552f-7752-45e9-9073-08d83aee0c30 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6608.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 16:22:15.6070 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TYXUab5J43/7qrkSpUyFpfurjXneyMgiAc1R7jP5nitm+PBtnRZIVMo9PNX0w9W5Gu5myUt3wTP5IsaUu2Ejmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7359 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Andrei Botila Standardize the way input lengths equal to 0 are handled in all skcipher algorithms. All the algorithms return 0 for input lengths equal to zero. Cc: Ayush Sawal Cc: Vinay Kumar Yadav Cc: Rohit Maheshwari Signed-off-by: Andrei Botila --- drivers/crypto/chelsio/chcr_algo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c index 13b908ea4873..e9746580870a 100644 --- a/drivers/crypto/chelsio/chcr_algo.c +++ b/drivers/crypto/chelsio/chcr_algo.c @@ -1372,8 +1372,12 @@ static int chcr_aes_encrypt(struct skcipher_request *req) int err; struct uld_ctx *u_ctx = ULD_CTX(c_ctx(tfm)); struct chcr_context *ctx = c_ctx(tfm); + int subtype = get_cryptoalg_subtype(tfm); unsigned int cpu; + if (!req->cryptlen && subtype == CRYPTO_ALG_SUB_TYPE_XTS) + return 0; + cpu = get_cpu(); reqctx->txqidx = cpu % ctx->ntxq; reqctx->rxqidx = cpu % ctx->nrxq; From patchwork Fri Aug 7 16:20:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Botila X-Patchwork-Id: 253186 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8D8AC433E0 for ; Fri, 7 Aug 2020 16:22:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B443922CAE for ; Fri, 7 Aug 2020 16:22:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="R1EeIne5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727079AbgHGQWe (ORCPT ); Fri, 7 Aug 2020 12:22:34 -0400 Received: from mail-eopbgr140057.outbound.protection.outlook.com ([40.107.14.57]:4231 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727055AbgHGQWc (ORCPT ); Fri, 7 Aug 2020 12:22:32 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VG2/SCkDZtVpXLFZx20kxabDUKQ1hFvvt1k4A2afvgsJd+Yboeu9JK7rd2zN02I/kHhBNBBmiAZwXHE7c4USGYZ8LO0QbDaITH18AY91NA0vOhf4MnHHl4cmD4LAOVfFqeNwpBR37Lwoemw0dB4246zjCKyHzbhxxBV+SnPZTfDMiXDBb0+T1z4gXT6hqZuCpmfMgdEKDsa08xnXP5BkQ6Sdq0C+Hu7bzebT5uGSx7ZPjhkDfMScHFapJfVRmVIv6aJQogRcT2O1sPx+VNZpZiB3lNEe80C4af0jSM+0QWrFj3+c5cSeWxTdpkK8YDTa/skYzba7eTzrjVsJlU6Nkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rC2ta3eGZeMUSqoWJidBs4SB3RZKyPZ2g/vOcr7fKjo=; b=UVmecRbzYlU160ptsU1P9CuiNoLTwcfBMM+MCKszh2Xg7ugxX88OOkrzOaJKq2dnRxXTfsvUm5gO73V1PMGsTihd3krvzmIZBJMAN2wAY++8DpNS1rjNaViA9iNfboEdMIt01B08t229Y1A4oaUgoMJXkH9gdjpjNxSTwJvfHLVdgUyLeDwQbshqwgOx/TfJtDxVXN1UjCCFqdxHO87ALpqf/e+qM7o7rNWIwDq3PwUEU+neeoPOMJ/4NtgTDzwcpCLot471C+yB66k3cvQuRqGiXIxMNuNu/qGp0CKppBTraLmZWotlXgt3PPEAPjURwtFgwV8fKe9xEfb0cAAGkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rC2ta3eGZeMUSqoWJidBs4SB3RZKyPZ2g/vOcr7fKjo=; b=R1EeIne575dqgbhUt+iy3P4sW7peXRfp7Esh/Szi3vMTuG6wdq474LepzoI2RdpsooHs0OPE9nTSExykYKkTQPjXTfqSI/g7VXs9uipN92vj0BzxQDygVykYGlkQtoruY4LFmD/TwfYVnzVH2K25tAApLjiAGbCve8B+s5w6aoM= Authentication-Results: gondor.apana.org.au; dkim=none (message not signed) header.d=none; gondor.apana.org.au; dmarc=none action=none header.from=oss.nxp.com; Received: from VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) by VE1PR04MB7359.eurprd04.prod.outlook.com (2603:10a6:800:1a0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18; Fri, 7 Aug 2020 16:22:21 +0000 Received: from VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d]) by VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d%6]) with mapi id 15.20.3261.019; Fri, 7 Aug 2020 16:22:21 +0000 From: Andrei Botila To: Herbert Xu , "David S. Miller" Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-arm-kernel@axis.com, Andrei Botila , Boris Brezillon , Arnaud Ebalard , Srujana Challa Subject: [PATCH 20/22] crypto: octeontx - add check for xts input length equal to zero Date: Fri, 7 Aug 2020 19:20:08 +0300 Message-Id: <20200807162010.18979-21-andrei.botila@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200807162010.18979-1-andrei.botila@oss.nxp.com> References: <20200807162010.18979-1-andrei.botila@oss.nxp.com> X-ClientProxiedBy: AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) To VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv15007.swis.ro-buh01.nxp.com (83.217.231.2) by AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.15 via Frontend Transport; Fri, 7 Aug 2020 16:22:20 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [83.217.231.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1287ad0b-0a4e-44e4-910b-08d83aee0fe5 X-MS-TrafficTypeDiagnostic: VE1PR04MB7359: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v9HNqOhQEYHZCT5v71vf23mMKw79jb1iTZ1oMHqFRZ9HyVzs3d95mN7RkB0RID052oJDHOxfEJQWd8GuWJMHS310w+6mOpEemGt7ZZXQMWOGYpiaRhdy1Wne487FotzXdneQw0WCWOF/ekFpOYc91bi8wj8sWrDD+BlDmTPS6vAqnV8U+3ycSIvbDxY+rs7nJ/2r2/Q1CUHjTRXgNQ7rFs0CvMV5SBrX6hUda1ePTygfH13SAhQR5SZeKQc2lAhSEz4MpkKBg1Wk79OGz+Zqd1vxp0AlnJTqpjDNCdkoCJY/023MmhgLvwqeM00RVmSXACAkIkBf/8l/fDL//PPVxw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6608.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(366004)(136003)(346002)(396003)(376002)(44832011)(66556008)(66476007)(110136005)(7416002)(54906003)(1076003)(6506007)(4326008)(66946007)(83380400001)(8936002)(316002)(26005)(956004)(186003)(16526019)(478600001)(86362001)(5660300002)(6666004)(6512007)(2906002)(8676002)(2616005)(52116002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: c/l7zYfx8lYpKAHXz/GGYkvExqNYmBea+2OKuw6MqcqYG458/qtgRMdWejOTfQdmTiPlNCE7IYCaalPgR739SIpo/1ZG+GrdpXb1pUMh506QViGIYEaReHSHrezXEPCWXuK02/b71qiiJ994gzxGLriqYrnXIBN806C0RJ2fa4zvfqTDc2MVN3MQmMsPHji7u3l9OjpNuj5o/UrcHAirc/KLz4mRuKO3dnjrYJgCPvxE9Am6YHse4BtNVhOYoIYbU4kax1IzOPOyr8ToTG5ctIpRooaH4sa6avMf/qvynPtxYsp3qdEIcX8Zh3s6jvon2NmxthtTdUrX0G5CArMVpgdoR0L7YC7HERlZPw3E/o0UYAEoi8UTBP3Wqx1CLp/7gAUsOUQjCBjCRVtNIS/oIp2Z6aKO7My4Uxozqc5Kzl9KvnAH6r3E0FOyHzvApYOUrGCWw238E6txDqC/eMa58zH4YJrlEquCsPCd8mJARcYyShxV1xiALidUQlfiYvbMysGSo4V8fOpaM0XWeokc0OKoZFLthQsJFKSYUBdVMqkChm+b7eN5EbIEIlUFz3HlRz52F1Aj+LH9pVv5MXDKhWWkBjVNEw6XqbSkG/KtJPuXoOXCGTzzy/N65xGgHJQnIi7FhQNPcn9BFaNZbsIx2g== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1287ad0b-0a4e-44e4-910b-08d83aee0fe5 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6608.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 16:22:21.7934 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 428x598OqYPHChYVmg9rCDQWdrzNLPXJOKgXYnaSgwD1lvTIWj/xzipfbIuTB4qnwOcXSIBHEBW6mtIlrwf2eA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7359 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Andrei Botila Standardize the way input lengths equal to 0 are handled in all skcipher algorithms. All the algorithms return 0 for input lengths equal to zero. Cc: Boris Brezillon Cc: Arnaud Ebalard Cc: Srujana Challa Signed-off-by: Andrei Botila --- drivers/crypto/marvell/octeontx/otx_cptvf_algs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c b/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c index 90bb31329d4b..ec13bc3f1766 100644 --- a/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c +++ b/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c @@ -340,11 +340,16 @@ static inline int cpt_enc_dec(struct skcipher_request *req, u32 enc) { struct crypto_skcipher *stfm = crypto_skcipher_reqtfm(req); struct otx_cpt_req_ctx *rctx = skcipher_request_ctx(req); + struct crypto_tfm *tfm = crypto_skcipher_tfm(stfm); + struct otx_cpt_enc_ctx *ctx = crypto_tfm_ctx(tfm); struct otx_cpt_req_info *req_info = &rctx->cpt_req; u32 enc_iv_len = crypto_skcipher_ivsize(stfm); struct pci_dev *pdev; int status, cpu_num; + if (!req->cryptlen && ctx->cipher_type == OTX_CPT_AES_XTS) + return 0; + /* Validate that request doesn't exceed maximum CPT supported size */ if (req->cryptlen > OTX_CPT_MAX_REQ_SIZE) return -E2BIG; From patchwork Fri Aug 7 16:20:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Botila X-Patchwork-Id: 253185 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A81C2C433E1 for ; Fri, 7 Aug 2020 16:23:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 82F6222CA1 for ; Fri, 7 Aug 2020 16:23:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="LhrBDwX5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726644AbgHGQXA (ORCPT ); Fri, 7 Aug 2020 12:23:00 -0400 Received: from mail-eopbgr140070.outbound.protection.outlook.com ([40.107.14.70]:64918 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727059AbgHGQWd (ORCPT ); Fri, 7 Aug 2020 12:22:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i4ALIdoQm4CTK5iSbXqPQ0xCdH7ZxtRFo2d9ZE5wURi1sOlSe7wscvMV4AH7U/yIINkxvx39Dl1Dc3hE2/rXiO9jqitQGY7poElkrt7jqB90h9erMi47KJcJKQAdfEhmha7hhEJKofMcc7nt4BjoTcCCMrpy5XB5JcSZha/f2QLsykIn3NhyWrUFwBH/O6LaAImLisDgrXh3rMnwgkQa8CnwzVLoTiMzBbAr1SgG1ewxofFfPH9aAuNjexHeb0MdTN4wirHIBIcJHT9EIs7yARN8UWygSYAMIO6128TJCbw9C7BgRuemYPvgYrNN9H6Ffnhz04VA6ndxOGWnTC4cAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7OywlflLaTp9YE+9gBdrpahq7EstoKZVbIkvjWl/hGg=; b=E7jin5ow6AZR+e+190n+prudjwpscgJKe9uIh5OUs+9cXZTEYUC8GDjZKESq47QtBvgQ5s5xQx5cARJ3H+ZTrlexNQLimdI4vUiltecc4wrdOJ4mjhxEAzS67G75CE5db/ypXpc3veTdHkBnJkQmnK7P/9/Syn7xnaKdDUTCIlCTGTwS7VfRM3eEFEApT0h16hGeicB5R5Fx83NTC04So2XtRRS84+2p8Fxm1Fqk8SazqvwZG2yYvyyrszT6YUIa6Hw4oCZVXpr6n0y1jOfb8x7WeeQlh8D5i9nUAo/pQCmuUTaDoYImJIRMOQi3z8W/vix/k2dypCl8IItYJ0M4Xw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7OywlflLaTp9YE+9gBdrpahq7EstoKZVbIkvjWl/hGg=; b=LhrBDwX5RpQfoz28eG01vZsT2256QwnbUl1nat+KsFDTHON4nXjTybObLk5T0OXGEY+gvww9cZo3VI2pYWFuSlxqL6zAZu4jpoLWqhXq8LF8Gm5deNGBYM8fHGHIxJV+jHcNID0LCHvxMpGOaQKwr4V1oITP5wG75GyKJdJUbyg= Authentication-Results: gondor.apana.org.au; dkim=none (message not signed) header.d=none; gondor.apana.org.au; dmarc=none action=none header.from=oss.nxp.com; Received: from VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) by VE1PR04MB7359.eurprd04.prod.outlook.com (2603:10a6:800:1a0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18; Fri, 7 Aug 2020 16:22:23 +0000 Received: from VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d]) by VE1PR04MB6608.eurprd04.prod.outlook.com ([fe80::a856:c104:11c7:258d%6]) with mapi id 15.20.3261.019; Fri, 7 Aug 2020 16:22:23 +0000 From: Andrei Botila To: Herbert Xu , "David S. Miller" Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-arm-kernel@axis.com, Andrei Botila Subject: [PATCH 21/22] crypto: qce - add check for xts input length equal to zero Date: Fri, 7 Aug 2020 19:20:09 +0300 Message-Id: <20200807162010.18979-22-andrei.botila@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200807162010.18979-1-andrei.botila@oss.nxp.com> References: <20200807162010.18979-1-andrei.botila@oss.nxp.com> X-ClientProxiedBy: AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) To VE1PR04MB6608.eurprd04.prod.outlook.com (2603:10a6:803:125::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv15007.swis.ro-buh01.nxp.com (83.217.231.2) by AM0PR04CA0075.eurprd04.prod.outlook.com (2603:10a6:208:be::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.15 via Frontend Transport; Fri, 7 Aug 2020 16:22:22 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [83.217.231.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7ea583b0-22ff-43cf-0f56-08d83aee110a X-MS-TrafficTypeDiagnostic: VE1PR04MB7359: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3173; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +CooaNppBbKgOcXG+DP8tuCn8Eo+SVunIxoYwi4PYcJ6ySOHzicFc1yUA1tMPRfCS0J/hGhOCpYv9lerXrBCzd087xFqrGU4lxHnqW1I3zH111NXaz3RLFNTjTTxL2H3ns6kniW6MUl1qSJ4M4TfRvtnlXp/tePlR4jgIbXFN4/xZAFByT6EGDDzoJLZ8w50PsMx864ECby/+Faha1X5STP19Cb7DHTiyeVh0d6Z11bBM/erRJgLUjV+eWsMk5NwGiUdE3QYzltl0w2LSsHuVNKet0CtYvh3DtD9TyKyI6TfPAVqkbe7+boDo7WWuxs/jmiyDVXcAjfZTakBGP8dXA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6608.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(366004)(136003)(346002)(396003)(376002)(44832011)(66556008)(66476007)(110136005)(1076003)(6506007)(4326008)(66946007)(83380400001)(8936002)(316002)(26005)(956004)(186003)(16526019)(478600001)(4744005)(86362001)(5660300002)(6666004)(6512007)(2906002)(8676002)(2616005)(52116002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: WiNBNO3jcD1IBNEu077iHhe7Un1WBkR3knNyivjOrWw9ahbPMBCDi9o4MCO8MadIfwZ6y5Wq0m6/h9ISBou6seaCdRvaw+fhSYQjQmAc9X7ThfjWNq4hC1cmMKimM32Abo6Oh0ri1GTedSbCZG6oHGqM/fzHw4zwkLUT7fFis7uOf+zBDlwaxv7srMw65GenH6fwTRLEgRGudX4dLVg1gY+j6Ys4KkX96INdzP47YAJZUXcdtX8yEXknJwWLfKK7e5gR5k2th9htrU2EgOQ/wxivz9IBYRUUbC4+kphsnxQfBnThNmPia9AgW2Jhakj8gfWDrsetU6TmLhfJbZQQ8uY1F/Ujb1ZIItFBaWNOWX+00BcVl7zlSMfWNO+DtJBDb9JYb9B6GHikaO23bRTds8hdQP+KltasEhd0PpwCn+cdFWqH8qRwNL3s8PY1DSfVUY7fC2vWP22bzCWpk5IDrbHh1zKqAFt4Za+ubYkFJ/mylknh87E9JMSTObHu4ahHB5TLow1wQ/JdZhM5xKsMXbn9nZqonOh6e9+G5Lg3vCY/tgW72y/qM1/DMcUMxb9rLOQMb4S/oN5VKYDVV1DejQhkfRytTjAiu8HTEVIvQxz3vkQN2vlUtzUfB+6UbGTzLNV88L5Ot1O+oDRrPd8Zcg== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7ea583b0-22ff-43cf-0f56-08d83aee110a X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6608.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 16:22:23.7343 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NzbEyMeJc9jq8uZhfidfFMzQYV7+UYnnaCtmXGOKFs/lJZGmuOZmghAY0p0O2iwvMSWX3yW/BdYNyVgr93/XJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7359 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Andrei Botila Standardize the way input lengths equal to 0 are handled in all skcipher algorithms. All the algorithms return 0 for input lengths equal to zero. Signed-off-by: Andrei Botila --- drivers/crypto/qce/skcipher.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/crypto/qce/skcipher.c b/drivers/crypto/qce/skcipher.c index 5630c5addd28..887fd4dc9b43 100644 --- a/drivers/crypto/qce/skcipher.c +++ b/drivers/crypto/qce/skcipher.c @@ -223,6 +223,9 @@ static int qce_skcipher_crypt(struct skcipher_request *req, int encrypt) int keylen; int ret; + if (!req->cryptlen && IS_XTS(rctx->flags)) + return 0; + rctx->flags = tmpl->alg_flags; rctx->flags |= encrypt ? QCE_ENCRYPT : QCE_DECRYPT; keylen = IS_XTS(rctx->flags) ? ctx->enc_keylen >> 1 : ctx->enc_keylen;