Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2366446pxa; Fri, 7 Aug 2020 09:22:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDfxDXEQhBYMsQFvD54VmFzZkzG8LXIBLa4JRiUMewPIqLemcq4uLExQxSyK3hXeZPB9na X-Received: by 2002:a17:906:84cf:: with SMTP id f15mr10516715ejy.259.1596817375547; Fri, 07 Aug 2020 09:22:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1596817375; cv=pass; d=google.com; s=arc-20160816; b=WlBE/UgR5rXYiyv3lpKiUz8rH05cIoJjfh2Tx5dgHnwRHZFIUfD0BW/G9fV6KbUmsM 0OnpI+y5utpdi1YwBeTtWDzPtxDzxkqQLjQzWAr4rrh6tCTwOZpTKPiRp9krCuPGVU8P e4Xis2gQK0ERagiM9QbXqXg0YBq6bLwxMVLlnL1JQh3CrI8RhiBDb5T0f8wZyQ3UVOun Wj8C96yhNDcOHxszV4Pc9ezvWrwyib+nCDfzSKItIGpot6WuOZn/A2Gsw99ylmBVR/Ia SEGsyqk0hDLeHXpnw2rW45QXXyO5WpHh6iZxHcNQrDSwRf4Seg2OiK7K1ZbghwVE80mk V6Yg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=MOsgevlBUBBEz/eyig9c+f8iUh8LaYgPHgmviFsTopA=; b=NC1IVr9u313aJcoz4Gy29O4rZSgvC86BqrWmELTYBDhMz4OgKGVzK4O08I2dm34CP/ uSumv+CgcI5lCDCOJ3kaG3stxLh50NuignSNBq/H3GAuZHdpBJsmiAwq33BzbhSNKzbc 3zyJq9Bq8zhuG7+zHggOGlgG4nSAlpwHmHEX/gH1LyNB4V/CP4/meeO7oMUDqXPExc02 ZYjNfI9lU8XIDgL3tV17VSJ9gBNHg/eMdagl1MhVvPhNdKl9gzqsQDMN9naf8cYvMiF1 2Ir02szhd6tPNLA/fMBbbKD6ltvJDey+dxWjww/epSW0JRdk/Gq0vl8roEdH3vkZnqig LHmA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=jx77oLku; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b16si5442738eju.452.2020.08.07.09.22.32; Fri, 07 Aug 2020 09:22:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=jx77oLku; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726862AbgHGQWA (ORCPT + 99 others); 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> Content-Type: text/plain 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; -- 2.17.1