Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2366967pxa; Fri, 7 Aug 2020 09:23:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkgjFUGx4EEB5mj8k9wneBL1Zq/1rqn33QMXKcN9X1kVoTaoYqRZE/cv+Gf7pZ+HQed7+N X-Received: by 2002:a17:907:2078:: with SMTP id qp24mr3806354ejb.286.1596817415259; Fri, 07 Aug 2020 09:23:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1596817415; cv=pass; d=google.com; s=arc-20160816; b=Q6NzlzIzlVr2zKm+yqNqcto3ud09r3IeoNC5neJ19NRXRrz85T7T7f9RdVCM7Xs1Mf e+saLmzFSVuSxm1gy/tGldWR7RqC5+mGKue7WASCjzrOVPplJ++yYkCDGBPEfRmb38Q+ w4HS3z276KT1NQWNOFGcHhFHiVNjrQg5Ru65teqtkEodJh7+Y1qPDWfkU8xItEkYd3tW xl1TnotLuGL4P/uinhJs2i+4eNSur7agKiWKhM+f/FW1rNFDzOdi/V2ee53+vZ60+EaW oc5S6Iad2ETSA60JPZ7WhWty/Mkv1F51vb3QqV+TrwrsJok/z6b3DVGcVlfnhP2C1i3R X5Bg== 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=82qY2d00RvXDAh5ohn0RHR2E3SsQwIYACpLSJwzgKxg=; b=LgmeDR6P91ahLICxYrv/aHKLWHZlSjFfJRpAYFbm5Y90HdHEpWCOYripi0EaWF8I0Y lyChmnJYkBhkmy6dleKrMUVbghPSOCFCzw82SG927u8QJnfLZ0t+JoMPfnwIkocEj6/B uTu83e204c8AmJxl2i7uqnWoh0l+0Kr9eDKYefUEmZo88KOb580sahnLpDSXBAD4Bpim A/KAq1zi7jHR0jlnTybPiHux8nMFk1UxV5rBv40jtYxUAomMqMP5UeQnlN1Ayfg2y/dH Uob/mCLPZzIx1eGwZ/mkbL8FeD4b0XELYrQPF0wYs/kp8KzrqbQxSF/UbnsROt0I9O2t G0sg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=ZTc3MDFZ; 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 f1si5520384edr.11.2020.08.07.09.23.11; Fri, 07 Aug 2020 09:23:35 -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=ZTc3MDFZ; 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 S1727062AbgHGQWc (ORCPT + 99 others); Fri, 7 Aug 2020 12:22:32 -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 S1727042AbgHGQW3 (ORCPT ); Fri, 7 Aug 2020 12:22:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W36QpI/+2ZXtO9riIOCehxsfxzj1ccwVhpviUNedvdvufrcxHRLlYh44IugRrZhrMIJsVX3sWLKY89P/KW+v9FZWrmHh/j6HjCBqcCvePRyTRp9eyqxikkBTR7OSifB32cYWvPlsl2PYUCT2jmexbj5XFP3FLL2+BD/4k7vfpk/TH7oUAmuOx+ZUxr50LP5gc5hhIVeb/tecTKdjdxDketNtO3iuavzXVKPh4PPm7ygn+6RKhkYWDYlpWjTEBPUt3If1sWQO+q+QRGcLQlAX8Gzytj8Utbwaj2PY2smIqKQla7Y9GB0hZrQjrmhmSx2oQleiRtRwXt4CMrxysh/bpg== 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=82qY2d00RvXDAh5ohn0RHR2E3SsQwIYACpLSJwzgKxg=; b=l0qeEv7n5Z1mOr+1IupB9FsKrOE5QXalH+lcwZxXl/LbwQ16dumVEdl6v3jlZO8Xqoz8PHE+dRFQnLBWPAvxIQ4dEjeKocv1D1bKOESvFepUkhMWMa2nnMvXfExPqS3lrZoHH3yNWOg5V2jSe9IsANpFvSnyzm5NFWlqKVmIduXwJZM9+tsO+CH7q3F9LX2tKfWfjKCyvGroc5HlmJzHqLtLC6iX5t9S3uwjUvCXjCEH0GCHuvGJVnBFnpkZvGBfUCa0mw2Cpev5QARkjNEOCNskLvB9qTpRQ5Z03r3qNBD6PvBYWNcYeT60/dr0EiR0hPR+pGUjCsQ8MIkEbBBDdA== 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=82qY2d00RvXDAh5ohn0RHR2E3SsQwIYACpLSJwzgKxg=; b=ZTc3MDFZ0nT3HkbXQL7y3AO1DGLDb7QSqTbOZYEl1hz2Rowb2lmb1p4hY03ZbXxtnZBlDIvM42cBHvPo6DXcF0JDTva3e9q50QaIetI8oYFMHgXq2d/lxPzlsZwVUXfCvloJLecgr/xP5aDqoaIRIEkOVQUXwNNE+IAgK08jRjc= 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:17 +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:17 +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 18/22] crypto: hisilicon/sec - add check for xts input length equal to zero Date: Fri, 7 Aug 2020 19:20:06 +0300 Message-Id: <20200807162010.18979-19-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:22:16 +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: c92cabd4-f26d-4967-8b8b-08d83aee0d63 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:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PSGAs9lp7PJCKh3MADvF0nhZkrX38D+yILfGP5XBeuscTYG3PaBVcpc0980En7ypYH+fpq1WqpPz/v2vVucKw7+qg/IKmx30C5MabRc7b8WdmKsqUmwtNl5AsM/MMooUH4LJ3ZSZGpAMU8KC5bmSQcPcSL0VLe4eGvph8GMVqoLhLKO+58ed8XmrlDnnug0ZXa9BT8PxN5OnIy58g0NA40dUXhcXlqMOpsVz20ckbB0APbgjSBePDhx1J3MYh99i13gs1W6ZUX4EA694krVSKdIs40rIp4AMiXkvH2sMtBpwp9JZOzZKBMmS86e9WWs7JPAYjgWhEJP24ZMBlq7WVw== 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: 0VeR+p+kLa+tRpi4V32BAc97ii6PbCqu5fEo5kNd1WbA3lFTn/v8+eS8nGeGbVeJEvCepYT5izGxZXNg+OQk23Vl2cL/37YtBILZ0nlPw7KiXG1s/c2i4U8uUaL2GIklGWgCpHkOvGrj7lrlWZDa4ORTNb9L21hd7YvaT836yc6kKgky0EjFTMoqEvEzOdB4HyMjX65Jqly2Ioyy2E/zbCpPxGIjR+KIB7emtQEew7U4T9bMje2POT4mGIxD7SFZkjcSuvnYiOmkpCeF87yJ99VfO4fSp+gKoiIgSYzcQ2DNyXwHe85h8bmeOA8akGgnnNp4EaFZ+sm8tYRzS3yuqnV2nbaSvE3e9B3MPH6mUqzAtOru4H7BRpWlM0/A2YrhSl7c/VzrxM0u+jvAz3YdAq4gOgU8dPD+5oOOPMfDsqqTK950uI3xgI1jBkUZ0mvi1M0H2o4AC5p75W9YDZqsat86xTEDlDfNtbEwesqCBOQmJSDasE024Iboryw3DMXSXTR1qMpdMTjF9GFzYSZNERSlj9ozSOd4u684QitkUkq4GNX9PA3Vtz+LNVsZeJqP7Z7sd8CYQUdm20ptqJbb5iBgsL3ipyugjlFeJjpWOiXgHuwMPmZZBCOI4jcCGrhwDBxyBZjau8lfu5+xCz5EbQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c92cabd4-f26d-4967-8b8b-08d83aee0d63 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:17.6408 (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: 3YcZ2+4mD4xFfVnlxOhMhVLg8PFcTdQe6TALO5lNQbsp8dDJ5LuzQOZbIIo7GeoLIrqHzW2Ty2uF+IvEcy6W6A== 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/hisilicon/sec/sec_algs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/crypto/hisilicon/sec/sec_algs.c b/drivers/crypto/hisilicon/sec/sec_algs.c index 8ca945ac297e..419ec4f23164 100644 --- a/drivers/crypto/hisilicon/sec/sec_algs.c +++ b/drivers/crypto/hisilicon/sec/sec_algs.c @@ -723,6 +723,10 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, bool split = skreq->src != skreq->dst; gfp_t gfp = skreq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL : GFP_ATOMIC; + if (!skreq->cryptlen && (ctx->cipher_alg == SEC_C_AES_XTS_128 || + ctx->cipher_alg == SEC_C_AES_XTS_256)) + return 0; + mutex_init(&sec_req->lock); sec_req->req_base = &skreq->base; sec_req->err = 0; -- 2.17.1