From patchwork Sun Dec 24 08:21:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 13504193 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D5D415D0 for ; Sun, 24 Dec 2023 08:21:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="HeGlrgi4" Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BO8L2fN015315; Sun, 24 Dec 2023 08:21:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=WHTWWF6fs3oGlO2xpIVhZtmOOTc6efUyQ676WhtCIo8=; b= HeGlrgi4JMDjxW3kHv2/iytjFiO3+g8iPCErpnvSAoZYsmgAt+cfO7yD9cUGIy2n MvcMhAdZPsc6X5ZSs6r6iqOtRI25LsOwHlr1+Yn2guAGWUZlYbXi1miCi0pb+bqg l2IzyYvFCkA3uy9hD8ufsmcF0uLDxukc3hvMOuFVG1wolt8NwhJ8a8MTSPuymr32 nW5E/Xlms0WpSEf3eKxK4xvVFAXkErEfPynaErj4//rny1szbHtjvjv/5+A//pnw CslkZd9EkyWk1esesfLuR62gvCrwva/mKeP0uV8BXUtn/kVzTm3CPyfnZyLnozZ2 eUx8gOa3/I6BYLToZLsqxA== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2100.outbound.protection.outlook.com [104.47.70.100]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3v5ph60rs6-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 24 Dec 2023 08:21:02 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QotxFuBwe+ZiiN3qlBYP6PjN3Umk1jbEf/jeNpdRWpgUVGN7+zDPR7XCHvK45TzYd76UXUhSosrQX9vUbBEt9vhgeCNsx57CTsSNLcOaKZ2q4ZVahqp8g4aQwEs3mwOvHygocDgaKQ2roPXBZOTWWbKaNUmUq6xmcTbZP98+KioG5nMS3uZQdQei9vGz35FluolJIqKl7vQQvR6GS+cJlWIB3BoY0F2fCtQ+h/4Fg38wu3ni7AAg2by9S5E2eT8ylP1YLDcCVFVtBP6aV3xEkAV+au3StI76EplSJMsSOwr+wCFuCAvcoLTQPgzdF2+Bi4QVMqFlDWzeiS541n1b0A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WHTWWF6fs3oGlO2xpIVhZtmOOTc6efUyQ676WhtCIo8=; b=YPuZ9Gbagys9lk1dmCM1bJG4PpDfR2oBTQZfONSHj2uJ9r9vir5ItcvzS+JAHbdHiDbw8uUxB1jjicnQqIAlc7OsTxj7dNHKC+mgPcXnOB8+9GMk+h/Q2qfrTsjfBBQeNspvFyxFzswAznMZft/X5lvv0ZLDqKD18c7AErEd08SZR68u2yku1u9+JZa0RcvcjewTDxWFboYpP/9YGVJl4s8Q8vQADZmy1QpJsbG95g8zT8MY0sukggjD/Q+8K9f1eWK3PhJzFS8/htUOSMBEb95owPkFLxijVl+p8lE/C7XlY85M5WQ9UxL+COezE++NZdyGs8fvy0E6nulw4l2Fuw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) by IA1PR11MB7246.namprd11.prod.outlook.com (2603:10b6:208:42e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.24; Sun, 24 Dec 2023 08:21:01 +0000 Received: from DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e]) by DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e%3]) with mapi id 15.20.7113.023; Sun, 24 Dec 2023 08:21:01 +0000 From: ovidiu.panait@windriver.com To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, davem@davemloft.net, festevam@gmail.com Subject: [PATCH v2 01/14] crypto: sahara - handle zero-length aes requests Date: Sun, 24 Dec 2023 10:21:31 +0200 Message-Id: <20231224082144.3894863-2-ovidiu.panait@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224082144.3894863-1-ovidiu.panait@windriver.com> References: <20231224082144.3894863-1-ovidiu.panait@windriver.com> X-ClientProxiedBy: VI1PR09CA0094.eurprd09.prod.outlook.com (2603:10a6:803:78::17) To DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5327:EE_|IA1PR11MB7246:EE_ X-MS-Office365-Filtering-Correlation-Id: 16e18ae4-c5f6-46f6-22a5-08dc04594337 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nMfhcQjS0CG/rT9d3fQM357GWA30r7e0s8frRZySbvhenlyfpbYSQ3EGmeiivdoRTn9l8KXT/uA9YYElJ6XhAeV8R6GcMbrcWXd//y8/pGfdlhq8mSeHNP2lEuLZf6btXuFCiucrcXO4GhEAx6y8lteWaqCD5AbzI3weqFl0sSvN3+ecJ3ERrjUic7CXFcMcStVx687o6AYy/sVx5Y7UyTbBK/F1baih/O86iB+9SnEkI5idLACCL1Ww2t3Iqv0tjGi6Q+8PXTZPrCGt1CpavD3qXWcSjxI7n2ITXbHy0eDhAOAIdD3XWlLC9s+7qPlab0PqvkI/8vJXjGyZGMh8WvjOUGyl9ShCjZnQT9+/dQXcNGLT9N0R8Z1YA5e957fTrATwsvdMg7TC18it/f5HgwDgnWBU8q+IkGodZkmKqXPh9YoMJMbvnIYv1xfdlh8EX2/j9kAWdoABmnNbS95nR+njC8Nd1p3qXW7XcLeaJIwAn1ZIh3jmZFT+rds0bJVjPNGXqRDAHXW9Fd+hxO2hW1djdki+88HJXV1uBR5UGbr1Kq/MiQFzYoHNOazldD7rnw7QxDQEwPSF6rjSo6EWhxy0ZK1je3P6Bil0nUv0lR3Y+8Qgb5giBVWDen1cQoxL X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5327.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(39840400004)(346002)(376002)(396003)(366004)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(1076003)(26005)(2616005)(52116002)(6512007)(9686003)(6506007)(83380400001)(6916009)(86362001)(8936002)(316002)(66556008)(66946007)(66476007)(8676002)(4326008)(6666004)(6486002)(478600001)(38100700002)(38350700005)(4744005)(2906002)(41300700001)(5660300002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BUhInwOPYlJEGNiPFujUrXaB9gWxmHEoNwGq5IWGiQYu+c5Aj32e/6PcA61+JEOuBPH1MtwQwsktNEZg9/ZYMtL0GhZLw/7hDcUV23bmF7+GXtFim1tCv746HJvspVBuInHPn7Qqz7gipJIbMJfeDY+yMFE4o00zhPN8D9aamnWy0nuS7T26OkfYZPdlSwV9SomLu1OYwJSjrbKL7X1m4ihxU3scbf28ocZxFKG7WHsi/1SiCpB8JX3RCkuogCSVRvtkAyNlX4hHajYRS7m+p0WC7BRJMwGuUSyBd289s3PidKAJivgUaBLO0ACcQFGwroJDCgSzu3Eb8lWsTYrQZbpxQySs1uYMZNewDVfTCj7VYVJWsbUd+EFePPOUv6CeiozgiDcy/+JxYAsvAKSt9YMS2Gvcu155aA0OuhJbCYzGwCCh8/lwxP6c1ffuJn3UrffYw+Mp7IJ6OOeb1Kmyxk5Evd4OSAwKV1eZHF3kiG82VFmRvj90wNb3A3ZhAWdPhOgN/0zCvCYM5rT8F2lc1WVKyp0A5F/2AYuLm96n1Q87eTpMPqnvUknOtCNLboB9Kxl+peULEDPalD3oKbswENPB00Ba58DlQKAOeXDFRfpTAHAClUero29arPZbbkFo77TMpnDPsMmf9fRjpOqtzO9oWTU4SDczCAe7thLdzIQzLc66mZTR5dDL10u2Cq6u09CpvErgmSOV4pgjzQyxt4QCZ8z0j99ZukM48RAWnVdbitWBXTmQPvNtQPMwg5KgXlJ0SEGlTKieaF5+pRq35wM1wogcYmfS977bFoORmwDFkscnTIgj4c6qajyK+OepPFzp1/cRwriJGuggcKHu6CaMhbBAwEJHYM6UZFxv+CKc3zPVO4f+TH/WUXCXjzcB79lOdWKqbLtmO43bN2pboRLKV8evPpR//VgtI8V9EjfzyaIm6gDCLS4EU99ke+kXOPVd5Ly+oRfvM2KCPuQeWroy36dyWrRlqvDLbAfTKKLO/Opz4gOPGEJVjfBmwIFgL3rBuKvbcfOyhKou+Wt3DQJY+GxlkK4RF1aTvEe2KglhDj7ewMdJsHlcYmYbROM1a1pQdN/GyZTWkOu/OhsVtMlF68QjZ6DszDAszioPJ7knhChza10zbpjcglqGJvTyLOFwNEjNNSBpBOqlf2vCUICGtf+iU0YtJ0uIaaRRU6fxvFnirqxKcMudK7T2klBn/T7lXtwhMb/O/nOoBnLr+5wyTKWoDEr9YeOzUdGpAmzksky9ennYPI+kEs0RbiGqEemv4RN/YZGztMqmAcVry1XCaVkvrcdAO+pEiWSY6dbzNrqKQ4a8Z/nS42cRcSS6oQR/qdkTMwFO7eEo20o/tUKRu+X8euJRRMGBlc7k0Se7M0ND4PvsWI6NUbziY6eeABj7YSnXPFJHUd8J/2FM3NPFNN3w+To9pGU7ajRCGelo7MBCmtUw+EcoX9OZ0R777ALWnMpc1v0tlHf5/vQauzpJKYwtEyP5wiD2M4obLCVkD0f4qML62WlJ02FQ8W5+B5FWPgOrD89oBGv2fj7cnQx/kxcuz/w49UuhkWuSHZVpeDXdGvWK1IgoxTZlKkU/0X0iqlsSGePGOfwqHhylGA== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16e18ae4-c5f6-46f6-22a5-08dc04594337 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 08:21:01.2522 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NIGVwNLwst525ta9HVB9q0x8JwTnIkPrwNMoydZ4hBu8YLbjrvgdLo+RZwarnr6UpC2qu+8bstTOFwOFmKdpZEY80+3yg+OjQKfnc+0Ic2g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR11MB7246 X-Proofpoint-ORIG-GUID: CjJB1gtSxwI6p5_3BMx2Az14z-t32dyK X-Proofpoint-GUID: CjJB1gtSxwI6p5_3BMx2Az14z-t32dyK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_25,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 suspectscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=691 bulkscore=0 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312240066 From: Ovidiu Panait In case of a zero-length input, exit gracefully from sahara_aes_crypt(). Fixes: 5de8875281e1 ("crypto: sahara - Add driver for SAHARA2 accelerator.") Signed-off-by: Ovidiu Panait --- drivers/crypto/sahara.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index 27ed66cb761f..1f78dfe84c51 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -674,6 +674,9 @@ static int sahara_aes_crypt(struct skcipher_request *req, unsigned long mode) struct sahara_dev *dev = dev_ptr; int err = 0; + if (!req->cryptlen) + return 0; + if (unlikely(ctx->keylen != AES_KEYSIZE_128)) return sahara_aes_fallback(req, mode); From patchwork Sun Dec 24 08:21:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 13504194 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D61115D5 for ; Sun, 24 Dec 2023 08:21:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="Jpmj18Ka" Received: from pps.filterd (m0250811.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BO8K2Nv026379; Sun, 24 Dec 2023 08:21:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=0rAUeiAqaYdpfPLlrzzDCDA2SPU31o8AUYxcDRcy5fI=; b= Jpmj18Ka164ULD9vHt1WddHVS0iA0LbjD0THLAsLfzPL22gWz1xb+/F8jjiwXBx0 KhlHjMCDMW55kaFlK1N12/+t8fzsXIb812IUsnpa6UZXKDyLQAcFXk3Zltko8o/g MqrUMp0Kvf8usU+8UyV9Lw0ZxREcHIn+heYCFsGqSwTsRPntqbHGVvabSC2WExws PBpbxMAC9RSiwqZtWur8PkRvaxdK7QXzAKSuLSq6cS57DaW57RKfQzpjeqBKZYdQ W5CLircDZ07vFt+7yf31HBbp+e35Iw6DE6UZ82G2Hjh7X8dXi9rNPalKkeqgv2Vp h6BqmpczR0ApqJJStIj5+Q== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3v5mrxrtn6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 24 Dec 2023 08:21:04 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lSOs30Koxlk4d6wQPcR2/hRKxExL4xPx2nmWvLVLUEChDtOI10xJwX26+MDE9M3JBDzeWxK1GGsUoIv4uJ+YLMo3/VLF94Do87IfX4OB0PDToODyXn7+33nKSLtO7KKHiVVDmtltRGPRceQ21STyuYffdYiSyN3anku3IFlRiVRQG6ZpFB9ukv/fF9CI0jlvDTJgAr4w/XRohrgeti21gdAtfnPIFy16YTMFCumkfuZ6q8nW5lrobp5n7ax6EHuZtq/zK7cIZR0pKn/476m8WV8XMVibWQkqPg+bhKDsikIWnzMP49QgCoUv4FxbnqYY5fDJzSX3pZv60QZURoh4Jg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0rAUeiAqaYdpfPLlrzzDCDA2SPU31o8AUYxcDRcy5fI=; b=g+5BxEc7Kc7o9jrame675YCFCMdk/4W6aB4/I2i5adFS3S8txVXUzjOlEIzWlYzDNNpuEVwHd6vpd2nggwfjbQGfp386NjcWV6tLQJNkvgkjJhg/x/EKOuK5ioiUApZAUtCLb8igRRieRsYwGm/19pUFEbI2FHrL/dnyARxtEvzLxr7sZnE8B2RryVvgm5CXfAGTp8dYq5LGbLEpPrqJvU/3Y7Aqt69O/RbxA6hx++/0ghUJEhPZCRpwjzBvYOHJu7KLtRrrk8uyk7xRA1Lk1bWI1+nb/xZ3AAvb8Bj2yBpVr1Eh/N7fgSPW1X2x1H/PQiDRC9zBVGm1wQPSIICshg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) by IA1PR11MB7246.namprd11.prod.outlook.com (2603:10b6:208:42e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.24; Sun, 24 Dec 2023 08:21:02 +0000 Received: from DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e]) by DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e%3]) with mapi id 15.20.7113.023; Sun, 24 Dec 2023 08:21:02 +0000 From: ovidiu.panait@windriver.com To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, davem@davemloft.net, festevam@gmail.com Subject: [PATCH v2 02/14] crypto: sahara - fix ahash reqsize Date: Sun, 24 Dec 2023 10:21:32 +0200 Message-Id: <20231224082144.3894863-3-ovidiu.panait@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224082144.3894863-1-ovidiu.panait@windriver.com> References: <20231224082144.3894863-1-ovidiu.panait@windriver.com> X-ClientProxiedBy: VI1PR09CA0094.eurprd09.prod.outlook.com (2603:10a6:803:78::17) To DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5327:EE_|IA1PR11MB7246:EE_ X-MS-Office365-Filtering-Correlation-Id: e212d61b-290f-477f-a364-08dc04594457 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: llqAP2rqNvVluP93Kfn/++HLtX6hWJk6hfxuIJyvzlbkBKbRFEfAMdZKJANwQdHFBPL2xoOyD53t/CpRVa+sDyN+YkhKIFnwKVPA3hOyJtFCtIInTjIYxDxjl8+j2iUlSVggM7/7HmybYl3MM4Lp0T6YJG1DLcHwOLnmwx1sYOi7zS4GNHg3SpPJFHhBPIOQ8/9nBY8CszSlclPNQEeXJM5p6v/z4+doV/kvDLxj3lvW7jVw4+j/9AzB4ixMJKMlVWyvVzIwLfhqEoXzbTYNlCwBz4GE+2RY5AOO7i9wtPUDmeGOxB7m0WCrXLVgq2U0H5XsYcrYjqixcUpcMNhlWGYlL2jbH3V2TtQj6YjEDizuMS3BhhgCimx42VEyGL2q9bnKRpIOmKkvEOA/36jRwi8arqTIC8OnLskClGbp0BEfsYbLJVA2eXzgDUX73FLK4TeR0YESOQHOAp7ix5f660bY9zKvP+iVpwnlFtZHapPSrZA4Tky+CxFPKLg8G/zacMESbOM6U8TiDF/pj9qGv/jTQsO7JHP0uGrcuAfRm+VXNmTKwA3kTGuRAbjDBwLKHe71uLECjL1q8azIol2nB2pU/eYngb/cdexx/CHtkmQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5327.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(39840400004)(346002)(376002)(396003)(366004)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(1076003)(26005)(2616005)(52116002)(6512007)(9686003)(6506007)(83380400001)(6916009)(86362001)(8936002)(316002)(66556008)(66946007)(66476007)(8676002)(4326008)(6666004)(6486002)(478600001)(38100700002)(38350700005)(4744005)(2906002)(41300700001)(5660300002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cpEEUFY3bqRgvUlIZam75jNUfieqy97kSqexfnLBhEVvKVLJh/nUlTxJQ+lP209SYYrj9TuGyraeeCbavw9MefITqMRfxDWM1po/+EwVup+PnWd5/RbOTMkfgTWdfn7lYgQ1LgGaHyfC75cY6uTAhlnr5STqDqtcW9HGnsMYjuxIlV/gV5OGlBowNVJ59llseMUI60p8l8qzQuK1gB/zphEwtamznUq3JxFpAIebFc81U+CLufz4UJGI7+CcCTWY16wcmCbuzqlwcBVCOfe4RkBELoboldaHpcpNGfNIk2XoOSP3jqCj5fNYue+liDVMP/MjK321qJFvu1ZbYiDLJyUHRNlnFZiXeOj31ExiHKKGEqyhjUFOFwBi5ClI5zplFhDNZI9VtST8dFLuRM2FRyO3BiYBYNqtq9514XNXGqnZ7yprCJJa1oDP2pcUnpbhFRAz7NwAKIFa7OgMUmWnaegHR2anPcwJMR9NQFZA7BVGrmYQOG2hPBbNcmc9ClowbvWq49MS9An0fUtMA2ATfj3rw7BWDa19zoSpt3T1sFij1gdLEKKvT0Jc4uHgco7DIhO+F2+n4biaPvVxTbT3p3p6ziNaJ/nmS65NpKg6LUE/nx7NA/sLrjpvnMOu/UnPGhS5lCUs7Ay7HdpUgLpVVJiYOixDjIIhgFji8wBhasyXqJR32/bIY8LT+FIZAagAZXd/dYvq9GzNNae1oPkfUxkzsPjdk7is2S+CyHChCy187MfM0U6V+6yy3JjBYZWSIuih3LYR+vEEGRL73eccX6cjU0q9fu1oSpUjvWt+Xrtlk3mWQ8GE+cFGDbIiQ181o8zuy61vUqqLZuAq3JlfgCY1Z9iUv7H2U8ehdcApavnYXgRkFun2qYFvLufMR6alXVIBHFEJwCt21WG/lDkn8l9j0W5KwUsVffF+d5zo9cNe5llk/wejQrdfRYp2Ah8h1/n8As2mSGF8NS6UQdCv3zmGiiWVLpRA7ejn7qo7clBpT1Pdxxz0KJSHc+QenKnFtVHWgPQ/zjXxaeY/THswC0k+AxfFlEVWICY5QG07gAiPR0NFBKOfJ9Ko2RfdmSDnNWrvYzmQ4Mfie2H8J662wxiTakkL8fi9B13litR5d+z1b6xam3dCQkmDre0Jh5qQhxj3tkxks5PQrsCNjgtig7iEdbOIH2NXrNUMqfGQO5J6g8AqK/4YMHDQjsTMOnfDR4NSiRn2lnTcIo5tkOReqy4GZ9yykBgBVxL+G1pesd+FoGVWkFBYCVag7msRP4r5b1gYyLp+A160s2bWB/afJMsB+1lESUdMcDy2UlbpUhdJSUcT2t7kfw9prupKpKYrr/NQlg4+mAZi+/FcnQMJUKOmKFbtyfR3imVJIYVB0ytZtp5RTlw3sHCmYfF6/WNHDD1X7ayZvtRM02Er5RzQbDu/v+f0zxeK6gBoR4tI8rC6TEIsOhbARUt3ugt24XJUm64Vhr22wd6A/kY5IhH2C2RVGLsDpya9UV1zPP8cadMifMVIImjnppnuOdzG626fZvnex0qDWkUGs/NA/cA7YmngQzjJeJ9jOS3uBWMfBFd8K3UPqpyTsQD8M89QxEZ1OeaqMnYiJvn5FKnuO1XPWw== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: e212d61b-290f-477f-a364-08dc04594457 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 08:21:02.7976 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bCYtzRIBULd2DUTGjlIOxrLFePj2SkkKjPfe2hsCerCXKK7y3e8KfI2/lEEakmBQj1F+H0goSdwmqJJUuy84YfdXW3u+xK5+48Mosl9bPRk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR11MB7246 X-Proofpoint-ORIG-GUID: XwcS63CQvfVGWFCRMfUB--dzijSf7BVT X-Proofpoint-GUID: XwcS63CQvfVGWFCRMfUB--dzijSf7BVT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_25,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 bulkscore=0 adultscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312240066 From: Ovidiu Panait Set the reqsize for sha algorithms to sizeof(struct sahara_sha_reqctx), the extra space is not needed. Fixes: 5a2bb93f5992 ("crypto: sahara - add support for SHA1/256") Signed-off-by: Ovidiu Panait --- drivers/crypto/sahara.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index 1f78dfe84c51..82c3f41ea476 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -1160,8 +1160,7 @@ static int sahara_sha_import(struct ahash_request *req, const void *in) static int sahara_sha_cra_init(struct crypto_tfm *tfm) { crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm), - sizeof(struct sahara_sha_reqctx) + - SHA_BUFFER_LEN + SHA256_BLOCK_SIZE); + sizeof(struct sahara_sha_reqctx)); return 0; } From patchwork Sun Dec 24 08:21:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 13504195 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A71717E3 for ; Sun, 24 Dec 2023 08:21:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="I+VjHk0N" Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BO8BCGb023794; Sun, 24 Dec 2023 00:21:06 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=iJgRXmmxOfYAkMqG+thW/aEG8gwvOTFkiKsTubRQdWI=; b= I+VjHk0Nv6J/JV5GyJtJA+XSAKG4zulugwvE7LktifIcfB9HQJ6Qb6OdZGg7KF5j 6t1H3IWsfPwrgyQvuiNgLT7vx6E84ecXiWqC7q7AeSZXGJaOtxaf7b7RQtBMjFI/ bhPeViQEQKjGIG7wOgmhXeFQ9RIDK8UIxQGinBbpHDampIy43lC2a3anRiHxYeyV oHJwYMSzGLdoTTJ2BFVZxrMciNLhY771R4WCoJA85F1lVYtacvS6MagmwpGhJ4cm kpmr8sjGZSazIMRenwbwKRBfr2LoC2Bvp4pfmfnCba5Qtat9jmPV0COzp9GHjbk3 MwI9pl65ci9HXQ018ERMLg== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3v5yxm0f8n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 24 Dec 2023 00:21:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AB190pwi1c7GOcJrs78MeFU+TItbvhSDD2Cxw8HSU5g7Mvt8Vvxqm3u9tOCR9HDGXEddLNN5TuTBrNbShnPPqUx9zZm8ZQ7ze6dfB1Z1ah7uD0UrPIJV/BBPayyP7R2M9fq56qRISJWSd4rZY2FR0goGmO1s1GUp/tQpEIgzKAriYoDY1dYVU+29vkifEIxLr+Kkvz1p7uzRszSKNcJc98xatDPIRt+mAVtKT+DCzL4/TxxCqux2Okufhe6fLcZ/4eu2LAGnEw9WK2nFAwcb0NDsDFSg8eXCS7u5tmzptmhXaRejaVz+8OaFE9fx0CIZqQunxJ4DdDNiIux0QyGuvg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iJgRXmmxOfYAkMqG+thW/aEG8gwvOTFkiKsTubRQdWI=; b=bCLSUKOkbRGg34dM5FDz3KvZNEsePrMnao9APshyd72TpO4U0ewVEUyRyvNxUzbgTYHHQgdidnWaDpydC4dFbClhPf+girRqB9p1HguNtJB+PFgAeHNQFZErOW3IdYLLQ0tPt5dTpR7N7nHywi/bf0htv1McUMRU7VINXtS+Ilbf3kqvDCqTbo4rpcTwlm5qBpQBdLiXaKAUl9TowQodSz7lz2SHhJ99HIAJZPmAqrhhwg1biOhLvMjBdotOTe+33Gqm6zZPP28+Wlh3Hr5Bes5IMheknWMo37C9ZxodrQz7xNuSzIXX7chWmM2pUlqAvBfuCg9Ahi1osqrzLNBSsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) by IA1PR11MB7246.namprd11.prod.outlook.com (2603:10b6:208:42e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.24; Sun, 24 Dec 2023 08:21:04 +0000 Received: from DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e]) by DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e%3]) with mapi id 15.20.7113.023; Sun, 24 Dec 2023 08:21:04 +0000 From: ovidiu.panait@windriver.com To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, davem@davemloft.net, festevam@gmail.com Subject: [PATCH v2 03/14] crypto: sahara - fix wait_for_completion_timeout() error handling Date: Sun, 24 Dec 2023 10:21:33 +0200 Message-Id: <20231224082144.3894863-4-ovidiu.panait@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224082144.3894863-1-ovidiu.panait@windriver.com> References: <20231224082144.3894863-1-ovidiu.panait@windriver.com> X-ClientProxiedBy: VI1PR09CA0094.eurprd09.prod.outlook.com (2603:10a6:803:78::17) To DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5327:EE_|IA1PR11MB7246:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d72bc50-4c21-4765-3394-08dc0459454d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: voH20TcP3718cb2UhfglDGpVh7AC054Eq4khwbmridtzuTO9IQ32HHXACuC/MNqqwMvegnMxOAsq395C0cZJCHXdnzhB70j9KKGqF2ZasVnbwWdz+jFQXlG2WXJSxbhc7eXh+yfDltHaNQddfA2UPScLj+u+CbSuZRTOASSyMloEg1yzSeVJMO1v8uzGh6XrMcutHFKhVQYpIw2ZmBoSEna/wgndxLWS48C755gE2jVK2I9l6HCOxP2JyphmgYkMiQCfGsdDT0kiw451JxKkVns6CDT5YfBI9Epr5WasBRfWb9kBxYreDV+DnNWRPruM6h5mGUixdefCqkUIRCy5GmLsItmXtPTa4ppRshyMkzvYFFCueXogL6iHLd2Sk6IYOW97N73oewrSrOxkChPhzFYsqDBvzpVJ8aRC75vcgDwr98bdWZSCbyDeURdfdFijeo8HmXfMuOSRuevnuUhqmEn8qNm/13VWF365JNssc9f7H9X4dIdRHF39L19RE8ZdyobwpGVHgwqAVZ0yX5KA2yiiiiug+njFCCm5Om16yK5PJiFy9qB5UNMzni+MPxxUVX6YcYwxyd340wU04+04k2zhKc3JCPVscRoi+hJ/VaXjUskVgkfIt9gRt5pByR0P X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5327.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(39840400004)(346002)(376002)(396003)(366004)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(1076003)(26005)(2616005)(52116002)(6512007)(9686003)(6506007)(83380400001)(6916009)(86362001)(8936002)(316002)(66556008)(66946007)(66476007)(8676002)(4326008)(6666004)(6486002)(478600001)(38100700002)(38350700005)(2906002)(41300700001)(5660300002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FaPogGgOGdVCAWBUad2/pKE8RJ2ZM/1gOSaVOwHC1OR80k7SRsEQavrPPQBueH3dFmAM7TRy7NFf8jee1pdFTzhmoA1sCQ5d3jwblAPQSKw1iNsYj5R5C3GOlUCvyPWUqKWtbfnqezN7NhC2bB8Fu5ub6VWr5nPFIkQCkKXDue3LTYTscvGnkq1Q3vyq3deSwRkJVzubrh0LFcBcbLDbSCMPZaw1DoNIITzMFAdxq9TQaamDkrrtTLJIR7NlDGvATzuuzJis2TPplbpf+n6NbKXLYNkrvoJEakyaqco6B1uvca4zX9atCwp1nzd+rCHHJt+rhrEKUzQNPVR6JKIsrvBeFWDdBdPrTYUfjm5AY2adsuInZtfrcblbtH7hUDiKvF9yh10xZ1TocFInDdF3kai3/d8Wl9RdYzam106fjGghQx1OBy6zXL+PBTbpiW+FucLN5wstq3P7xmYmFlfH5mICi/7wbswlNh877r8Sjhth8TFU1YUhdrPMnnY5Tm2J9VKC7XZynAVdRu+OUuzLB+AjJR81DXJvdRfvqsCi49a/4UbIDFAbm+Ju+fugTxWRNq3Yms4R4Vv5MrwgNPdP+7sV678O783ThO/pt7qV6AQmq7lXM1uB+FpfAErxHfAOEuM0KCUPTszUiMTgLx6JmHMifkDJFfBEpSQeNUNsNwbKRCNTkYIrhbdg1SI5VMqYngOnd6urvWtDyZuAZGP5ZuCUOpLbpVtvZSYiSEKuv/wc6terW7vxXpvj4EXvmNUk+8ahTEWjd6c+jsdEFDLm/8GH1NahsSPVscq5Xer4uV7uJ9C3tyDK3TudzCiRh/WxazdkCV3513zKW7yVYj+xwK0VsY1mPscgY48LtUh5FTXeDKCXhkQMeve6BAgH4x2INDfI9nAAJ3xD2Ho9tHk/DaYRfqG4H+Y7QemYvWq7TEOsL6FT/1yQNGPLunxpKc/Hs51yEuT4fL8GHmF9ZQFnuK4T8dGh+/Qia4D/7HFYJf1k8rOcoR7lpcRUxeAQCI3t4LjUBnMYK1gEY7mmjtOcVRYTtzXClLxIrc0rg09oaJgQjKYgQZXwrqNx+BppfAHH8uPM1eZs8kr8Y8uuMOMzKKIXbImAx5WS8Qra0gKeHD6V/6S9ZUhUB8OQA+2EAYOBPJUgGZdBeDjH39XxWcU61z6eTOLAPnE0eCljTSlp/awB/LA5UvSFyvbRpidqSQDR4mJP0Q51zYp+5vAY8RTSihtSVMmRjQVEOz4S9FN0g9ZwAGcx9A+5DQJyI12J2wCwG0rue2eIUyeOb+C0WCkG0hIk43n5NLwoVc4zc/oPYPWhxzwOov9GD6A5dH0GqlFkt8D5NhlJ7YhZ5cZQGZVjRiRGf5WgBZ6NTX7JbZnUBtcEuSdj5I88+IRNvPPgU2bSmdy6NB0aRe1XbN3r/1w7Q5pq0PCjlCtu6pPhl0UVoOF4bX5HB6gbvfE15BTwLnkM/cr0b+xZTSsKxsNKZ67X3P3CEXM1HN+7tKN4lYf86yBuD3+kyRTEErE4QRD+oeduZC7EKEd6g8nZOJW7rGH9n8LtJPzxOsOwjNWsLM+FzJ9p5CEbFbXI03YJ4kGYUmPpMOVFbMqSswXmEX9AsCtH2g== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d72bc50-4c21-4765-3394-08dc0459454d X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 08:21:04.3117 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eUoeF11tZBzurVAnHhfj+2bHG+FO6terqh+swwLXTpv0oL2c+QMyiQJK3S3UYv7BtgUbjsU+NgF39Yf5DKMvhHEf8VN9B8y+gFzahSnZ2P8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR11MB7246 X-Proofpoint-GUID: HB9_DN1xZeNnYTzPNvssNzmxo33qVCRH X-Proofpoint-ORIG-GUID: HB9_DN1xZeNnYTzPNvssNzmxo33qVCRH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_25,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 priorityscore=1501 mlxscore=0 bulkscore=0 impostorscore=0 adultscore=0 clxscore=1015 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312240066 From: Ovidiu Panait The sg lists are not unmapped in case of timeout errors. Fix this. Fixes: 5a2bb93f5992 ("crypto: sahara - add support for SHA1/256") Fixes: 5de8875281e1 ("crypto: sahara - Add driver for SAHARA2 accelerator.") Signed-off-by: Ovidiu Panait --- drivers/crypto/sahara.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index 82c3f41ea476..a9abf6439c4b 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -605,16 +605,17 @@ static int sahara_aes_process(struct skcipher_request *req) timeout = wait_for_completion_timeout(&dev->dma_completion, msecs_to_jiffies(SAHARA_TIMEOUT_MS)); - if (!timeout) { - dev_err(dev->device, "AES timeout\n"); - return -ETIMEDOUT; - } dma_unmap_sg(dev->device, dev->out_sg, dev->nb_out_sg, DMA_FROM_DEVICE); dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg, DMA_TO_DEVICE); + if (!timeout) { + dev_err(dev->device, "AES timeout\n"); + return -ETIMEDOUT; + } + if ((dev->flags & FLAGS_CBC) && req->iv) sahara_aes_cbc_update_iv(req); @@ -1005,15 +1006,16 @@ static int sahara_sha_process(struct ahash_request *req) timeout = wait_for_completion_timeout(&dev->dma_completion, msecs_to_jiffies(SAHARA_TIMEOUT_MS)); - if (!timeout) { - dev_err(dev->device, "SHA timeout\n"); - return -ETIMEDOUT; - } if (rctx->sg_in_idx) dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg, DMA_TO_DEVICE); + if (!timeout) { + dev_err(dev->device, "SHA timeout\n"); + return -ETIMEDOUT; + } + memcpy(rctx->context, dev->context_base, rctx->context_size); if (req->result && rctx->last) From patchwork Sun Dec 24 08:21:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 13504197 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36E761866 for ; Sun, 24 Dec 2023 08:21:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="HRL+BsnK" Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BO8L56l004794; Sun, 24 Dec 2023 00:21:07 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=63lRtlaUPtX52MermXR5DP/x3uPHwy04X/QAvCirJFA=; b= HRL+BsnKGd0sgktxRqSc9p6jALdpYTTfslkJ3+0CugIx2mN1gdrhLSYJIFlB4gYG GRpgCLiQdkEnyOn8yq5NsBcki0EzBY0rpBiEUKWcmnlDcoWcLFvsEnFegwCqqp1o vygVFPZUP+hh3cymYWpQiWFjwqOxH0dEXV9sDd1i2hocRsMAblulBgS92iaE4TzD Mgq4BUPZNl5yJ6lPW0uOAh1DLchSJ7dX3eTmOp8qzkFA2BaWjt168+0dzKItu2TF QJJriph+7yklxJE4HXy5vCyv1+fD0Uxz+WgltyY+TYjd65X3n+R8H5uk9sWJHiAm pY9oRc5TWBKnCVazGtbaeQ== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2100.outbound.protection.outlook.com [104.47.70.100]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3v5yxm0f8t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 24 Dec 2023 00:21:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gLQNsczK0+UhwjX88nLc4Bqq9/9e+o1o1pPu0Tglr1KbfRodwO9vtpa5sTluTLpqNUzE2a+apV+8fL4xRBw4joRdudovBqebj0wY5L3Zhkm8zmtD/jjHh8ra/YNpJPl6Sd86UOXxplmntpFB8p3WziVK5GkkwEszeqVJ3gvJLRGZJDJ3lq//yvpND4WQEnn4tIuxIEnujuwnl37L42+mYdM6rVbQAv97AKnGWZarkbhKz8eTFooi/qrabcvtttcLnE31r7thMbtEMD0TChri5qFMpJHTeR3zTP3HKM5LORUCuRk8dqaac1XkVNNEEuHF7B10e3ump70uu/I6A+NJ8A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=63lRtlaUPtX52MermXR5DP/x3uPHwy04X/QAvCirJFA=; b=euWwa6x7wkgXmDUFvSG7TnR6LudAXt/MLTfRv9BvrZHaQ8VzOWn9YjaJ/wvfcDl5JDaxITThQU1/xMgqcVXWL0/1mRqw3JNa63jwwhfQ3yPAlRTt75/rbMP16m6EV0dA375gwKTBPRf6CdbrQvMJujVZiyu7OBnu1HuxRH49nGlrv5sbTCnmoGZaOQAy5f1PRvtPAoF8sb/X4IXmc4XZ5m1+lhsZ/Eq3s21CApg3rwa7i+RtB3JwSlrUa6hRIBlBiwJfkWpJB1ZHRT+06ALEc9DqBM0N6GU1upE2INxPiKUJWEdciPtH5Yhl/eY+g5mpnBODJHQYcIN/gtKVrCgdAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) by IA1PR11MB7246.namprd11.prod.outlook.com (2603:10b6:208:42e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.24; Sun, 24 Dec 2023 08:21:05 +0000 Received: from DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e]) by DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e%3]) with mapi id 15.20.7113.023; Sun, 24 Dec 2023 08:21:05 +0000 From: ovidiu.panait@windriver.com To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, davem@davemloft.net, festevam@gmail.com Subject: [PATCH v2 04/14] crypto: sahara - improve error handling in sahara_sha_process() Date: Sun, 24 Dec 2023 10:21:34 +0200 Message-Id: <20231224082144.3894863-5-ovidiu.panait@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224082144.3894863-1-ovidiu.panait@windriver.com> References: <20231224082144.3894863-1-ovidiu.panait@windriver.com> X-ClientProxiedBy: VI1PR09CA0094.eurprd09.prod.outlook.com (2603:10a6:803:78::17) To DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5327:EE_|IA1PR11MB7246:EE_ X-MS-Office365-Filtering-Correlation-Id: 766fd93a-c782-447d-ef53-08dc0459462a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nzV5dALnyAZtGDI/mf/Ej1FGiV0HEGydPc+O4GTFVKDCS0TLBeSacrkIF8fTuwXI8405wDR7qBO8DCwQXhJsdkziuqO/OIUHJk8XBTssb5290JcXVLVXQHbKcKiwOzsFGmKyIjMofqPtIMc9jC/3lLATqzJdgBvv5At/aKXZMRqxMXeBi7ytNvh5xMbTig2pUacZ6AcUdAPdDDGbruni56oQKrUMwUUtIC0Tg+fj+gUaSPX6E/53Ai69XCEF43NqSU9Y3dkiPYFtLzwnO1z+Y8SKcq7D0XgjbaVdUHEiXs3wkcIl9e+GNR1ZMU9PBJLAOKQt5i8LswQ/CqQI02unQ6FHhyJIcMr16Rji7yUtibzDdP9bwdNPWTYhFBSGRwW5g5JWe/WeOL3hBQUZttELlC9EtcjnYTn7rATiNrgzPcecJzYauLACWV2jSlOwkCAh5ruWJnVqCgOpS/TxXldpBrvQ9c2wqVDsetDgooIuAmForC90nzh7Y/A3gd8RNMTXwkvhkftVJvMT+TwLsDuLdiy21TBqBVF3srmHjR2Euz/aZr+97FXpiOZ7tsLlc9kML2QVeLyh7nEppXB3P58/ZAzKEDObgkhBOEoKAyhprjBiNzO3z5Ktejd4OhnqRKxU X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5327.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(39840400004)(346002)(376002)(396003)(366004)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(1076003)(26005)(2616005)(52116002)(6512007)(9686003)(6506007)(83380400001)(6916009)(86362001)(8936002)(316002)(66556008)(66946007)(66476007)(8676002)(4326008)(6666004)(6486002)(478600001)(38100700002)(38350700005)(2906002)(41300700001)(5660300002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FgGhfa6sCL6QCXskiU+Yw2BwQceDhHkchziLaIudr4+ggd1pbfjIDeenCz+jdR1vn+aRm8bZdBkhUnYdA/PVZz2M+ENt4T+iUIm1Q5o+SEKy/MJW2SOeosBTYis3tiuyCOuTBFQCrWect+PCwqsyxUkvINOEgIXkWhbxAfJJOy3khmyCCd07OZSBUNj/y4gjEqt5WHZcmnBuyKWPFjolEC8OumKk8pO0DP8J8KvaRNS2+zeWD8QHZDsnB+rZjoYUBgkX9imWM/IdmNqgEd34EmP9840UjkdkqjXzrEReGmmE/Z90U/O0c75Di/ur6/c6KJPG67NBj7nszLljGmpbJnCSJl4Q2qWUZ5FfEtFTkMVhreXnZpWtfNCNHNFJpe8dSEIeilNlRaoKWLPr9AnsKWTsWnWYA2cv+FFFnO5ldBM/1Evx+zwM8JXr+EsH3s/rGKtZVppUAbUpuWhUpKudymy94iWOjt67VsWkR57jkNPaPNUrFbiBEGuduNAknUJjaSZdYbuionJuEr7wHEuTEip+x1kunNEb73+mWrQnP32bKv1PX0OYdGM1jK0WfungmRFFOktp8C+KbpjzuR3Lu7r3iMtjN+n0zple8Nvq2qJCAocF4D6uaAYfbM1xFMRdRigRVo1t44uSTTusllNI2axT2SC9z0gtDe2Xna/hpO0VeVWzQKM44SZOrZDObtnzCKvHKpj0ff6NNgtcpdU//b9U4l6tWkli9urQLOvqtwdYtYB9eVQnNLzKoLQUJeT8zNRPFa5+ud/qnXRIMwRti0rTliDN4u1ianuGu1+DdWj5q7qXggvtyvhbO7MD/pAPZCo5ib8IOJ0bJjLP+2tM0Kmm5b3NyADbQ2vsLkTM3qH0InlumXxav9OXOpWObvEMeneX77bzbu/GCcOn3CRkT3GfSpiRn8268ZnEwigY9nTDnHC9WbgdUWSyHZGt+184HCTFQCXgGrDeaOHRMGoFzG82UAS3vvwbsQM5eVEqghGBJxgU1I0FhbTgtlI7jiRcj6N7xkmuZygmvNKOerhk2LuPy8pEEvPm33lnimkxEVGndGiXIf/JIOufCKF8CIhM/OxtObpiqyiAabeOd0gi+q6Abp4BQl7x8RTqkenRdeMnImi8kIpizv+JP2zBu5IzxleVqr7lfpPKGrSGr1JZxbtKEkuLgeuxw0IHFelbm2tXlc+nwbmcYFeGqZ8n9w4saC2GAhP3D46wddV7jynkx7IwsM3UuJM3OFMjEKSl7K388kxxZj2KkL3xt2kX+Q/TINLSqPGbNmHu6lTCEtirCpZkjiFfdXgff/wZFnEil1J5Vs6PDyuw8Yans+y7w3UQSUkj8os2pBhEQNaEG8CHhpDLbbvTMa9ueqB0D6nvHnrHNKewCDdYAGyVlz7kKKK0S75c5n68E8LbDjQNgVcCTrLHIdJeyX0hPtWDghQB+zv1E6zhc+jGmRaDsXg3j9W2dxJq3ZqPx8oFFmEp6TT5TjPxbLo9My6clwlCI63bWpVeOf53mvm1HmPY+1iLcxEvYUUORaYdGceigXWHUI2rut1ptIrLK74HkX6jstK5F/ijI7HxWbykK2oAAqW+MOSz1uK4H1ctVI6zNSU0BCML9A== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 766fd93a-c782-447d-ef53-08dc0459462a X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 08:21:05.8061 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6GYGMuzEG8pRmrx1vjg65as3SfuAIq/CGSWkDHqLQINUGAt9aTcF6mOJVuJVt9WcdZmSNAI1UBv7a1es95qR3+YD4KpBm8u0yXuW1zyTyqw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR11MB7246 X-Proofpoint-GUID: SLQ79RyHF2ytDDclGJqJdc6js1hd7VXQ X-Proofpoint-ORIG-GUID: SLQ79RyHF2ytDDclGJqJdc6js1hd7VXQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_25,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 priorityscore=1501 mlxscore=0 bulkscore=0 impostorscore=0 adultscore=0 clxscore=1015 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312240066 From: Ovidiu Panait sahara_sha_hw_data_descriptor_create() returns negative error codes on failure, so make sure the errors are correctly handled / propagated. Fixes: 5a2bb93f5992 ("crypto: sahara - add support for SHA1/256") Signed-off-by: Ovidiu Panait --- drivers/crypto/sahara.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index a9abf6439c4b..d49659db6a48 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -985,7 +985,10 @@ static int sahara_sha_process(struct ahash_request *req) return ret; if (rctx->first) { - sahara_sha_hw_data_descriptor_create(dev, rctx, req, 0); + ret = sahara_sha_hw_data_descriptor_create(dev, rctx, req, 0); + if (ret) + return ret; + dev->hw_desc[0]->next = 0; rctx->first = 0; } else { @@ -993,7 +996,10 @@ static int sahara_sha_process(struct ahash_request *req) sahara_sha_hw_context_descriptor_create(dev, rctx, req, 0); dev->hw_desc[0]->next = dev->hw_phys_desc[1]; - sahara_sha_hw_data_descriptor_create(dev, rctx, req, 1); + ret = sahara_sha_hw_data_descriptor_create(dev, rctx, req, 1); + if (ret) + return ret; + dev->hw_desc[1]->next = 0; } From patchwork Sun Dec 24 08:21:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 13504199 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 274AD23A8 for ; Sun, 24 Dec 2023 08:21:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="n/wCi1q6" Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BO8B60p023677; Sun, 24 Dec 2023 00:21:12 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=2/bBsHOnsse5CzDHR3+pI+UvwBS47SrmGuAP512pr+Q=; b= n/wCi1q6//9w9pKZPpSONwHNOXBO08qW6kD6BKSFBaKU53lm66Of2Ju8HzrOVhP3 fvRZ2xGqqbvc2jz1laFSeUQ+hqmNqjpPDcBQ+PRR8DuhMHsyalpjToHXtsCiHYtv 0A322n8aMurj6EyWSbLd2OE3RBI/O1FUdSj0bIweGPvxTPYwHY472XNjs2TUPeuA P8sfPkbtDdFHaUiSA55d3s8z57o78dyzEscEhJzwdnLFQq8cW+jbW/FwMIhNIoG3 6MEa51h78cuv4ev0qRSkbw2d9aVSNxRRDRvZz1OHzhYCk3lkS973ubMx8mqP24yL +vj4awD8B/LsickjnFZINg== Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3v5yxm0f8w-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 24 Dec 2023 00:21:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z/BO+Xx7RuknIerS5Dq52WTel5rxL0gQYYEy81bJT4GPwOV15b3wrHi2qmNrb5Oo7lrCrylX7TUbO7pnrBmWJEgW6EgIGBiLz+zEw2y0Y/EWyMoBlg0RPfu/cD2pTG3HAkLmO8AKVNFq1lkD1TLKhK16vmj5JXu79rfYrGws+lYRVme+ZchbW/Macx0SMB7uQWcbLWqKr+6vUZrHInQ0hYUajYP2jiNXRgryI4qTWtQfOuFfqmzsw0WBdxjxX1ZEQWkFpdXLgp0uipg0zi6kFTmvV8fVAjWK6utu7xTahEykb1oEatkiVzcXQPL13Xxrv+zoc5XMcduVfvPAipb+zg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2/bBsHOnsse5CzDHR3+pI+UvwBS47SrmGuAP512pr+Q=; b=VU4RihxTYx5mIaxaJ8Mmp6mYenw87KxErHR4sWJFE8JDw3vXfSvq1dpx0ZDM4HNbit07zIQj+yZZKCfGYsgiJ3D7XnkSwv/G02EMfLjHRRgq5iKK8KztZvyMMRGIWwq25YroUDzPmkd0l3pMo4HpqoL2AjnTu9gxYx1cLSDS+OnRPoUBuaEzu8qgZy+vAYg0gf3uqoTLk9rKHtkWoMDFYfrQ1pEcKmIMGW3Y5vnfIPAEYELI1nU48tGUWd4oLotInQTE6hI7Ixkia6eEBtbceXIffs3JhNykCZpepRH/dFaAc4tZAvTjW9x9DV9GXZHcO543OCn5qNFZtQUu926jdw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) by MN2PR11MB4693.namprd11.prod.outlook.com (2603:10b6:208:261::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.24; Sun, 24 Dec 2023 08:21:07 +0000 Received: from DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e]) by DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e%3]) with mapi id 15.20.7113.023; Sun, 24 Dec 2023 08:21:07 +0000 From: ovidiu.panait@windriver.com To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, davem@davemloft.net, festevam@gmail.com Subject: [PATCH v2 05/14] crypto: sahara - fix processing hash requests with req->nbytes < sg->length Date: Sun, 24 Dec 2023 10:21:35 +0200 Message-Id: <20231224082144.3894863-6-ovidiu.panait@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224082144.3894863-1-ovidiu.panait@windriver.com> References: <20231224082144.3894863-1-ovidiu.panait@windriver.com> X-ClientProxiedBy: VI1PR09CA0094.eurprd09.prod.outlook.com (2603:10a6:803:78::17) To DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5327:EE_|MN2PR11MB4693:EE_ X-MS-Office365-Filtering-Correlation-Id: 1b6187af-c075-430a-330f-08dc04594731 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zinVP8kj6GH3+W7L6Xcw+tMl7JDXTHC03GylMrkSikmlhiUlBSKk92GQQRoHBsUHNtBeKNiGRRb+xIjs0dfVP0s1QdqXK9K+wzBfINefJ4zDSyZlQb21PCSQSEg7BukV/1rbYf6Rj0PQ5/R7l9k3h5k1nLEWZ8qqahulX0fb+rVcXHK417KkJ8AogolyXyI879Ont9v41T6ihcQoVvlPiZz/HwoWH40MxuhfzLC5BP99Zp6VJ4hpLaCndJwl/4Q9kI+mPmp+G/6/WCYdyfSVTNg97QQqgiUULaFhvW8bQTwSkRuJV8nOZQsCaqDVmwXtkrYaabwnmLz44D4gkUO3OZ6e72lWBqAnF95ZQn6Ksp/FitdKfTauXvgs0UQCTl6PePpLzyWivOhphJhthak5y/zjtBpREtYiyRkBdN6MTqptND6AEfYKessipB0jlikmYlqQM4PCexK78zL+dol+uYP4UGBOZCpuFVIQFb/HYRjos48b6DCJP/h0wb5qL3L733WenuqQIiL3Krry0d2u9rMOAsx79HLvvodX/WAzsscvQnlet2HZr7TeTqCs43PwTWtSVGFj9NxnPh3qaBvUtkx6JhQZp0lQheYzbyeUVkzT3wT+3ac2eeC1/VRPUHVn X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5327.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(346002)(376002)(136003)(39850400004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(6666004)(6486002)(478600001)(2906002)(8936002)(5660300002)(36756003)(52116002)(6916009)(66946007)(66476007)(66556008)(8676002)(38350700005)(9686003)(4326008)(6506007)(6512007)(316002)(83380400001)(86362001)(1076003)(26005)(2616005)(41300700001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZEd3YTg/B9aA8yjyHF1vOsFK4bMAD/T93Y3BthD7aUbQf3wpf6g6FEs9tfd8VfXXhN7CAsEUJphmuYM7uaY7YyqqczhrtE8EdI46lSPWl81quznLUY2L4rCSS/0Z757KijXxr/Rs1Byvf2rU+Iy7ujpyeps3mU0sIb4IW1a6fyMjBGJzjfBJs50GcKd7xxzVSbNXp1wjN2l0eauA2b/K4cMRc6YGK951G6ycgcq6SgcsC9+zSpy5xyl7OWvr3Rahw1b+2AaKtyqRaHoqJAulBueT1WPQvYcNvSXdp0bdGs1bf/stGG8C/stVkEDEhQCW4uH9tT7OOCKf67WN7zRP1YM8mnRu14NO7+b71xYJypT/Yq6ARc/EMHp/D1Egq5TwTcLgViMqSGw5ooBVrrBmDRWX+VL4lTdaI9KVE/0aXJXszL44lqcHeAc95djTXHKxRdnZsgmSG5TLe6kzCgiSXqcnlXmjCIBA3+JocAGYV4Jm5biSPrKn5CWAHg688DAJ5nOPqWsdjbTxUQ/7D9VH19cTsJNVIJCfDNLLWsa0R4B+LzaohxCP7rLk3Sg4zv64/Hh63t8kp5vZU1QQZLpkqrimDvYnEgb0E1osV6tEkpDPfFGyaHDym6eIR9L4TZfXNJPQBOsSBW/ims0EiqHRpKVJ6F40NSh5/uOPcyFEC8WfNY3iIu1Otq2WIHq7vrgT2xSeSHAaGf9cLR/oUgMIgHzq+zLmiUEQllEhzASHw5WHYw2YMr9GfypwTOw4/IJMcwhnoidzJT1REOyA8YEtrVHH8kldxT9nIGm5gqadl+GwxQtDRazX2Uq3ckQHE5zMBqOGod5pP82MkxYlYBuyL8aa2+hzkE4Ih9MzbFBopTLyFTRZJz9SCi8ViN5wKQsYVCcHyNIFH5ay4WRDJlwfDla36t8s4FVMlqbixr/r1O3BIaPvxnimf/37c+DkIcXOkVRmBUDHTASNzxdIbLImIdfHngUIq/lQc0p4BF4bB8dX1/5IRt1LRTjAYPXR3wI5nMVIYsJ+eGY3OSFs1Bi3kZjfPHwJAmikkc9iU3OGy0OT5f0p6oRYFXzZ6lAi8HvJ0LgVlaoVipbBNqHlIKQqIFHenl0iPlnIAX5MFWW8T1NlyVBkfGpVnDp3/AkO8BMI1Avc5yNKyq4MiwYyjK9MY1GAyJ9olU34bm755l/u9kUSLX3xuKNn4RB8pJFZn2uq60pOR0aYilALSS/9oSC5rKnOSOqYJsqnNk8QqLWhSxABWZ0pV1zNH7S4kwHig1iGAyAplJmgJ2bgyP1uqaRk+GJgF2iATSpvwvqfn8SYWbVF1lAw7Lr1HjZbk0ztkSRgBdzJQVLmopQQETgqGQzrqNUbOOMxE/KucGMEIBWWmSQXAiORVMfluyvvRbnh7bwSSXv5+a6RACsrIZIA08aCE9Ky7wsfPDZHgMxD6HBQDsp+oxuRbXEvlxCz0OjlrCy8xf3XZ+Kd1zA7j59AGBUDgUrdT5Pf7/CFEqInQf4oSBv2uOBUMxd9M/mw3QoD38yiJJnfXbEpNy4kBcAP3ffX7Wy3Hi0wInOibww3cm9fuk4OQsm4uIlxpH5SaVbiPMJYgi627QcOQVcnAUmvhjdICA== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b6187af-c075-430a-330f-08dc04594731 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 08:21:07.4213 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mq+ed4QMsca6v3B+qCCP2jEujYGfQd+RWjaR2gIP6F+VMJcRzHWNQFg78YBOVBo10G6B6t6iWnqKhHBNtwTGgvpqaKNCY+71squon3X6aAE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4693 X-Proofpoint-GUID: byZQmAb84IuqYwKb62KhYVvmSa0lZiqU X-Proofpoint-ORIG-GUID: byZQmAb84IuqYwKb62KhYVvmSa0lZiqU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_25,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=920 priorityscore=1501 mlxscore=0 bulkscore=0 impostorscore=0 adultscore=0 clxscore=1015 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312240066 From: Ovidiu Panait It's not always the case that the entire sg entry needs to be processed. Currently, when nbytes is less than sg->length, "Descriptor length" errors are encountered. To fix this, take the actual request size into account when populating the hw links. Fixes: 5a2bb93f5992 ("crypto: sahara - add support for SHA1/256") Signed-off-by: Ovidiu Panait --- drivers/crypto/sahara.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index d49659db6a48..321c11050457 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -774,6 +774,7 @@ static int sahara_sha_hw_links_create(struct sahara_dev *dev, int start) { struct scatterlist *sg; + unsigned int len; unsigned int i; int ret; @@ -795,12 +796,14 @@ static int sahara_sha_hw_links_create(struct sahara_dev *dev, if (!ret) return -EFAULT; + len = rctx->total; for (i = start; i < dev->nb_in_sg + start; i++) { - dev->hw_link[i]->len = sg->length; + dev->hw_link[i]->len = min(len, sg->length); dev->hw_link[i]->p = sg->dma_address; if (i == (dev->nb_in_sg + start - 1)) { dev->hw_link[i]->next = 0; } else { + len -= min(len, sg->length); dev->hw_link[i]->next = dev->hw_phys_link[i + 1]; sg = sg_next(sg); } From patchwork Sun Dec 24 08:21:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 13504198 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31956211A for ; Sun, 24 Dec 2023 08:21:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="f5Y+d9qw" Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BO8B60o023677; Sun, 24 Dec 2023 00:21:12 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=FXaS56t44zj/tkmmQKSjESH5fMIQsk5WTxpi0bi3nEI=; b= f5Y+d9qwIDJcOhFatZroYASAH6OWaWwAFiQozWouJJpnxrFNSzv8/lbeCBzKS7EZ FaMQ6zMhTs/nC0lnKcdhKf+kppbJ2cKl42NFBpyW4GcFLT1vIb8uuDrBMHkdeW6b IDQkXHmyLjWxdN4V01halURqLZ4nCpnZlmvhfHRqjye8TEUs9vx0Sga77n1pt5pp ucvRlG8ZE3ST8cmHFfdc1k/kihLzLD1IBrfb+blEVRP61itez53h1SsfN/ON9o1h WuxvRaxpSWmZnjLRPzTn+Xzi3atA9PxyMsA8hQXCFSVj5oGu4hjyI5hyd506p5Fn mqb2QLCVO6pzmYp2LyvEFA== Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3v5yxm0f8w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 24 Dec 2023 00:21:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P9blGF1AXZdZ9+F3ufUS+N1PuBZoCf5Lr4N07CSix83h8+LCdxOyE1qMczdHCNmcBSOH8ExMmPhV0EWp+Mm0aqIjgODzBF9DTyOcrfRYmmbKF05W2puv+PPW4O66ymNjmFxxcB694USNVD5U/6o9uZo1+DRQEO2D7NYAX7eRoWDmqJMBn+9jhOKDbt2zGunbmG+01e2LA4Qtb7tX8sgbxb7bfQCrOLkz9BhpC5xBrHaZi+RyWaCGswk2S9L0I2xsZXAKrKPEPBT4o7WL4Z5pnQj/l5ZQfiC2ZmPcqh+JssGk8JXkqPUlOorH+lK+14X2wvLwQxwISe+WpRow4GeWsQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FXaS56t44zj/tkmmQKSjESH5fMIQsk5WTxpi0bi3nEI=; b=AjPGnrJPjQC9R9rUky9HVzIulqci7x1gd+dEy5E/6XnSYbcvhZiuokhLslYL6oDRSXIueY3rkBeCWCORbP3eRMsXwCDQajea0RCqfq3MTepc+zkvu3gfTGjJisUheiQ4YmLBmrp3WhcLTpFW2RQuTWOZzosSEp9UdEQ8QP2rLS5NEThKWHrcZ6aGIupUZvUESYYKIi3lUYmfIlGFCYLCANoTThu+HQEQmGsAZDvT6eN+Nu2fxIlHkoDoMUlkR38/jqvlPTFkgR9xk1epR41vgUfYLX7FkJWHouQGbhcPqnpcf5Ix0fRerezllEhP9L8ew8oQIr1A0NhoUjEVduO/tw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) by MN2PR11MB4693.namprd11.prod.outlook.com (2603:10b6:208:261::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.24; Sun, 24 Dec 2023 08:21:09 +0000 Received: from DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e]) by DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e%3]) with mapi id 15.20.7113.023; Sun, 24 Dec 2023 08:21:09 +0000 From: ovidiu.panait@windriver.com To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, davem@davemloft.net, festevam@gmail.com Subject: [PATCH v2 06/14] crypto: sahara - do not resize req->src when doing hash operations Date: Sun, 24 Dec 2023 10:21:36 +0200 Message-Id: <20231224082144.3894863-7-ovidiu.panait@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224082144.3894863-1-ovidiu.panait@windriver.com> References: <20231224082144.3894863-1-ovidiu.panait@windriver.com> X-ClientProxiedBy: VI1PR09CA0094.eurprd09.prod.outlook.com (2603:10a6:803:78::17) To DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5327:EE_|MN2PR11MB4693:EE_ X-MS-Office365-Filtering-Correlation-Id: c223f1d4-58e6-4a8e-c7a2-08dc04594807 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: URAZtF8FjYOZANodqSK79pIIoO4Rb8OQ9yIrfmEJPUFqjAMdQ3vDgCRN4UUlcAUrb1wxzg9DjuOcpYGMct4tik5le2HHYv80oZ37BZGDPezHm3lQYQN1b4I82SeiH9dO4D65ga/QDlSge1v5e3dgfnHdCjmVrspIpHU4qPrSGHXjVpAmQ78/8GyFyVdH/W66vwSvqZ/ZN7euWGscGKxvWp2Fznq5UmQaXpBup5BXfVyCm6cQAyw1q1jvK5m+7dJzueyPMyQ0mbsvlOKJdypF5/fiueGBJ0KLK+jmegzSnRu8Ktm6vYkBGJxRWgMOIAdkXJfsERJTyrntGv9x1eeKSVvTlvzhf3VrBj29LFgU0M9n7w020yH/HUSC3SoCEFl/2P/7g9EeK90KBsg1Hnngt3fIZsLgVrHKF/sTMNXYJaoAGTnJmu0s0HswcUZTTVO95iW096ROfXSFztOGbdKetTBaJmXTm4dq/kfTmPb2hm+pA7nuiys2Qco9nMEWihf8PNUWhts2Ptel4NcRIMzm13IOGzFn+UvKaYoFfAiJ15ddVa1dZgtfDiald9KWf+jJ2YvX0dCsgZeibwZ3ddM0h14XHLJ7J3EAbBTUa/n97o9q0NFb1qHV76djFV0Q+CIq X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5327.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(346002)(376002)(136003)(39850400004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(6666004)(6486002)(478600001)(2906002)(8936002)(5660300002)(36756003)(52116002)(6916009)(66946007)(66476007)(66556008)(8676002)(38350700005)(9686003)(4326008)(6506007)(6512007)(316002)(83380400001)(86362001)(1076003)(26005)(2616005)(41300700001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eirs+2jOB5T2zqBBtrypKJXeIiV/Ca4tS81ueKBH+sPZDR8fvlVuw515p6fZ8QuNqBfn5UeDcU34+D7YgFUFHo3VOfwGfCLphpSCzFsqsvGUNAjlx0Un/plJpRX+aT9iLHgI4ylP80FD0RvVwESx7Gm3Y60WMFLUagmg0fRfotvoeiFja3j5AR+9m0XBl6uNZ63VzIugaq0fWztabugLnGO+xr7iEpg6rnfl7TStfH4EeWa9+75XbaSc6j3i4ruYdzd+vtcWcia/yos7KQuEPhZzQeySkoCYojDZFb03vKVAiydQ6aCONUGa/C/eIxC1EJD1TCNLnNHnLBeQLahhLmjEoYsBz8P4kV4LqGL8geJLAELLLQ6B++jBjJlnssZpOFJm8r6gTqaWv1upiweYMnAsCWjEDPBza3/l5mxn/m5lwsUhC7Gy5qoDohx1kRv4hEi/q5MzBuBJ1C5akgsz/w+Y9VWPHDJ/QtNcvnFVCHXqPTYFLEajS/X4OeewCfw2UBne3OCfPm49cFW9CjLXYSUc6jrDE61pt0YjMiatTeAO/ESUTHKyim+jpv4m6ha9Nk14l/kUqPEm1qAMxe/BwQ17HqU3hJH8rXC5U4PsajTzNvAgUZJtJq1SynUJ1kMDvXieRNuuFe05e3FuZdHM7df3SIU3v4ly2pHW+e1Y0wOwHIjsY/MbeDks1y7u0zPmYmBatHid0lYLKq1t8PBbRiITwnop20JpfoCbc0SNowFPHUlWhdGzMcu3pZuauv2uaxHwHBFmiDrnfygytMweR0wDucFfHiPlo0RsZlmAvvJIHiCCwTxvr3cYxAEbNGB8PiUEUf2wKWry8DexVkoR9XnD+29gWbVUtJy1lgvtc6VTuTVbIE1R+6iYDIwqGiwMFiBjdP/q6O1h1U8o3ZbspIv0K41povcCt2Ik7ClmPx+k8N5Q9Dih6pUzb+qlXlaH5AcWJB847feX+Gg7VAbMgJQObRZ5Bqw18mFfBfJ1JAmVnjlY7YnOS+oXr0CCJKtgMhAEEqF6nUSIex4e+Mqbj0Fss+eqPFiaEvAd6JS0rf7k3n2J6KrOn4Qjl4rmu0rpogxchHTUHa6RxuRWdMDrQgjtwqY7SmX+UUYf3aaam6hjezWSNgcAu2mJ+Bi7NFmCwwfMllZZiDBGikf0TXHcK+TipvHVHW6t3IGusWTf/yLyI0267unIvXxsVt4wk4OvzX8q+7WMAY6lcqQrqMjTjZ4pYaIXd5SbcYav0xYi1WWYB/UpSs3/4N/Gm2R6wy5nMs0vXEApjVEdLwh5T4DLE1lP2Xo7DRN00Bh15qQUreUrGtDjyg68B+1oMPSEnD8UcuwTYxcw6HYBKPy1GQCvYJECKRqKvu3Hd0QfMs1mWZyrWzggef5XXh5eEPFcnpEoh24Wd4TE1CIM4OxmEuycBi04RhMNuwz35/IuXZlveKH2BChksXpXDDGX15zockfAXd7/WhM/TNmH76kK6KhKh+eAKk3mLgxgWL2jEEJqPL5QyADDIzJPn3njVZTcxGqdGw0hVmNUexCfRj5+D7NgOLtvA+WySBwWDYQsHAE2gLtODtEE0PBKEbVpcYWWWAW97VXdEUdxn54cN+q6EY0Nrg== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: c223f1d4-58e6-4a8e-c7a2-08dc04594807 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 08:21:09.0192 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /6/Obhm7bl+ZbdgZ2WexIGDpYBX/oGlj9lbd26iKS2fjGecZsCuHjmNFQmHwI5xvOvHuZPflRILCMxR8Vu5JqbPosexAGBnhfwxaWrndQ7Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4693 X-Proofpoint-GUID: xJlya6tRiEuaqHac_14nIV_cE3McTKSe X-Proofpoint-ORIG-GUID: xJlya6tRiEuaqHac_14nIV_cE3McTKSe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_25,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 priorityscore=1501 mlxscore=0 bulkscore=0 impostorscore=0 adultscore=0 clxscore=1015 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312240066 From: Ovidiu Panait When testing sahara sha256 speed performance with tcrypt (mode=404) on imx53-qsrb board, multiple "Invalid numbers of src SG." errors are reported. This was traced to sahara_walk_and_recalc() resizing req->src and causing the subsequent dma_map_sg() call to fail. Now that the previous commit fixed sahara_sha_hw_links_create() to take into account the actual request size, rather than relying on sg->length values, the resize operation is no longer necessary. Therefore, remove sahara_walk_and_recalc() and simplify associated logic. Fixes: 5a2bb93f5992 ("crypto: sahara - add support for SHA1/256") Signed-off-by: Ovidiu Panait --- drivers/crypto/sahara.c | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index 321c11050457..f045591e8889 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -884,24 +884,6 @@ static int sahara_sha_hw_context_descriptor_create(struct sahara_dev *dev, return 0; } -static int sahara_walk_and_recalc(struct scatterlist *sg, unsigned int nbytes) -{ - if (!sg || !sg->length) - return nbytes; - - while (nbytes && sg) { - if (nbytes <= sg->length) { - sg->length = nbytes; - sg_mark_end(sg); - break; - } - nbytes -= sg->length; - sg = sg_next(sg); - } - - return nbytes; -} - static int sahara_sha_prepare_request(struct ahash_request *req) { struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); @@ -938,36 +920,20 @@ static int sahara_sha_prepare_request(struct ahash_request *req) hash_later, 0); } - /* nbytes should now be multiple of blocksize */ - req->nbytes = req->nbytes - hash_later; - - sahara_walk_and_recalc(req->src, req->nbytes); - + rctx->total = len - hash_later; /* have data from previous operation and current */ if (rctx->buf_cnt && req->nbytes) { sg_init_table(rctx->in_sg_chain, 2); sg_set_buf(rctx->in_sg_chain, rctx->rembuf, rctx->buf_cnt); - sg_chain(rctx->in_sg_chain, 2, req->src); - - rctx->total = req->nbytes + rctx->buf_cnt; rctx->in_sg = rctx->in_sg_chain; - - req->src = rctx->in_sg_chain; /* only data from previous operation */ } else if (rctx->buf_cnt) { - if (req->src) - rctx->in_sg = req->src; - else - rctx->in_sg = rctx->in_sg_chain; - /* buf was copied into rembuf above */ + rctx->in_sg = rctx->in_sg_chain; sg_init_one(rctx->in_sg, rctx->rembuf, rctx->buf_cnt); - rctx->total = rctx->buf_cnt; /* no data from previous operation */ } else { rctx->in_sg = req->src; - rctx->total = req->nbytes; - req->src = rctx->in_sg; } /* on next call, we only have the remaining data in the buffer */ From patchwork Sun Dec 24 08:21:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 13504200 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 274CF23AA for ; Sun, 24 Dec 2023 08:21:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="fhk4pcuC" Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BO8B60q023677; Sun, 24 Dec 2023 00:21:13 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=B67l/lV7jGP0Iommy52sa0YXaMoLBhWnEK88lamRTBA=; b= fhk4pcuCRQw7Wb6d4WarfBq8qJKpVLVFJHRwqX5E+T6k7JNMC5HlowXe5RhQURvZ 4VMrX+VumphYHAONFE9s7a/p8qgWZ/kE44h1K6/cKdDicGICQzDCsusZoH6Iqp12 r/kupuxPuIDsZHxohZZhZuEXPElw4CMngQlTFkRpZ9hUawZzC3rA7Dni2fXiAgTL KjvHQLOBlABKSR45alg/z8RpHS593T2zQSEvPOXajYvFaro0WCsq4/6ew0H83tkx a+oSnX42itLve9QNxRJmTfaaFNsvXEiGMJrCMnWzIWo3l/GAM095xFujx3oc1Qv3 9et+l0hKVaKLprilybDi8g== Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3v5yxm0f8w-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 24 Dec 2023 00:21:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c08WKLoNfrayqNnb6RJJFAFWi1d21nMMUVJdddFoQufAPQMM0m/OKhhAqAcFX5kLWpCzNFWG/de12KRxr4QiGm2GZP1afeMcwUuCw6vjhACPlhzLnpObyd+VhUsKZssArYX1kOIanY4RyrOrwcHWsELxMjryNYs+yAELJDJf53likIfYdgYfHotFBwlh/+VZ9rZa8zaTu9omAlC/kfe4v9z2SmqBNL72aJwW8hA0lcRI9RMwfFBKUKDyB3gsPz7WsRizq+dHspLO4SoDS5Z46hvpiXJmt40xToaPNIg/BxR1yUJc56CXnYWv2DlttGR65i35qn5LeeNZb015PRR8Ww== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=B67l/lV7jGP0Iommy52sa0YXaMoLBhWnEK88lamRTBA=; b=J5/4M1U5vcnNiKzjLp2u8JVKwgPcr5bTyOBZvK8g8z3Dwyxwgf10Dop7sSF4obGE0XuURXQT52SKfLjbSay4+0O7YhzQUJbEsIOvUXByNxQ4DvHTZkTCFDz+f9Hrw44LXC5grPXKEbU60khn7P4y2eDsPv90gr9nZ9vAngOrP9Yw8y0lKQmLBiWUqxMMTJxUKGxsCdtPL6oPPxICwBReijUH2lGHwA3YFRN0OSmuXGBqxVrcUzNvkzLCPCMXbxA3jYIhxS6j04Fc88PtXSnC/8c81OQsg5zes5LaEd/WWlh9srl7/gh89YQTsjhqs3zFWGH+84hQBSI6EYnGNWBlFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) by MN2PR11MB4693.namprd11.prod.outlook.com (2603:10b6:208:261::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.24; Sun, 24 Dec 2023 08:21:10 +0000 Received: from DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e]) by DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e%3]) with mapi id 15.20.7113.023; Sun, 24 Dec 2023 08:21:10 +0000 From: ovidiu.panait@windriver.com To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, davem@davemloft.net, festevam@gmail.com Subject: [PATCH v2 07/14] crypto: sahara - clean up macro indentation Date: Sun, 24 Dec 2023 10:21:37 +0200 Message-Id: <20231224082144.3894863-8-ovidiu.panait@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224082144.3894863-1-ovidiu.panait@windriver.com> References: <20231224082144.3894863-1-ovidiu.panait@windriver.com> X-ClientProxiedBy: VI1PR09CA0094.eurprd09.prod.outlook.com (2603:10a6:803:78::17) To DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5327:EE_|MN2PR11MB4693:EE_ X-MS-Office365-Filtering-Correlation-Id: c1007c68-ee9b-4fef-f88e-08dc045948fa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F2WUzwHuRmSAsEpMxsvn90GWmKVxa4e0KIRz0ShjlfwNmtbb9DEtI22mbkZlZykQX54mGxBcKYZAEI5zt7LVgaq8nwceFUYSt0lAKpFTWR9o/l5hMyH+3tErfInHyrxw9J63Oui6KtgCEp1BRRzCwHICjWgwoGsTf9RwjuxWghjfGmEojG71eq2aVmX82ZzahyIAguSS4s18G8EcImImmu3YC/p+DQ1yEYcZ+K4ZxNfJ24ZOVlUa4bYdpO3Xo9pOJwWu+hvpFn9kj1l7j2ZbJB6DRaRqaoXNGz3P/sPD5xefwSdQ2zxuO4FdMMjqYVU/ERxJfcwqrOgk0NGIxLZ72gsI/SbqZygTKS0RoQS9MULqj8OCMW0n6nh7KK7/VOh0f6cS2vFyN8CCxmZmH8o5P/Uk7w2xZXGSLxx5yCDoZiDR+w1AqO+l3eKvk3hLAp6gCTHci4KNNkz7++UQrjvtlFc1qGJUpnDuMIPq5cGaDTZD7gZPWfgpZPDdhrxn6TUpjkLRrVk6Nxkw/+KY/UF32rSJVllam/0zYObl4RZQET/6YhvdauIIGcwHEibaRHwydZwUFtMhIKJIlk/mkz4KsADaWAMaZIA9UUiuzYnssniYsPfrAE8+Zifj08E0GHaX X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5327.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(346002)(376002)(136003)(39850400004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(6666004)(6486002)(478600001)(2906002)(8936002)(5660300002)(36756003)(52116002)(6916009)(66946007)(66476007)(66556008)(8676002)(38350700005)(9686003)(4326008)(6506007)(6512007)(316002)(83380400001)(86362001)(1076003)(26005)(2616005)(41300700001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PDHx0ok3heaBV1r8Tg+uQlsNAn+kzo3cGx4br2kaAqGtIIv0EAW3AVXmT46IU8FJqGvZCHp8JjlJIYZVg5GBPpVnOjEoU3W88zZt9169oU240sMVYLHFfkkW/OavmkBWDTyCN1mNV4LhUjpnUHuVARjpkwoWBcr/Oc+ZRJZjgfITtyuU5+XzeSMGzD09Sa4s85MuSsle1xeS8SCqLsjD3touQoD6EzEZZDO9IqWt0PTp7DDiEQbRsNaBOgEBNmW5FDtV7oJ/ZDd9UGqbNp+2vavKK/HP8WM7/9kWGUfBskA70z1R03zanjPjAx0BNRFvjHgXMEI38Cp74OKN+dKzlm/MFrU0g0kgjiyDspVwX0UZs4hwf+lrHHsnhO/C5Xv60RZLe9qiTAKwuRaFxacV0Bi6gS9XSlMh9pHpZR9IfKh/F6YS86DTERbb1G/MSa/SxLziGxlHNO1Of9Hm+7RPpmpSRn9+rdHtZG2OT4ErDt1b5MbVIY9sQowWyelk/vdVhXJwFX96zJ0qNsK8iu3/0LPe2qm+64tVg8szwhKFm8k2yRXOfuorHcub1yJ1oC0+YI8J7Lj7bi06PHg5LnVGRMGtgp3XNFx6uokNHv0/hhA2zF4dAoqFgxmao2+e/hw9R04/A9aBgvYRMqRIseVTSJcTUk52lKP3g04YSHnK7+Zxd9bEx4QkONRmjlj/olRkB+YdIi3i1eEvcccD6Oqj4OayJehfIkJoOKD2XBeepab+GJLQviqAZVfj19Axg50fBa7xQT68o3gWlu9cktPW8wntWCKv+g+yc1gcc3EzPQgdPN0Gg9SlBII3ZufMicDS7B7/DdybP35wlOcFg0kAqF6tPU+pUrNMCfbv64du1SvE8IXmCroL4Bo7xS9E03jXlJwzTnPlgXNwmSbFXRhAdwG67kqMp5Y7INoJjfHvaufsSyTKZXFAnvVm/kX9ddUCrPiZZthvDWcnx+F7sZOVSQ1dwgkIp/AEq08msqd4s8jtK9gXr2+8fQqm0CBQJDpYfHYVzBs+0stATmKUW0O8sRURyujxBD03+wtopGnM+98237K6k2wDjwU3lYu7MieKf0BoMXfxaJB0qJS5ck1nb7T7vxy+m1hxGK6++6rzr83PrueTYw5dHepuuIifWLGyIWIsd86mUKKjIZR80nQTepE5TmSnVnltyrM9f2TGAyBEm++2trvVLXwvo4wUM6s+8M4K8wkfPmhVkUQIQ/TIto/LpnsSQhahZnnpHsa90Zrid0mZ/X2424l/SvVjwVnxp5rEdGpS92ZOBBMH5ddymsuBgR9JlXPcbkmwyb14kVvoiWz8hi7mPNOJyy3oC9pRzmin8iMWp6fMejlXn88dL3EcLCF+iVD20EhH3r4uccyJBXRjMJU3uVvEo31rfk7P/QKnaE+E2ySM9X8w4wpCZu6NiRiY2ShqfMqJgQk1BmS/6jSbGoMBe+aTYacmlQ1yHEEoevMzano49dw8gbL65k1aWdlYn3eXDkgDMmIZ6zRERqlAVdoza2vAbd86suoCMCN0jdZTcvGHz9AL8qEHYbSNSf5l0jbiD25nTSXIfDHEDikM92KyJ+njpLp6pxnt7kwuRsWxsKP/2Og3R1lcBw== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1007c68-ee9b-4fef-f88e-08dc045948fa X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 08:21:10.4043 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8n4C8mA6gfpQmyXoYfd37IB6zeM+DTfcWX/RdfFKaeOvl2gCcMRFkgQEEOZlngPSVTLiJkpz2zADM3dXvPa5SUA59gr6/6dmTT9CikooFUA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4693 X-Proofpoint-GUID: -YPc1Ah8nJlKkOq5pwBMefAAgO24hcvr X-Proofpoint-ORIG-GUID: -YPc1Ah8nJlKkOq5pwBMefAAgO24hcvr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_25,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 priorityscore=1501 mlxscore=0 bulkscore=0 impostorscore=0 adultscore=0 clxscore=1015 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312240066 From: Ovidiu Panait Use the same indentation style for all macros. Signed-off-by: Ovidiu Panait --- drivers/crypto/sahara.c | 182 ++++++++++++++++++++-------------------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index f045591e8889..b024935f9d85 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -30,99 +30,99 @@ #include #include -#define SHA_BUFFER_LEN PAGE_SIZE -#define SAHARA_MAX_SHA_BLOCK_SIZE SHA256_BLOCK_SIZE - -#define SAHARA_NAME "sahara" -#define SAHARA_VERSION_3 3 -#define SAHARA_VERSION_4 4 -#define SAHARA_TIMEOUT_MS 1000 -#define SAHARA_MAX_HW_DESC 2 -#define SAHARA_MAX_HW_LINK 20 - -#define FLAGS_MODE_MASK 0x000f -#define FLAGS_ENCRYPT BIT(0) -#define FLAGS_CBC BIT(1) - -#define SAHARA_HDR_BASE 0x00800000 -#define SAHARA_HDR_SKHA_ALG_AES 0 -#define SAHARA_HDR_SKHA_OP_ENC (1 << 2) -#define SAHARA_HDR_SKHA_MODE_ECB (0 << 3) -#define SAHARA_HDR_SKHA_MODE_CBC (1 << 3) -#define SAHARA_HDR_FORM_DATA (5 << 16) -#define SAHARA_HDR_FORM_KEY (8 << 16) -#define SAHARA_HDR_LLO (1 << 24) -#define SAHARA_HDR_CHA_SKHA (1 << 28) -#define SAHARA_HDR_CHA_MDHA (2 << 28) -#define SAHARA_HDR_PARITY_BIT (1 << 31) - -#define SAHARA_HDR_MDHA_SET_MODE_MD_KEY 0x20880000 -#define SAHARA_HDR_MDHA_SET_MODE_HASH 0x208D0000 -#define SAHARA_HDR_MDHA_HASH 0xA0850000 -#define SAHARA_HDR_MDHA_STORE_DIGEST 0x20820000 -#define SAHARA_HDR_MDHA_ALG_SHA1 0 -#define SAHARA_HDR_MDHA_ALG_MD5 1 -#define SAHARA_HDR_MDHA_ALG_SHA256 2 -#define SAHARA_HDR_MDHA_ALG_SHA224 3 -#define SAHARA_HDR_MDHA_PDATA (1 << 2) -#define SAHARA_HDR_MDHA_HMAC (1 << 3) -#define SAHARA_HDR_MDHA_INIT (1 << 5) -#define SAHARA_HDR_MDHA_IPAD (1 << 6) -#define SAHARA_HDR_MDHA_OPAD (1 << 7) -#define SAHARA_HDR_MDHA_SWAP (1 << 8) -#define SAHARA_HDR_MDHA_MAC_FULL (1 << 9) -#define SAHARA_HDR_MDHA_SSL (1 << 10) +#define SHA_BUFFER_LEN PAGE_SIZE +#define SAHARA_MAX_SHA_BLOCK_SIZE SHA256_BLOCK_SIZE + +#define SAHARA_NAME "sahara" +#define SAHARA_VERSION_3 3 +#define SAHARA_VERSION_4 4 +#define SAHARA_TIMEOUT_MS 1000 +#define SAHARA_MAX_HW_DESC 2 +#define SAHARA_MAX_HW_LINK 20 + +#define FLAGS_MODE_MASK 0x000f +#define FLAGS_ENCRYPT BIT(0) +#define FLAGS_CBC BIT(1) + +#define SAHARA_HDR_BASE 0x00800000 +#define SAHARA_HDR_SKHA_ALG_AES 0 +#define SAHARA_HDR_SKHA_OP_ENC (1 << 2) +#define SAHARA_HDR_SKHA_MODE_ECB (0 << 3) +#define SAHARA_HDR_SKHA_MODE_CBC (1 << 3) +#define SAHARA_HDR_FORM_DATA (5 << 16) +#define SAHARA_HDR_FORM_KEY (8 << 16) +#define SAHARA_HDR_LLO (1 << 24) +#define SAHARA_HDR_CHA_SKHA (1 << 28) +#define SAHARA_HDR_CHA_MDHA (2 << 28) +#define SAHARA_HDR_PARITY_BIT (1 << 31) + +#define SAHARA_HDR_MDHA_SET_MODE_MD_KEY 0x20880000 +#define SAHARA_HDR_MDHA_SET_MODE_HASH 0x208D0000 +#define SAHARA_HDR_MDHA_HASH 0xA0850000 +#define SAHARA_HDR_MDHA_STORE_DIGEST 0x20820000 +#define SAHARA_HDR_MDHA_ALG_SHA1 0 +#define SAHARA_HDR_MDHA_ALG_MD5 1 +#define SAHARA_HDR_MDHA_ALG_SHA256 2 +#define SAHARA_HDR_MDHA_ALG_SHA224 3 +#define SAHARA_HDR_MDHA_PDATA (1 << 2) +#define SAHARA_HDR_MDHA_HMAC (1 << 3) +#define SAHARA_HDR_MDHA_INIT (1 << 5) +#define SAHARA_HDR_MDHA_IPAD (1 << 6) +#define SAHARA_HDR_MDHA_OPAD (1 << 7) +#define SAHARA_HDR_MDHA_SWAP (1 << 8) +#define SAHARA_HDR_MDHA_MAC_FULL (1 << 9) +#define SAHARA_HDR_MDHA_SSL (1 << 10) /* SAHARA can only process one request at a time */ -#define SAHARA_QUEUE_LENGTH 1 - -#define SAHARA_REG_VERSION 0x00 -#define SAHARA_REG_DAR 0x04 -#define SAHARA_REG_CONTROL 0x08 -#define SAHARA_CONTROL_SET_THROTTLE(x) (((x) & 0xff) << 24) -#define SAHARA_CONTROL_SET_MAXBURST(x) (((x) & 0xff) << 16) -#define SAHARA_CONTROL_RNG_AUTORSD (1 << 7) -#define SAHARA_CONTROL_ENABLE_INT (1 << 4) -#define SAHARA_REG_CMD 0x0C -#define SAHARA_CMD_RESET (1 << 0) -#define SAHARA_CMD_CLEAR_INT (1 << 8) -#define SAHARA_CMD_CLEAR_ERR (1 << 9) -#define SAHARA_CMD_SINGLE_STEP (1 << 10) -#define SAHARA_CMD_MODE_BATCH (1 << 16) -#define SAHARA_CMD_MODE_DEBUG (1 << 18) -#define SAHARA_REG_STATUS 0x10 -#define SAHARA_STATUS_GET_STATE(x) ((x) & 0x7) -#define SAHARA_STATE_IDLE 0 -#define SAHARA_STATE_BUSY 1 -#define SAHARA_STATE_ERR 2 -#define SAHARA_STATE_FAULT 3 -#define SAHARA_STATE_COMPLETE 4 -#define SAHARA_STATE_COMP_FLAG (1 << 2) -#define SAHARA_STATUS_DAR_FULL (1 << 3) -#define SAHARA_STATUS_ERROR (1 << 4) -#define SAHARA_STATUS_SECURE (1 << 5) -#define SAHARA_STATUS_FAIL (1 << 6) -#define SAHARA_STATUS_INIT (1 << 7) -#define SAHARA_STATUS_RNG_RESEED (1 << 8) -#define SAHARA_STATUS_ACTIVE_RNG (1 << 9) -#define SAHARA_STATUS_ACTIVE_MDHA (1 << 10) -#define SAHARA_STATUS_ACTIVE_SKHA (1 << 11) -#define SAHARA_STATUS_MODE_BATCH (1 << 16) -#define SAHARA_STATUS_MODE_DEDICATED (1 << 17) -#define SAHARA_STATUS_MODE_DEBUG (1 << 18) -#define SAHARA_STATUS_GET_ISTATE(x) (((x) >> 24) & 0xff) -#define SAHARA_REG_ERRSTATUS 0x14 -#define SAHARA_ERRSTATUS_GET_SOURCE(x) ((x) & 0xf) -#define SAHARA_ERRSOURCE_CHA 14 -#define SAHARA_ERRSOURCE_DMA 15 -#define SAHARA_ERRSTATUS_DMA_DIR (1 << 8) -#define SAHARA_ERRSTATUS_GET_DMASZ(x)(((x) >> 9) & 0x3) -#define SAHARA_ERRSTATUS_GET_DMASRC(x) (((x) >> 13) & 0x7) -#define SAHARA_ERRSTATUS_GET_CHASRC(x) (((x) >> 16) & 0xfff) -#define SAHARA_ERRSTATUS_GET_CHAERR(x) (((x) >> 28) & 0x3) -#define SAHARA_REG_FADDR 0x18 -#define SAHARA_REG_CDAR 0x1C -#define SAHARA_REG_IDAR 0x20 +#define SAHARA_QUEUE_LENGTH 1 + +#define SAHARA_REG_VERSION 0x00 +#define SAHARA_REG_DAR 0x04 +#define SAHARA_REG_CONTROL 0x08 +#define SAHARA_CONTROL_SET_THROTTLE(x) (((x) & 0xff) << 24) +#define SAHARA_CONTROL_SET_MAXBURST(x) (((x) & 0xff) << 16) +#define SAHARA_CONTROL_RNG_AUTORSD (1 << 7) +#define SAHARA_CONTROL_ENABLE_INT (1 << 4) +#define SAHARA_REG_CMD 0x0C +#define SAHARA_CMD_RESET (1 << 0) +#define SAHARA_CMD_CLEAR_INT (1 << 8) +#define SAHARA_CMD_CLEAR_ERR (1 << 9) +#define SAHARA_CMD_SINGLE_STEP (1 << 10) +#define SAHARA_CMD_MODE_BATCH (1 << 16) +#define SAHARA_CMD_MODE_DEBUG (1 << 18) +#define SAHARA_REG_STATUS 0x10 +#define SAHARA_STATUS_GET_STATE(x) ((x) & 0x7) +#define SAHARA_STATE_IDLE 0 +#define SAHARA_STATE_BUSY 1 +#define SAHARA_STATE_ERR 2 +#define SAHARA_STATE_FAULT 3 +#define SAHARA_STATE_COMPLETE 4 +#define SAHARA_STATE_COMP_FLAG (1 << 2) +#define SAHARA_STATUS_DAR_FULL (1 << 3) +#define SAHARA_STATUS_ERROR (1 << 4) +#define SAHARA_STATUS_SECURE (1 << 5) +#define SAHARA_STATUS_FAIL (1 << 6) +#define SAHARA_STATUS_INIT (1 << 7) +#define SAHARA_STATUS_RNG_RESEED (1 << 8) +#define SAHARA_STATUS_ACTIVE_RNG (1 << 9) +#define SAHARA_STATUS_ACTIVE_MDHA (1 << 10) +#define SAHARA_STATUS_ACTIVE_SKHA (1 << 11) +#define SAHARA_STATUS_MODE_BATCH (1 << 16) +#define SAHARA_STATUS_MODE_DEDICATED (1 << 17) +#define SAHARA_STATUS_MODE_DEBUG (1 << 18) +#define SAHARA_STATUS_GET_ISTATE(x) (((x) >> 24) & 0xff) +#define SAHARA_REG_ERRSTATUS 0x14 +#define SAHARA_ERRSTATUS_GET_SOURCE(x) ((x) & 0xf) +#define SAHARA_ERRSOURCE_CHA 14 +#define SAHARA_ERRSOURCE_DMA 15 +#define SAHARA_ERRSTATUS_DMA_DIR (1 << 8) +#define SAHARA_ERRSTATUS_GET_DMASZ(x) (((x) >> 9) & 0x3) +#define SAHARA_ERRSTATUS_GET_DMASRC(x) (((x) >> 13) & 0x7) +#define SAHARA_ERRSTATUS_GET_CHASRC(x) (((x) >> 16) & 0xfff) +#define SAHARA_ERRSTATUS_GET_CHAERR(x) (((x) >> 28) & 0x3) +#define SAHARA_REG_FADDR 0x18 +#define SAHARA_REG_CDAR 0x1C +#define SAHARA_REG_IDAR 0x20 struct sahara_hw_desc { u32 hdr; From patchwork Sun Dec 24 08:21:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 13504201 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21D8E23D3 for ; Sun, 24 Dec 2023 08:21:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="diE3S9f+" Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BO8B60r023677; Sun, 24 Dec 2023 00:21:13 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=Qd5FwCSRW9I4sGkPPEAWfQlItC9oCmS/YZeNwV/FZzA=; b= diE3S9f+SEFTrYmMQT7NbLuyJ6bLqbkraUvIYAJlM6Lmjs8DS83dPu/h+URp9uZJ kH+zv+fiEOEY4p/T6vx1jTgSSZy46pumoXioJLCEgSi+LvDD578aYSgyC755baGJ ugLodfqswzhsHomtJEBC1dmZgDiLYgiHRtenxSpY3p7Z8ARVQQBqvKIh8IQh+Hyy pYDYf4hqha7jfU8xTJWLlhlVZ1fxCVLmRwynQphVOxvRBKRFWeIIGkQV4houORt7 3oXFf7hO7Q1AgT0J83QYkFOVIOz5rSEoyBWQuUAalrSa43fac5oXXebndYjnlHji mWjKCqMdC0y4MG02qIJG8w== Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3v5yxm0f8w-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 24 Dec 2023 00:21:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mUzS1z0vTMgLxgiOMcWip332cA8fYSgfo42/BcaeplJTWOyfZ8FAYvir7/RwGTU8QBdwQ6Q47+9tURrwcdPGuoQpORSEnmlbmOdmSlEWf6K0nIU7eAVIhPisOZgKtTnxIp3Om1lWQadhTzF3dmg3NpgmWPCCqKa4PHGxT0fpfiFYkPscyW+LC4v7XKfPnms1tvP2IIZzDQWABNWzgpk/XwJ1iX/OKVxt1CkHWfN5foU1R3e6J6QRzvIi/eRhMJvRECouGnfxR4aKvp859NzCP3WdexkhvuSHH5+qqNCgp4WUM7oD+/ltTTzclRP2c9OyWyFglhW5tV1FwkQ1JGnLQA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Qd5FwCSRW9I4sGkPPEAWfQlItC9oCmS/YZeNwV/FZzA=; b=ck7/79ZXfGTTtRL1U0YV2n9GCPiKAPEIAcpnMHGnFNnIf7Yyg5G2Eb1Zd8vvda5MrxOPzFGgkrp+uUw/oD36LO6wCHjoU1oOARCIatBkFVvNyG7FUQ8A2Mg65WeVQxIrcpDMo4KSy2bjkO4I0EmndPhRcf4vy/4B+utXVx8U5XhKyujRzlmecGLUEjI5kzwzE3P/V79f9RWdWB6fU7VHN/qjP+7L+fmXUcreeGj1EpWyHd8icYTmzD0XhwZkgeq8ps1gTRVjbLd4ZnbSr2ssC+cmbrCiiFgXadjvZMvWufMZ5mEnmEHW/cIkOWtWR8ubCQIOXDrrtWRYaaydDpj6JA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) by MN2PR11MB4693.namprd11.prod.outlook.com (2603:10b6:208:261::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.24; Sun, 24 Dec 2023 08:21:11 +0000 Received: from DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e]) by DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e%3]) with mapi id 15.20.7113.023; Sun, 24 Dec 2023 08:21:11 +0000 From: ovidiu.panait@windriver.com To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, davem@davemloft.net, festevam@gmail.com Subject: [PATCH v2 08/14] crypto: sahara - use BIT() macro Date: Sun, 24 Dec 2023 10:21:38 +0200 Message-Id: <20231224082144.3894863-9-ovidiu.panait@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224082144.3894863-1-ovidiu.panait@windriver.com> References: <20231224082144.3894863-1-ovidiu.panait@windriver.com> X-ClientProxiedBy: VI1PR09CA0094.eurprd09.prod.outlook.com (2603:10a6:803:78::17) To DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5327:EE_|MN2PR11MB4693:EE_ X-MS-Office365-Filtering-Correlation-Id: c1e03894-59da-4c84-c85a-08dc045949cc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yXEt9R811N6Z+Czh4j5GC/Xz1Arvf2wCEQffvFnjU4Hu2GVSYpONZnI74DKw4KTkE+SsqwfCLNNR40UOrNljo2sMoRnEJ1PtJB55UOEJuknK7T5DgchlovBxTvM6Lll88npmZJhxhpVh/SVsqIJMTdm/cl351Pw2YltDl+bEn1VkFBIrCiKcVLIPFxET8m4KqJPpL2k70vAbuPWx5P+Mwp5FLk2IiIQwQ+dYWurk4ZFXRvK+dfLUn/g1IuJfz9029eic72asCSRn8pGLpqfQ4LFKALUxnJ3tlQ+7hECwRfDWpk+48UckGiJ9yAT/whyB5Fcj4eVd1bkZGqEDVERGh0h1nm9e2t3Njq4NbRI1gup8+8O8egExz+l/ZP4S9v0IFNxBJ4SGSqKR86P1Fy4iAy+v/Ph3WtETw7MT4wr3VqbOuK6PizelHmJ0Vva9tT7m3ZtxxBmQkkMrTWZ1P4K93kety7KFg6VeacBFlvwhFCP9c+ZC4qVWsB66641s2NZ88qBZjXLsQyWPATPNqEjwozKYkzSCpejKZmu2+/0FVmPq42X5SrF/Pr/3fex0QSrbHvqPdXCyrvDwi5CmDLHEBTcRAJsD4t8HXO9hedC5EmlnSmQjj7+IVsGwYVxK+uxS X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5327.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(346002)(376002)(136003)(39850400004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(6666004)(6486002)(478600001)(2906002)(8936002)(5660300002)(36756003)(52116002)(6916009)(66946007)(66476007)(66556008)(8676002)(38350700005)(9686003)(4326008)(6506007)(6512007)(316002)(83380400001)(86362001)(1076003)(26005)(2616005)(41300700001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: x2E12EmDIvHwS7mgiEqhKNzSIueg1UnrMKbDmrUAZgKb1q5wZ96OZ8kY2Cxxv1HO0oTUCosCfc6jlKQnJuJs053HhPYeSDSpjtja3/20j9i7VGKSdPvijaz7NOrPUYjQeWq3z7fNjJV5o2xVMY7iZz7FW88llDqHNR1rP39EAvK6qX+JNuOdPZ0SUpUNYBehL1wYjhDreRD3yM6DpZQ4FI87H2A5FNyMdkW5T9WakwHl9VJUzrTl4G2SpDvqpxjfRGKRdHwdhvrW/Uz0OFCxyAa2kUfeDCYWo16+dkvcZIQhV8w3tJpyxk2ShSew1ilwzpUh5+isa4b6ncCRyK2EAZpmVwX9sVbp45pkBwPu5hQsxxCa8X985+IMQanP9xE9kD8zvr0SnhnP6DGGg7wES8IZ30iZeYIH7NIXdadsF/KGSuPirUcy5TmWs39cc6dififgollnfHQ6fpkCf+0dovSe++i3yhHFprK8qbNjWp2qiuJw2Iq+/WrvBAMUNSizdtbDWZpkaU2GJpVfoaNq08YJSzbpm0BuAz6hyQmIkKbi3AMH3He0u4zLYGPPbAdenk4x7tqHG0j+lsttjkEzdgm0HwGcnJU3tjsYM6Xbc1eF3nE0af4CN0lBeWO3WxUlTf7D2Cd35m2qOU3WjSYINAagReiOItw0j+UoYQaMSlE3XhpcGH2ReHWLHzMVgmBhHqxzHOhabRo/nKSK25uwS84uUsEPZFrLvKDH1b9rRigF9TYnSzsWedBevK1+SziruQ365JiXLzKCFu4y4WKgVP2sZSoQSK3kJgWYhbUymXGp3YirqkgqoENzC6J2FCVWucZfd04FvGFkZMqGWCyEsZBhkWHmYB+LnJcfRz69+FlHZlKsCyfhDmRwkYqBx1Wxfn7AIxaUBiqL8xgo7oETS3PX5gImUpqCQHb/qkjEhVUHHfMQp6id7lWK7J68Bg31cFONtYX9tMpIO2M+XU22UHQe6Icc1xBWp489By3OXqpI7LpgCDcpRYL3viG8c/OBTJWnn8NghExlsQ0I9fNiMUiBn8zPcQkcU9k3qTfM0C3c7Sdm+9S/0tXMueLct3bmg9UfYX7vU9u+GVuC9H7GryR4B/trqHZLQ61ooRxr5MlksLlqj9BLbZVwhsq8ztr1ukxOFOb1YjtpQiC0/T30FkxP17dNA5Qv8/Ais4y3g5IXBptluAdk944lSqNwe/Rueq9T5mRISclE0UH4cuYH5JQHx+JY8LX21Q2TPwWjKpCSvXlW1CsVNQ9YuxcLFLVclF12kTFT/z3BNiidwptmBy6ddWQaoqVifaTWRG5Pyuvxsw1r28gTR3JTbJwNqfhKkPNsXsNmbrRfpd/wySVXsWseEzSgu7SloT4qC/hXCAs1M7sJYoIFi5xE9tS08MIYLNjxcQQjY07+ZeBvCysX2KoezX6D2FMUlf0i1wFLun8y4jBRja1jqGR/tEvlQp2kG5rUngpvOYP6rSyAgt1F2iz+z0fz3/TLZl5uWsJpn/OP8OLlX2vN5jfVXgM+DNURvEM6sayy83LzGC6bvCrb3tiDhjII0tv6eVFPDNjPRBavZPBm2J56fTI21NywAX6AJ73KCg7lfTNX8bvw8ljcng== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1e03894-59da-4c84-c85a-08dc045949cc X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 08:21:11.8051 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FWdK8SAnWn5fEHD90feq6PNbDWvgRB80QfVKyqkNYl+4sBOJrn/dcjqhpEY78eBKEMkOKdkOnOaMRXRrMr4O/i2hIJ6gJw9osD2TacJjuU8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4693 X-Proofpoint-GUID: YWB--ADfV95FVeVTIYIxjN4AV6VdRAop X-Proofpoint-ORIG-GUID: YWB--ADfV95FVeVTIYIxjN4AV6VdRAop X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_25,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=913 priorityscore=1501 mlxscore=0 bulkscore=0 impostorscore=0 adultscore=0 clxscore=1015 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312240066 From: Ovidiu Panait Where applicable, use BIT() macro instead of shift operation to improve readability. No functional change. Signed-off-by: Ovidiu Panait --- drivers/crypto/sahara.c | 76 ++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index b024935f9d85..ba7d3a917101 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -46,15 +46,15 @@ #define SAHARA_HDR_BASE 0x00800000 #define SAHARA_HDR_SKHA_ALG_AES 0 -#define SAHARA_HDR_SKHA_OP_ENC (1 << 2) -#define SAHARA_HDR_SKHA_MODE_ECB (0 << 3) -#define SAHARA_HDR_SKHA_MODE_CBC (1 << 3) +#define SAHARA_HDR_SKHA_MODE_ECB 0 +#define SAHARA_HDR_SKHA_OP_ENC BIT(2) +#define SAHARA_HDR_SKHA_MODE_CBC BIT(3) #define SAHARA_HDR_FORM_DATA (5 << 16) -#define SAHARA_HDR_FORM_KEY (8 << 16) -#define SAHARA_HDR_LLO (1 << 24) -#define SAHARA_HDR_CHA_SKHA (1 << 28) -#define SAHARA_HDR_CHA_MDHA (2 << 28) -#define SAHARA_HDR_PARITY_BIT (1 << 31) +#define SAHARA_HDR_FORM_KEY BIT(19) +#define SAHARA_HDR_LLO BIT(24) +#define SAHARA_HDR_CHA_SKHA BIT(28) +#define SAHARA_HDR_CHA_MDHA BIT(29) +#define SAHARA_HDR_PARITY_BIT BIT(31) #define SAHARA_HDR_MDHA_SET_MODE_MD_KEY 0x20880000 #define SAHARA_HDR_MDHA_SET_MODE_HASH 0x208D0000 @@ -64,14 +64,14 @@ #define SAHARA_HDR_MDHA_ALG_MD5 1 #define SAHARA_HDR_MDHA_ALG_SHA256 2 #define SAHARA_HDR_MDHA_ALG_SHA224 3 -#define SAHARA_HDR_MDHA_PDATA (1 << 2) -#define SAHARA_HDR_MDHA_HMAC (1 << 3) -#define SAHARA_HDR_MDHA_INIT (1 << 5) -#define SAHARA_HDR_MDHA_IPAD (1 << 6) -#define SAHARA_HDR_MDHA_OPAD (1 << 7) -#define SAHARA_HDR_MDHA_SWAP (1 << 8) -#define SAHARA_HDR_MDHA_MAC_FULL (1 << 9) -#define SAHARA_HDR_MDHA_SSL (1 << 10) +#define SAHARA_HDR_MDHA_PDATA BIT(2) +#define SAHARA_HDR_MDHA_HMAC BIT(3) +#define SAHARA_HDR_MDHA_INIT BIT(5) +#define SAHARA_HDR_MDHA_IPAD BIT(6) +#define SAHARA_HDR_MDHA_OPAD BIT(7) +#define SAHARA_HDR_MDHA_SWAP BIT(8) +#define SAHARA_HDR_MDHA_MAC_FULL BIT(9) +#define SAHARA_HDR_MDHA_SSL BIT(10) /* SAHARA can only process one request at a time */ #define SAHARA_QUEUE_LENGTH 1 @@ -81,15 +81,15 @@ #define SAHARA_REG_CONTROL 0x08 #define SAHARA_CONTROL_SET_THROTTLE(x) (((x) & 0xff) << 24) #define SAHARA_CONTROL_SET_MAXBURST(x) (((x) & 0xff) << 16) -#define SAHARA_CONTROL_RNG_AUTORSD (1 << 7) -#define SAHARA_CONTROL_ENABLE_INT (1 << 4) +#define SAHARA_CONTROL_RNG_AUTORSD BIT(7) +#define SAHARA_CONTROL_ENABLE_INT BIT(4) #define SAHARA_REG_CMD 0x0C -#define SAHARA_CMD_RESET (1 << 0) -#define SAHARA_CMD_CLEAR_INT (1 << 8) -#define SAHARA_CMD_CLEAR_ERR (1 << 9) -#define SAHARA_CMD_SINGLE_STEP (1 << 10) -#define SAHARA_CMD_MODE_BATCH (1 << 16) -#define SAHARA_CMD_MODE_DEBUG (1 << 18) +#define SAHARA_CMD_RESET BIT(0) +#define SAHARA_CMD_CLEAR_INT BIT(8) +#define SAHARA_CMD_CLEAR_ERR BIT(9) +#define SAHARA_CMD_SINGLE_STEP BIT(10) +#define SAHARA_CMD_MODE_BATCH BIT(16) +#define SAHARA_CMD_MODE_DEBUG BIT(18) #define SAHARA_REG_STATUS 0x10 #define SAHARA_STATUS_GET_STATE(x) ((x) & 0x7) #define SAHARA_STATE_IDLE 0 @@ -97,25 +97,25 @@ #define SAHARA_STATE_ERR 2 #define SAHARA_STATE_FAULT 3 #define SAHARA_STATE_COMPLETE 4 -#define SAHARA_STATE_COMP_FLAG (1 << 2) -#define SAHARA_STATUS_DAR_FULL (1 << 3) -#define SAHARA_STATUS_ERROR (1 << 4) -#define SAHARA_STATUS_SECURE (1 << 5) -#define SAHARA_STATUS_FAIL (1 << 6) -#define SAHARA_STATUS_INIT (1 << 7) -#define SAHARA_STATUS_RNG_RESEED (1 << 8) -#define SAHARA_STATUS_ACTIVE_RNG (1 << 9) -#define SAHARA_STATUS_ACTIVE_MDHA (1 << 10) -#define SAHARA_STATUS_ACTIVE_SKHA (1 << 11) -#define SAHARA_STATUS_MODE_BATCH (1 << 16) -#define SAHARA_STATUS_MODE_DEDICATED (1 << 17) -#define SAHARA_STATUS_MODE_DEBUG (1 << 18) +#define SAHARA_STATE_COMP_FLAG BIT(2) +#define SAHARA_STATUS_DAR_FULL BIT(3) +#define SAHARA_STATUS_ERROR BIT(4) +#define SAHARA_STATUS_SECURE BIT(5) +#define SAHARA_STATUS_FAIL BIT(6) +#define SAHARA_STATUS_INIT BIT(7) +#define SAHARA_STATUS_RNG_RESEED BIT(8) +#define SAHARA_STATUS_ACTIVE_RNG BIT(9) +#define SAHARA_STATUS_ACTIVE_MDHA BIT(10) +#define SAHARA_STATUS_ACTIVE_SKHA BIT(11) +#define SAHARA_STATUS_MODE_BATCH BIT(16) +#define SAHARA_STATUS_MODE_DEDICATED BIT(17) +#define SAHARA_STATUS_MODE_DEBUG BIT(18) #define SAHARA_STATUS_GET_ISTATE(x) (((x) >> 24) & 0xff) #define SAHARA_REG_ERRSTATUS 0x14 #define SAHARA_ERRSTATUS_GET_SOURCE(x) ((x) & 0xf) #define SAHARA_ERRSOURCE_CHA 14 #define SAHARA_ERRSOURCE_DMA 15 -#define SAHARA_ERRSTATUS_DMA_DIR (1 << 8) +#define SAHARA_ERRSTATUS_DMA_DIR BIT(8) #define SAHARA_ERRSTATUS_GET_DMASZ(x) (((x) >> 9) & 0x3) #define SAHARA_ERRSTATUS_GET_DMASRC(x) (((x) >> 13) & 0x7) #define SAHARA_ERRSTATUS_GET_CHASRC(x) (((x) >> 16) & 0xfff) From patchwork Sun Dec 24 08:21:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 13504202 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC1C63C10 for ; Sun, 24 Dec 2023 08:21:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="mqs9PNxd" Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BO81DaK029862; Sun, 24 Dec 2023 00:21:15 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=oTbs3cmFB6EKBlw3wpiAvBPHvntPaDTvCod9KAqMzz0=; b= mqs9PNxdE5+Kf/TamUyA3i78cbgxR6G/H3jQmbkFM61qf+09NRYe3ATUmvm/Wd/p RcZN9pY2hf9fHXaH2tbXlanDkc9EfQm64qP0bXeKv9ONj69IRsRkVmJ2xhUKpG24 WFbx58b2JTbEJolPY1ZEGSB+npybZU1Gd9MmXM/zfUH99g3sBYQVbX+aEB7sJI0P sw4mwhCRhF2bp8c2z0BngrtqaSPUT8ClA4ceHPZDKfXMD6k2nrTq57GPrGlx/g2V UUgIKKMgeioZlW7c1JdfdEeHUQjFQw4jA4lFtEhhpUtdsKDlVu9etv/jUQ5gfFj4 F/yBmlSYK+DhgmFO6TJJcw== Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3v5uq4gk8b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 24 Dec 2023 00:21:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z7OIMC81tW7uCdp8fXLBNFiaqO+IHB8gma5IkjAi0D7n1yUFOMTsOzWLqphHsHjAn0ni1RzrW/MMTO8TMGMK8Iw+fe85NYMvjD9QXz1NV9/duAUbcyiDlacjm7JT1HUGjRkpjIJ7AAuN7DWfP/CEt5n8t+wjJ/BVdnSenVwFtf3GbzFEWRl06HoZ12MjsSqdu+K01vHVtgbOxmd7zz4O7bjuofkmoEtQvEA83CCLvs4eLrQMorzLWKxFcUi5BWBs+0bcgKZCanCtaNKOcvPVAUzqUzvshxfMfJbeZWM7x1G299b8fKcaZXgGB06vB3OvOiRJsc24okT4qOjExqbWFQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oTbs3cmFB6EKBlw3wpiAvBPHvntPaDTvCod9KAqMzz0=; b=c0k/TfOyEDPjb/mbFq85hH4B5PTsikurBpJgZ3zeVCIwuFUDtuiy8g1rrdVcd90jVXjwFbXI7wJjSvlWiRjTwwLE8ktOMNxswqjyUk37CVCdQFPCQzwvu8ueEWeu+x2uEkUO6vwuTVc1AIaOCGfmSlOoZZwcdHYV/xdWBM9JyULN3avBqw8q3ZZArccdBwtPqshBP8RMqCnI6KKGJ2StEKbwOxySdCeSbDCXGNiN88s/5SY+WX4tyeismn27G7TLMdv63jqnM3ymYFygGL1fMKzc3b9Uge8Sc5rYMoi0G7xt1KgphBH/7CxD8v7Q6jwwqG6qEEdLU81s40QxtWYRUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) by MN2PR11MB4693.namprd11.prod.outlook.com (2603:10b6:208:261::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.24; Sun, 24 Dec 2023 08:21:13 +0000 Received: from DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e]) by DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e%3]) with mapi id 15.20.7113.023; Sun, 24 Dec 2023 08:21:13 +0000 From: ovidiu.panait@windriver.com To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, davem@davemloft.net, festevam@gmail.com Subject: [PATCH v2 09/14] crypto: sahara - use devm_clk_get_enabled() Date: Sun, 24 Dec 2023 10:21:39 +0200 Message-Id: <20231224082144.3894863-10-ovidiu.panait@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224082144.3894863-1-ovidiu.panait@windriver.com> References: <20231224082144.3894863-1-ovidiu.panait@windriver.com> X-ClientProxiedBy: VI1PR09CA0094.eurprd09.prod.outlook.com (2603:10a6:803:78::17) To DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5327:EE_|MN2PR11MB4693:EE_ X-MS-Office365-Filtering-Correlation-Id: 1443a529-7efd-49a7-fa84-08dc04594aa0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wyuf4BPX7Bqvo6H0lADs3o3/aMTY6kpkLZ26gwncncExqCvahu9HM2171qYoMkZG5GLn9To4RqREiWH6GIR7m5n/uS7O7NRP82m6WIEChIXoWudfOekh89gQDr51Xq7RQiOPBXUnB3qa/dj2+obm3zgtckngOSd18ZC8/e2FSZVLa2SriTiLL0Kj1v1nJlU9H5zxotOU1/uHXXFvcZy1n1TCZIJEkBnhkJMg0PH/J7E3Fk1sox0mgVMoSop3nT3dPh1YvOB+SvY3q3ojqiC4XdyCU9IMvZ8w0QLLD08ydnV4wIkVskrTj6jpfHAE5+LF6aUPf5GJMMJaipsWufaJFDbMGk7+GU3ZkRqdAKkUJfsq22Mfbn/qBAHwuWyakTVbY8o08kiQhNW0aG/T/aU41Io80h9DAQMrItKFug6/xGoTO94+0YaLu1dFkPetwQdt+PIZYbA/aYPLU3R4SMfNL5cMG4dXZruVJrvOq15N71uQugtyWpcvgEUPkd8I0FT3OuUFSm1ieifwxwayujemw3m2ja2VkZfAkVxBWzgeaARUrf3tCoCz7ieZg5FRuNh03C2OZ43mtvIBimb7J/LxHIljQSyCG2IengAfPJmUl3Iyz+aO+weasqhDn3GArm1R X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5327.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(346002)(376002)(136003)(39850400004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(6666004)(6486002)(478600001)(2906002)(8936002)(5660300002)(36756003)(52116002)(6916009)(66946007)(66476007)(66556008)(8676002)(38350700005)(9686003)(4326008)(6506007)(6512007)(316002)(83380400001)(86362001)(1076003)(26005)(2616005)(41300700001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JqhSB6uaCcNMU8bu89tppxpy69TzwjmrgVicBERvBOj5xbVHu0Q1MWO4SYQiZDtwbOe1ceS1Z9xPvbHeUpxoY2e+hrxltTPAbFIH1BfpAj2c1Kn1kmDzyxdi6NXjreOu2t0Qk+0hjNjFSY55P1M1x0jvv4wUqiQdtoHrXAWhGs7JEIhFXr19MKZsiHWEqiMh82EhKuYvpZZylrn1JSK5UunsKwed1bErArG7bBex5w14fw+KjteP7FMWI4AoWO2MQS8v4XKBXSlvT97llz6wX4EGESluQqJjZ80UZGaeewpLYI9lsQA+atRoIBQwhoLgqZ2sfbR80udTH8CUjrE/6t9NFr3WFfNJ42SeASnoKdfuf8X0gNaPLJuahILpgWU3LpRXl2UUGYQ7QYW73GNjOad5lhOD8ruenqSOLEnhJESAAQ7dd4c8MMN7H+sYs++WEQc/wTZX0q9mdgqMI0DglDZw35Qi6lZ+GTXma9+jV0qw2JwdgSH1e139smZOky2VSmT6wNPSeBS2U1R+y8mr31jjOe+VKuLDuFd9GFxLQOrqW344bQ4d1a2O9WM8RK6GyfbGCJV1bqJm/VTDjh1ZnHvrHyp9jpIAZkBYHKgiZEIEde3Qy4nc5kXZ3tEV9dCvU16E4PcHBDVpgCzMyXUqE6EhNG2KkKDqJHt0II96x2t+opZLhNlz7Qx7d+NOyaiQGWZi0h6YuBwuFSHtAnSLXxDBoE6+F9sIekoKfD+4wPtXpSRb8fTWJsk1PQ+LKChsIs6xa9TyhGZi6a0fROyLftQcMjIF2Na4AZ2qpZc4v5Tn8S7N164HYGP3s/qbpf8XnhSIFHwclVC0578gH3NM+V3rEVbDifF4vHS/k77Z8Re0r0mG92yHOOiMPdg7yXvgTtran6WymroYPMceCjsjRPxCiiCupJabIMLTF0Ci9Lt1mq07EPeL+4/Zy1QRs3W1DVK1/felZYIt6molMLoof95jSSFU+4F72cIzdCwsDUGHhCCmBmM98uoP4gJJ6AEXby7Rr3TjLxsZBGWxoZflICWaeRjGXAL+4uhbtjyPTjw/bfEwAX/1AqmIDGhP7mqMKKueAZVN9Eef72hy/qqEuMd+N+K4wJf5utrli5srr7R8ZrXmefuDMe7Yaz4X5IX36imqzHKVT1DsAJlunMcMGkGh90ct1dhN1RtSuXy5T4BR9NPRV/dTYWQsJ5qwGWOrqnoGEX4Q97no766/3PqXys8G5FV6DJmnmbF7LOTYjpXaex+CZckTXIRI8r4e+62CG4ZUykt+MK6BdryM+lCUbS2TOp3V8HGR92ahRIStni8JzYjNIdv1Gjleu2vgKevot5J8qx9AivDy9G1VbL0DsJYgOBA4+Z5CPrQ1C99W5WifOOxMOgoc4/YJpxvkYjA85Tt+rYpma36AmaAGBa0QfHRSTwfCMz9I8Jdm5ozGzxnh9KfTTQu+2DdqzkkNAINCORxPrTyvGAhX7grH/60D7koC47xHadT9K/xlIkixxSzytaWk7fOlkDlzB5nU0ZSurP7TJcnHq8MlvRUFYFALrSHuDcLI/XDTfrFEfW0QOrnCi/v1qOJ4TmKQbGVEJdlx4c6nV6htvYQR9JC7dEVtqg== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1443a529-7efd-49a7-fa84-08dc04594aa0 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 08:21:13.1911 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0EhiLJ8ZpnOPR/RiRxX03PK0Jmh8Q9WT8H3mSv9pn6V5eZWdjPyMoMhqZhFvOlGzT5sB8R1bEZ5haGGSi4hhM8OfYAD3cPP9sXtbuepNHzA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4693 X-Proofpoint-GUID: yeqOHGeonpJs1gb4mOigtsErFJpsZLZc X-Proofpoint-ORIG-GUID: yeqOHGeonpJs1gb4mOigtsErFJpsZLZc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_25,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 impostorscore=0 spamscore=0 bulkscore=0 malwarescore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 mlxlogscore=978 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312240066 From: Ovidiu Panait Use devm_clk_get_enabled() helper to simplify probe/remove code. Also, use dev_err_probe() for error reporting. Signed-off-by: Ovidiu Panait --- drivers/crypto/sahara.c | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index ba7d3a917101..619a1df69410 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -1352,17 +1352,15 @@ static int sahara_probe(struct platform_device *pdev) } /* clocks */ - dev->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); - if (IS_ERR(dev->clk_ipg)) { - dev_err(&pdev->dev, "Could not get ipg clock\n"); - return PTR_ERR(dev->clk_ipg); - } + dev->clk_ipg = devm_clk_get_enabled(&pdev->dev, "ipg"); + if (IS_ERR(dev->clk_ipg)) + return dev_err_probe(&pdev->dev, PTR_ERR(dev->clk_ipg), + "Could not get ipg clock\n"); - dev->clk_ahb = devm_clk_get(&pdev->dev, "ahb"); - if (IS_ERR(dev->clk_ahb)) { - dev_err(&pdev->dev, "Could not get ahb clock\n"); - return PTR_ERR(dev->clk_ahb); - } + dev->clk_ahb = devm_clk_get_enabled(&pdev->dev, "ahb"); + if (IS_ERR(dev->clk_ahb)) + return dev_err_probe(&pdev->dev, PTR_ERR(dev->clk_ahb), + "Could not get ahb clock\n"); /* Allocate HW descriptors */ dev->hw_desc[0] = dmam_alloc_coherent(&pdev->dev, @@ -1422,13 +1420,6 @@ static int sahara_probe(struct platform_device *pdev) init_completion(&dev->dma_completion); - err = clk_prepare_enable(dev->clk_ipg); - if (err) - return err; - err = clk_prepare_enable(dev->clk_ahb); - if (err) - goto clk_ipg_disable; - version = sahara_read(dev, SAHARA_REG_VERSION); if (of_device_is_compatible(pdev->dev.of_node, "fsl,imx27-sahara")) { if (version != SAHARA_VERSION_3) @@ -1466,9 +1457,6 @@ static int sahara_probe(struct platform_device *pdev) err_algs: kthread_stop(dev->kthread); dev_ptr = NULL; - clk_disable_unprepare(dev->clk_ahb); -clk_ipg_disable: - clk_disable_unprepare(dev->clk_ipg); return err; } @@ -1481,9 +1469,6 @@ static void sahara_remove(struct platform_device *pdev) sahara_unregister_algs(dev); - clk_disable_unprepare(dev->clk_ipg); - clk_disable_unprepare(dev->clk_ahb); - dev_ptr = NULL; } From patchwork Sun Dec 24 08:21:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 13504203 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C33603FF5 for ; Sun, 24 Dec 2023 08:21:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="UnzPIzGw" Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BO8A1a1001819; Sun, 24 Dec 2023 08:21:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=Uz655i0lnZajLzx004uBUnAj+0q5ECAJU6oreE+oOAw=; b= UnzPIzGwrA8Bzv3TZaYbywMpd2P8HdfY4+oycCIMKzEgbJGHvnuTon4k9jbxeuVu 8pLwUKEwGviNSs+YsgS2NxDSV7vAfSRtFRNZ0gjuA/ohjEcZos0gOR2V1Ibj897G bOcU3snV4b4uUBhvU6ymX12sNxoctJ2zI4gr8/IC3PJaZ5zasiNWIFIWNp/GdHNn XS/V/flOIFhV6mZeN3qpbXUhyIMd98lHLg/pFkAF6FJHMj8ohE+pnMhg6G1sTz00 nFS7y5PAXziIRvDYWJZsFY46sqrq5ZSSqw6KRQfiMl8iVIE7MqKrDiAjGTFFOmvB Zpqx7OxvKXo9X/796VpGyw== Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2040.outbound.protection.outlook.com [104.47.74.40]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3v5ph60rss-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 24 Dec 2023 08:21:16 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a/gavy22huyPPubnSFwx5M0h9fyYb3jew7UDnYdMpbP981M7gcQgnsqACDvfGtUI+qOy4dBnsDQ2E2MpECaCk5lrV86cUDcknGgZGnjh4O6KQTmIhOPoI+uJG17rzzxvFp5UXlsuFSrTRC4GPThKXkixq+xe/nb5V+tsIRok3KRFTG771jjlNDCTlLf4WPNjGfP3DtfqiwuLSzDYmnt0p+tuypsUZV201Oy1CS/NbRA1p6UDCHTJ8s2Ie6tc3aS5prPra0dzwi67oUejmLj45dqQuAtPLR3UWfY4gxPwmlftZkkSm9KUMa3a2aYx2AGU7Hw91q62H669HVd7cPgZhA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Uz655i0lnZajLzx004uBUnAj+0q5ECAJU6oreE+oOAw=; b=NihVoD8Gb4TGLzKVW9Lk3x5vtHEkiaLpgMPcQYfxXKMXbcwvjUhop7Fbouju5uMkxr8YAFnaKEoWBj6l0PzQN3E3ksiIqtZffZZrf/5uaYbJWyKwguxc0K9xA0Uk7bCDtJpxTkuHKQ4CDO+y0FFs3wpRxbmaEo2RoTV7AZP/movFMAKusGtkpeWdwMYN34Gyco0FgXxkn8GxY4q+MUbcJGXpag9tuVXu/seNXSQCyUtcvXcP5qEYUlMbPS/9DS9ym/pivVdzgIbSpm2QDrphCB+OeYH3SrmpcVPrPbOy3vECHJwo+JAkpo2WLJaWe3xTWraqEf+ySiIctN5B2NqfwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) by MN2PR11MB4693.namprd11.prod.outlook.com (2603:10b6:208:261::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.24; Sun, 24 Dec 2023 08:21:14 +0000 Received: from DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e]) by DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e%3]) with mapi id 15.20.7113.023; Sun, 24 Dec 2023 08:21:14 +0000 From: ovidiu.panait@windriver.com To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, davem@davemloft.net, festevam@gmail.com Subject: [PATCH v2 10/14] crypto: sahara - use dev_err_probe() Date: Sun, 24 Dec 2023 10:21:40 +0200 Message-Id: <20231224082144.3894863-11-ovidiu.panait@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224082144.3894863-1-ovidiu.panait@windriver.com> References: <20231224082144.3894863-1-ovidiu.panait@windriver.com> X-ClientProxiedBy: VI1PR09CA0094.eurprd09.prod.outlook.com (2603:10a6:803:78::17) To DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5327:EE_|MN2PR11MB4693:EE_ X-MS-Office365-Filtering-Correlation-Id: e390fe2b-4b7f-403a-ca61-08dc04594b72 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9DGAI+IBrxD+eOPPF3BjiBA4MUVdIs9gKldC20nlouG6KGGoaEWn82+7tjFKyYC1OHhu+uR/Iu8F+lnq9t4u+nTfz4+6rNDtC/rtKGCYv1UtkX5XNH4wKNn9qK1tMxkaQg41Axj85t//F1Do3vmI8GUV9vsXtPvxAsbE3aCuwSM38+ljhnU3evwffkc0+Mt3dlBw9kGs2Q8JguoK1WMC+T4CaujnswH/bQWQ7Pn2fao4Ck6xotDJWjaHRousOBjNyTY7U+/wVJ0Qm6D2f8f88TXQcAr6K3nYWWzAkNy5bjA1x5t+iy9cp2eWJak+n/OZomMWRhl6mMsm0V1RCcaGAj0a6tjoC1D/P79VHo8TXcOD9CVloFHmHMwyauHihoyEZlVsacyL7yhFPkXlw56VAfrFBcclJd1svOqUh8CaEeVcizJWt110PXQa8ge44pNCNHUKze8erP2baVhO9nH683OWx/Txpm6D4B1klA0GMsqL8K80Ty1q6sQHrryDbM0dWZgxR3R8ZqgV5iT3SLY89ZTYLOln9iSf6e7QTqKH2axeWM7mG6SvnTxRisOBjhmhfXeIIi6iHEilxmzjPzH2hdP2Tigr0PeK1/Z3QHKXR9IAXJMsnTUxSHIP+LNYr5G5 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5327.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(346002)(376002)(136003)(39850400004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(6666004)(6486002)(478600001)(2906002)(8936002)(5660300002)(36756003)(52116002)(6916009)(66946007)(66476007)(66556008)(8676002)(38350700005)(9686003)(4326008)(6506007)(6512007)(316002)(83380400001)(86362001)(1076003)(26005)(2616005)(41300700001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5VS2W+R9sGgyv3DwsjcyGeVk1zwVvuJLfpI3B9VT+M5TFz342+ZRzH7AX4A7lhBxxS7qAgMtSbD3jVwSRx+4+9s6hJcrcn8dxdA23B0K9npPJhCFCbFBZcdwwCQ5bDms7X7SVZAtmRK3Fqu4/wGqOYgqsZu6eT/iwMh93DOS5s7jalhaJtrPK6zPG5yH7VkhWh4vrEXAv+hyDnfO3I9fdAAL/eIfcxEOFLdVloTYcWq1C+77W7SLgvlNr308/7jV3kMbofaUvpKxB88cxlN6NScLEUGFqNkuNlFDfVCfmJxOz21ytkaDA4Wz+qd58O119YF6qcXdOfqUB1oocAtPcKWBL3fWA7qpKpOpVNU6dn8iARte7TuUDzGtV4vIA9pbh2yXIw/76KSKRlfldo3heqiyB8tEQp1jYDAyh5SI5J2VGx0QQwDfltpSeey8Vk6+xwJXBoEXiJsB0d8glf1L9F5rHuhvec/9uEdJUJgkjQlnpBlBs48vILHT7LPxBXRym5j3EmQYPMeIX4jnNo8pSA+jJCBOGj8CCZ7FT3fRXCymcYz6+CPkwW6RYr1kcTkLUySdDQfeBnK8UJK0DAG/TmHN1IYEgwmC5v3r64YbGmk2qhq93U0WwyFHin0+npi4oS4IzHzk+Y8tdy7gXuP2UjysPGLFtvlf2xvcePkzzSCrfGSyMcfHqEQN+ut405r4Ebqk/vVqQgCrGXR9tSFvES43S4nLwikCpKaAZL/MHmEDCETVNwR1OXFewvsd4fFdMfJG5Bv2BotpVMTudqj9kQM1djwTyUlM7pZ2Oa6ktg1ta3DJmf3At6jS/pXFFWB2BBfj4AJUG45y5ANKEFEEcPSvn9KTEjrr7dLsXFR52Hyblyt0cqQvhKIhT1tfBkqIKxcaxu9d7YSKOl4O6p7p1pE4xcy63zz+NCXsNyNp6GKi3n+i9dErPnzGKQN0CE9RIdaGTiE2b+8SbH//lzfxcJ6mCGaNxMpIBZwrQk3vHDkkwTj068SzqV0FFxtsh9vKqyWR9DdjD5SEDvNvW7zyeU+h3QHQ42A4sKgiKdXtqV9GzfKhcedJA550Pn/HcGsr9OTAIsWPGAxqAa+98YisU4ygIqb4zIWsW2oByAU/fXljsDRxnvchFIEQ3dTbIsbddDOp9nttSvE1yQwDvt3I9laZ8YZJfvgF3cC5HKH9/OWcYvYLsB6X8ciJbd6n+2sAAqk7BzHbWs8KXyWetDfUUYGD3umGy3EAIfMnHCqKmt87VclgLc76qKWmZ8c8WQYwmNpKKyDHt5ovUlHVNS9A06+MZYPYQn7ilKeEs4ZvCJ0Jcp/I4VqSjr/yp32yzVewvPrRQvvN0iX5sA24D+oBgoDx+pqZ6AYm7VioD4xsKJGyUitY5S65vT/Xbjy5voJePoNzEZgu84wcT+tyIgPkuoq5Pw1Po+TyeTKb7CLSeJVbJuwxfIbMoGy5pvdXaq00wTUjxy45c5KBcRPxjwsxc0U9dyToO4XlK6cVEKusNPI456hf/Y+F3jLqs4r0NHcp+YBK+/7iINm/QVVuFOQXK93O018boGrXJw88ELQjv2oscJmn7iACaxyj2d4y0Ca+DtFrSACJk6MxPk2/vBACEg== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: e390fe2b-4b7f-403a-ca61-08dc04594b72 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 08:21:14.5820 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8XmgqTiU4BUNU3uPY6jh8JRZJzPyPU1S6TCQrmCtLVz8mgacd2Qsqf3FUhL0asnZj3NVIWra2SLw1NT0YBD8fjGjpXIRaDPTXgJcyhtOK7M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4693 X-Proofpoint-ORIG-GUID: tlhS4KvElg-AzNiDnyHk4qpmW557Of5d X-Proofpoint-GUID: tlhS4KvElg-AzNiDnyHk4qpmW557Of5d X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_25,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 suspectscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=861 bulkscore=0 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312240066 From: Ovidiu Panait Switch to use dev_err_probe() to simplify the error paths and unify message template. While at it, also remove explicit error messages from every potential -ENOMEM. Signed-off-by: Ovidiu Panait --- drivers/crypto/sahara.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index 619a1df69410..253a3dafdff1 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -1346,10 +1346,9 @@ static int sahara_probe(struct platform_device *pdev) err = devm_request_irq(&pdev->dev, irq, sahara_irq_handler, 0, dev_name(&pdev->dev), dev); - if (err) { - dev_err(&pdev->dev, "failed to request irq\n"); - return err; - } + if (err) + return dev_err_probe(&pdev->dev, err, + "failed to request irq\n"); /* clocks */ dev->clk_ipg = devm_clk_get_enabled(&pdev->dev, "ipg"); @@ -1366,10 +1365,8 @@ static int sahara_probe(struct platform_device *pdev) dev->hw_desc[0] = dmam_alloc_coherent(&pdev->dev, SAHARA_MAX_HW_DESC * sizeof(struct sahara_hw_desc), &dev->hw_phys_desc[0], GFP_KERNEL); - if (!dev->hw_desc[0]) { - dev_err(&pdev->dev, "Could not allocate hw descriptors\n"); + if (!dev->hw_desc[0]) return -ENOMEM; - } dev->hw_desc[1] = dev->hw_desc[0] + 1; dev->hw_phys_desc[1] = dev->hw_phys_desc[0] + sizeof(struct sahara_hw_desc); @@ -1377,10 +1374,8 @@ static int sahara_probe(struct platform_device *pdev) /* Allocate space for iv and key */ dev->key_base = dmam_alloc_coherent(&pdev->dev, 2 * AES_KEYSIZE_128, &dev->key_phys_base, GFP_KERNEL); - if (!dev->key_base) { - dev_err(&pdev->dev, "Could not allocate memory for key\n"); + if (!dev->key_base) return -ENOMEM; - } dev->iv_base = dev->key_base + AES_KEYSIZE_128; dev->iv_phys_base = dev->key_phys_base + AES_KEYSIZE_128; @@ -1388,19 +1383,15 @@ static int sahara_probe(struct platform_device *pdev) dev->context_base = dmam_alloc_coherent(&pdev->dev, SHA256_DIGEST_SIZE + 4, &dev->context_phys_base, GFP_KERNEL); - if (!dev->context_base) { - dev_err(&pdev->dev, "Could not allocate memory for MDHA context\n"); + if (!dev->context_base) return -ENOMEM; - } /* Allocate space for HW links */ dev->hw_link[0] = dmam_alloc_coherent(&pdev->dev, SAHARA_MAX_HW_LINK * sizeof(struct sahara_hw_link), &dev->hw_phys_link[0], GFP_KERNEL); - if (!dev->hw_link[0]) { - dev_err(&pdev->dev, "Could not allocate hw links\n"); + if (!dev->hw_link[0]) return -ENOMEM; - } for (i = 1; i < SAHARA_MAX_HW_LINK; i++) { dev->hw_phys_link[i] = dev->hw_phys_link[i - 1] + sizeof(struct sahara_hw_link); @@ -1431,8 +1422,8 @@ static int sahara_probe(struct platform_device *pdev) version = (version >> 8) & 0xff; } if (err == -ENODEV) { - dev_err(&pdev->dev, "SAHARA version %d not supported\n", - version); + dev_err_probe(&pdev->dev, err, + "SAHARA version %d not supported\n", version); goto err_algs; } From patchwork Sun Dec 24 08:21:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 13504204 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 154304429 for ; Sun, 24 Dec 2023 08:21:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="a9Ifq+yy" Received: from pps.filterd (m0250811.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BO8LHEX028291; Sun, 24 Dec 2023 08:21:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=S4AvnDJsA5WSbsqWXra5BK77ut4coblAyvpUguwHv7Y=; b= a9Ifq+yySqF7DPAZj+w6I7rEmGx/6uk4HOJM9YAbRzP5EujTEySJI9tD7Rfo8eEp BuhOJh/e+Sb+MIOnIsZQ6ziEVGfYpwvhq4x2MtWsrczyuRePLpFKmtW9sNAICo4o lkcglbFXTJ1r9DjBA2jKoo/WAh+56OroMMj8B1dNAETmgalE0DTyNBBoQsFzMJkC I69VTzcBabaBlLUQTbOXkpdRwlMuGLhyDbXDspdTPedRz96FER2qF5jO2VPhs3GD NqNXDy2NTDZ/yuiRMjTZVE5KW7GOnJGtq3ygk4HDC3nhtAci0gDWvvSv563QBDMr 4xbCM3NzsxT8LJhN+BnKzQ== Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2040.outbound.protection.outlook.com [104.47.74.40]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3v5mrxrtnc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 24 Dec 2023 08:21:17 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Toaf6mKt6cZPTIP8mJhAQ0bjHHHNdqIuEzPaNqKuJicBIDe+D7Q0j+EqcUOi4O2pcQ8LctNNgZ+e6yuKAcQ9WJ+wZOBlNcnOfsgPNdqFeSEdxkfwMq8BRnHFEqG/K7eCp9sfh1nms8tL996gT3oD5HjU8LwmOJ49wAN4EcFWmMJLY5el+4mQpgQUpdHYWyIo7dA6Hby0VT1CNNfChMi7/qk4Eu3YfgANZAu8TuOQFWj1lm2L2Ig9GG//3ffyTwaDWI4y177xRpcdKvBQTYQQlnmyGSDmd53yaX2JCuBGXltN74BR1o7zJek/N0VJ6PkRtsGYr1pTlAs+Jqnt7R7noQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=S4AvnDJsA5WSbsqWXra5BK77ut4coblAyvpUguwHv7Y=; b=KLqHHMcvnkDg1cq6SqQcMFJ8PdeX5KGIt9HlwcQDTlsP+VVLnQ3Cjpca1m4Edx53aJsc3xIsLZAvoWaS2VKfiSWwCIM53m3hpM8cEGdEJPkM8aP/2s0ZHHxAU690ecNydMD1jIjfUD2gkpTkhlVjatwtBfKZPVcT3ge+mgyC6HbNJ4WXCVysAtTlznLacdpNq5gQZm5ln90d4XudI775U+E81jRMG4TF30UYcNaDyqNRPd8WyUVAknGxqSML7TLhhb9EBYniR2iH62NtDJsBZ++iL5HIzLZFJfv+Ffgj4Mjl4B9OaTme6WgoFoJWeB+q006/XSy7SrNb+Kpn7hfDKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) by MN2PR11MB4693.namprd11.prod.outlook.com (2603:10b6:208:261::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.24; Sun, 24 Dec 2023 08:21:16 +0000 Received: from DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e]) by DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e%3]) with mapi id 15.20.7113.023; Sun, 24 Dec 2023 08:21:16 +0000 From: ovidiu.panait@windriver.com To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, davem@davemloft.net, festevam@gmail.com Subject: [PATCH v2 11/14] crypto: sahara - remove 'active' flag from sahara_aes_reqctx struct Date: Sun, 24 Dec 2023 10:21:41 +0200 Message-Id: <20231224082144.3894863-12-ovidiu.panait@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224082144.3894863-1-ovidiu.panait@windriver.com> References: <20231224082144.3894863-1-ovidiu.panait@windriver.com> X-ClientProxiedBy: VI1PR09CA0094.eurprd09.prod.outlook.com (2603:10a6:803:78::17) To DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5327:EE_|MN2PR11MB4693:EE_ X-MS-Office365-Filtering-Correlation-Id: a69d7844-85c6-4b60-5f49-08dc04594c49 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8w6R4sbr1md0Hz/MehIdS/igYFLCSIJTqCDDss7F3+I79Oa+k4+B+fI08hK7cCwSyxLaQR9MfpeeUQ48fVYXSWvqR6lihZ8pph8tmWPBhM839negG79aR4SMfwMeLOZ7Yv2OtNnxSQSDUSK+pgtyHFogV0cOVtD9u31jJfmQH1Y++6hQEGGWyc9TqSES43p8PmzjIU3cS0JfQiH0rMWX4GiovYRUsajEPZbvxa6jiXTTv3zfBurc6+ZtUd6Jykq7Ar5EXrGJBF+/vaVc1bVFe/4OrTgxO97mqnxSXJcmw1by5k9SJWIIwfWrF5tefokHEIkMPr5QI4ZNUlCpWbdd1tcqfG7sYVr2XqNABhEtFUkf2DQc4O15SIWiNC5V9qGQtvSJyt47oNTMFTnXzeAADzrt6zIG3B3Ven9yHzvaSTA+Hxu1e7IGLwPmn4DT1b/HGoR5cUgImlAoyxauRY9/mDR8dxVzwr13bOKIa0l3F2bZB939a1goN++2ZkMTt4knUGCiMyJSUrkk6M/IES2ynPFXsHaETYBIYs/I2isCPhDJBLRZjmIfHcBs+Fx0GWU/EWkjRkTOzYirx+Sm7Yxf5C3WIoGjkKTNs5pzmdlLpEnM0pUlGcf1Bm8JLLX33x4a X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5327.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(346002)(376002)(136003)(39850400004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(6666004)(6486002)(478600001)(2906002)(8936002)(5660300002)(36756003)(52116002)(6916009)(66946007)(66476007)(66556008)(8676002)(38350700005)(9686003)(4326008)(6506007)(6512007)(316002)(83380400001)(86362001)(1076003)(26005)(2616005)(41300700001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: m0GzdnrZItpn4YH7QhOfsdXcsaroxWnv0WWN9dj5pdQ55EXSzc1LggIm7dzXtSGZekMUMYoeH5pKax0RjDTp+BCgEEwltyVqDUw2N1KFSfLkR3CZUrb+JlGtt+WGQnONpCPywJnyITxMFAHWWEh8NhmySUnX4UMkQjQU3mxbjbXqv5he6EkVuuFang9iCMaqZNR4U27zcHu1QmkeuUGwNAdqTFgjq6n6Uv28mdWfLh+pFdVHZbdc/ImOK8djfV8bWMjkpg/O1LZBOezQayCXvh+1uAjSSYg5gIOLtmXi8zuHhYOFXtHZMKHm+s5XyVmh/GWehlKReYL9v0x+IpxxBsklghnQX41oUuMvyFQRmYRlflmyiSrXZTSpmmZFBKbS7nVopzeOv5JIAaekMXuFXcSvoQPgG9CT2fLw5G/BLl1rLRv8aFEz6JaoYT3XZks6ZW8zXd11qlNwJLy7YSLZabLE88cLqaq1M5rQWJf+vYX7ky2L2qt4yIxCqkJZpVsIziMHm2a6Z1cucdKA2ucv+Oe1gDdFAOUWEwhLY34ZEoBhvK1UIFZaGlrrs4iGCG+Uv1G3b+8+J63+hz+B74f0SlMI9pkOvXpiDfzQs/iuMmbzGCgofqk+EkeYfUT5aO+v4FxXqyAdH/vYuHQEz4+1PaVdCOccNwYKtiGGwXryYU+JkWIrc0PIiDGwZ5dMLqvWwytGpP1HZDwDBHboE/+MR9BTyDpykPt8ZxJj1bHE1+0Qr+vtrTO+/FFwLFD65Nr4uMksJjT15/qwKk8buqk2AvTe0w9XoECnRZEp6UL+2gEXWztKD3zMte+DZc4bfs9mr4dCvr/4nIPnwxf4NutqdEvUxxaeZonr1K4W6m29KKVyLpiqUtfPw9/Vr/MZs3nepTekf8vMmGxBcCrzWlFGjLAedY0I2PEifVlu1fjQZjnr3fj08nAvewk4ZiGbJwB9OWxt3/mq7VnLphv+mw+lAJ0goTvT8I3pdF7t8euolcGsGCBeNBYgITYDAShTIhYdeej8WCb4nUlB0utt7xAp1mRXHtUxTfVuP5jxX/JDNeOlKXvBtHhg19AmFF6QR8evNawX7zT2xJg7nnBW++pp9gbzZ0KG5waTqygoGFfbr56AQJbjvG/qlqAnpEREpFnRsFLONh+E4tX9/pS7r2hD9sDu09lE0snEGK5ZiXMqu+OfTCVBLaAtKOO9Zv3WNkSt9IaCtWBzIno1zLkYBWIrqeRQtJxdfZU0dHcsTz8qAH9U1lmbnBif2hvyUv45+LlJbuNWEvb4DTlBDKgCBdPK3qcJuiAJ+pOUWunvMXbDaAGOP8VQD1oOXJ7Eaq0/EzWzlY+LDUE7xa8tm9CIXzxSoJnVl2UGeolEoTM2Zq8rMFhpgTdEnQyQr69yqLmCySKnRhNCRkA3JHvsl5aGovCbpnmy5GSIty+2poztnwjccOg8baaCeeHPrTB+uYEc3FXslC3pVRi5KFH6qq+SatrhX+AxoTwRaekdtP1092Wk/e+lWQVgx9/I65ZF/ocq06QUXbrVz2OKw7PP4caQ7U0c+uHrwTgFYlp6Dtp0hBx3R0spRxMN10RUueqQ0mIQSNFaTKMUGzumT+ioB73n5qaeHQ== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: a69d7844-85c6-4b60-5f49-08dc04594c49 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 08:21:15.9689 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +moH5z7lDNDhlzOVDRTUWkGu+hDBND2q4jdJCqcusSB3tLKcHSq2meWjebuODILHvm3lXtKQHtYIyJTappVC0eLc9Hme+BqeagKniyOa5D8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4693 X-Proofpoint-ORIG-GUID: gm4fdWSCEGwhsDImMgLJtp72vZ5hvVos X-Proofpoint-GUID: gm4fdWSCEGwhsDImMgLJtp72vZ5hvVos X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_25,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 bulkscore=0 adultscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312240066 From: Ovidiu Panait The 'active' flag is only used to indirectly set the 'first' flag. Drop the 'active' flag and set 'first' directly in sahara_sha_init(). Signed-off-by: Ovidiu Panait --- drivers/crypto/sahara.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index 253a3dafdff1..cd14514a43bb 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -168,7 +168,6 @@ struct sahara_aes_reqctx { * @total: total number of bytes for transfer * @last: is this the last block * @first: is this the first block - * @active: inside a transfer */ struct sahara_sha_reqctx { u8 buf[SAHARA_MAX_SHA_BLOCK_SIZE]; @@ -184,7 +183,6 @@ struct sahara_sha_reqctx { size_t total; unsigned int last; unsigned int first; - unsigned int active; }; struct sahara_dev { @@ -1053,11 +1051,6 @@ static int sahara_sha_enqueue(struct ahash_request *req, int last) rctx->last = last; - if (!rctx->active) { - rctx->active = 1; - rctx->first = 1; - } - spin_lock_bh(&dev->queue_spinlock); ret = crypto_enqueue_request(&dev->queue, &req->base); spin_unlock_bh(&dev->queue_spinlock); @@ -1088,7 +1081,7 @@ static int sahara_sha_init(struct ahash_request *req) } rctx->context_size = rctx->digest_size + 4; - rctx->active = 0; + rctx->first = 1; return 0; } From patchwork Sun Dec 24 08:21:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 13504205 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9139546A0 for ; Sun, 24 Dec 2023 08:21:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="McuvDJK2" Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BO8L2fQ015315; Sun, 24 Dec 2023 08:21:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=DymI1x1+TfDEJEeaOFWgsyfb5euAu8Jv7FdVJPj7ys0=; b= McuvDJK2nX+IP0u3Mtjsvq3j3VzVAYUGI61a+fKn9bm/XF1znXD/BFfYtvRvgY1w SnrVXJPpKZcl53BjZpUgPDCB3S1zdot1hKjk3z9D/sne9sqZ/9apQZ/CWZSAaiKr L0b5vNEkn1hdFzZiV11iwqsxbSoSFgjs1KnE4PkJQmKXVICtBVSFCM61vxtf1q2Z 9lL0/+SZ0xJ0RRJy9aFVGTB8T1IEcNn8pctENVSv75kmq9wP9HJKRQkXnP2enIFR YFpyp9fwqz43+IUkA7QSoFMeuPQv6dBC8XxGUE2VehpHV/hvPKyilWhOFjLwIWJL q4co2UodiukSxuPXYbn4JA== Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2040.outbound.protection.outlook.com [104.47.74.40]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3v5ph60rsw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 24 Dec 2023 08:21:18 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q31o2hoPeXWW69JqB+lWRNC5/3FfQ3ifXaItIWa9+RMe82IHnZ33e2PWNJkNHeY99INCgXMhAGn9DFsGxWi8PQh8KJ7Gmdtx1fKGS6m59rv2mcHIJ6/Qd6qvSxH04LCm8q6OIOzQ/4TNRbPjVcCjG/rUNBB8iLeM4wkrA0cWpmc0EKcGQn2iPrMk8GF25+m4NYEgLQ5hEJPYPfCsO4Vnk6NQfqoJcEEyd7lqnVorsnV2VDH/9XyOc3m63sO0LVJh8t+MMmL8CBAMDMRl8uRrMdOzqcMQBWovjWA1vchRqad7dSWLx8HTJp/bSF1lB25EjEj0iUuJd0y8eLPQXtRAqw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DymI1x1+TfDEJEeaOFWgsyfb5euAu8Jv7FdVJPj7ys0=; b=lMQZpg5u4k6alBC/GXdCySyKnxICND31h+R6cAYvD9R+Rc+cRbE8oJIHENIGdhQIoBwxB8hdpP7KvMKNEamKML7tHVew4TE1pQOvoYewftrXPF2WGX4aEO6rRo3U3OzZkVzDu4FCoZq8xPDQW8/aLnYd5QWER/SRygg2YcS/wcRrlJ1kZjmoTG6Y0Qc4gB35ShL9ZZlaPu+6x0lGsqjFRw+Kjj9qU+tf23hxKFSrMACI1V6Ne3sZN81BDrldOMzI2GuIrLYBybyd9KkoqEPGiEjdy3WC/HL1vi8SjeX+AgYZzyi9yBhq7X0hlJwIE0ni33vfotMiluk5l1ZJ9P5c4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) by MN2PR11MB4693.namprd11.prod.outlook.com (2603:10b6:208:261::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.24; Sun, 24 Dec 2023 08:21:17 +0000 Received: from DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e]) by DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e%3]) with mapi id 15.20.7113.023; Sun, 24 Dec 2023 08:21:17 +0000 From: ovidiu.panait@windriver.com To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, davem@davemloft.net, festevam@gmail.com Subject: [PATCH v2 12/14] crypto: sahara - remove unnecessary NULL assignments Date: Sun, 24 Dec 2023 10:21:42 +0200 Message-Id: <20231224082144.3894863-13-ovidiu.panait@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224082144.3894863-1-ovidiu.panait@windriver.com> References: <20231224082144.3894863-1-ovidiu.panait@windriver.com> X-ClientProxiedBy: VI1PR09CA0094.eurprd09.prod.outlook.com (2603:10a6:803:78::17) To DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5327:EE_|MN2PR11MB4693:EE_ X-MS-Office365-Filtering-Correlation-Id: 6fb34f1d-aae9-445f-2eab-08dc04594d1b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GaZQtwDLAR9+md9Rkf8/cPfnxk6SMITxKoCfu//lDIbiR7eFbm/3OGk1Boz5NEDB+OgIn38yMlf0JjtExE0sEdZXTy1QUYxUfetYMusv/QrAfPYV8B54u5QkjvnkijzW6LfQfSxjIl2Y0dj+Qq99HS7UdtHPucxlxjWwM2ryfZK2kFy8Rdtp7a+sahlam9C1v2JgdZtrwOjH4dwq2ZAItyUITbjbWSAGAaoAOZbCw++QqwqoZbFHirAJPQn9b+PXDahWnpabs19JZVCA5OmW/yNFVjm2CYXUbzgjY3oylKWJKcKFZzFLgnuYMzkS4NBMV0/U9Hfn+xCdAvPRM5pOvXnpTkDFy9Qx9xSWTuYyE4h8wYsLSgFKd4NKVIUCv2uLV5vEg/+J2DE7zXOdfss0hldEZnpe+JUZPoWnig7rIeunOQTZ2iDyIShagtrg30n+C6QRLF0x2gr/em7E5nPd1RXheansaEUT0spMifhoL+mj4IMUhztlNBnve6vbEGXQU4ztslS4YfRPLRFsaX6mvJFSMEh8xHfkh5QhtP5g9sXApZuLqYIrlkxmutdIr/cZxlJHDcb2EpQQgWPeCqGTghFH4ohx4+W8R226nZLZNKm9vGSyltO7S/5Banzj4nwp X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5327.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(346002)(376002)(136003)(39850400004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(6666004)(6486002)(478600001)(4744005)(2906002)(8936002)(5660300002)(36756003)(52116002)(6916009)(66946007)(66476007)(66556008)(8676002)(38350700005)(9686003)(4326008)(6506007)(6512007)(316002)(83380400001)(86362001)(1076003)(26005)(2616005)(41300700001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TLJOVMrSCC8jMKfg6ZlmCDZqAmJ4/bajc6n6psjcgV9TaHXiSMHxpi6nnF0KmN+QDG/3pOKvm8crqZqX8bp1aFN82Y73ba1Q5qV/NaHMM8+Eg0Kvkknx3q+vguyO6W9cYaL22RNTGl2mTtGhSpdUNQsbRGDNrHvqkxYvOtlD/OAp6v4O01/yEqU7A7N9cCou4pSldPznx4fkexkBOAk10m5sl+IBl8CyKzxg6IyOFI0KwEbbp8ZZIfcV+iKJOUvddOMSDtZTTocCOYf9cSpIgOFXgKjaYO+IvtsJIXERsGAJy4djd4GZYIp7TCElE2Y5OgHf/AxHkI6iYKeMAJ7hTlHGxN/MzYMMdtQDNpoMZkTbFlbLwZ8zSM7BY2XkmKCDCBqRAlp0VuGcMdrPwhec5sl7OC5wiL8HU+Rq4/LcN4oUE28sYSvW0whOaf5CqpckSGc4NSh94cV8n8HjGUW68Rq6QYgnT0r2SyEgoQ8dJvKpF0bZsoHDQs/RdN9tlNzHpRCVMlO5hNxfBrxGoKvx2GViq+5y16knyRrBNmfSPlW0OY0RlelIK6Ko2UkIvHqpDAnOiq4sQGHwM6Hm0gYk5BFZQUbig1QO7mIHnakEomc51vq0mqb3r6ZHol06HeatWPGPplELVTarGHxpWYmo46zQEFwiCVPaiMOcs8FLvMqsGy7CBjegWlWU1bOys11uziEWbCcgXTBWHoK1rmPC9hBtQLqUY5iNj2rEemLSTFDZsGNA6aKl72tnShU/jhFTJWMh4gK4lbbXMm4sBMpoHqFiSm8DMoeTg4aNQx2WWar0s0sWGMVugul4Hy1BqOZTwl6+JVnAdA3tfeFiaWMLc7ZeJy+LewKml97mjcH65liNEiDEF70JG7QuyYqeSHT+C5W1GE0qYJqpxHD4Vnwcgcz+8hEDgwv8zwTQt2hN9XS/5K4qfJQ1kBlmAPGePapBI5dkKKNDHlW3e3uV5chYaGjyYgyQ5Pl1DWrzgVIaPsnscEK0C2TNdCkpKn1IiO9HDIpvwrmLWzE7Tr/Wzoh2DQvmLzgR4HBcfj1XelZhcxCnUwi3dd2H29uNVuzV3JArj4fkZim9wzeLlDtPjnt53vQZgnEgRscikaugwXtVhR27kzNaOHyysUOZVjt3F2BDblmiv30ZETwc/2W7QPVWKZwAcv+H/xyhD6xqe119hG3n2I1KC7oLVpUPjZwpzCrydw7gpylfD12yJy213LOAuZFye+HFDW42CGvpHr1vbqJSJiS2o9/zZi4TWyGaGEhgJKhNNSmjSF+zP0hsztQwrLelcFnpeLRgZQyTqhTklLfI+7EXpwmEWWNwUpb0bsdn55v9HmLJRS4UYkgnKTNNpq462tyO1yAWmng+YmUoI8bre2jsl1o6jJ/+NaPkj53NpORQUp0hCuJqXkviEo9WogfFm0YTCY/Gm57QBunJf/lQ4C5sPgjsAP40CGrlXC0AQjaZrk+ScAhQUo3nEDaJw44ba3FoDdGWPmtaNjEhrme4I5Y/l8ZoaePkVxgZDEOAeOvWZyCu/TiERro8yL9EG+4VuzUIoLXnIlD0GWQMsPVQyai7Vx5GEQjLr+f/ZIs5OE+m2tAJiM1LrI5A4HoZKw== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6fb34f1d-aae9-445f-2eab-08dc04594d1b X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 08:21:17.4765 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Y7PLSUBgHBkSFdzrh+9V48ZOZienwo5sPsYC7LDmkN4pcJC7XDvG5dx8k6smS5H/ChSI4Q/IcZIoB9v6TZEMoRk7AQ3ftH3OhHCElP6Y0gY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4693 X-Proofpoint-ORIG-GUID: 5SYTFDqDEpZE3yxsmZ1a0I8LWsx4AG9z X-Proofpoint-GUID: 5SYTFDqDEpZE3yxsmZ1a0I8LWsx4AG9z X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_25,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 suspectscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=994 bulkscore=0 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312240066 From: Ovidiu Panait Remove unnecessary 'dev_ptr' NULL assignments in sahara_remove() and sahara_probe(). Signed-off-by: Ovidiu Panait --- drivers/crypto/sahara.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index cd14514a43bb..fdae8c7e7c78 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -1440,7 +1440,6 @@ static int sahara_probe(struct platform_device *pdev) err_algs: kthread_stop(dev->kthread); - dev_ptr = NULL; return err; } @@ -1452,8 +1451,6 @@ static void sahara_remove(struct platform_device *pdev) kthread_stop(dev->kthread); sahara_unregister_algs(dev); - - dev_ptr = NULL; } static struct platform_driver sahara_driver = { From patchwork Sun Dec 24 08:21:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 13504206 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55DAB539D for ; Sun, 24 Dec 2023 08:21:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="oEGKtU1P" Received: from pps.filterd (m0250811.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BO8LHEY028291; Sun, 24 Dec 2023 08:21:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=6hgaBw09txHZH0YxfSZGMqUzwtuDDReyweHC1Bg2UKA=; b= oEGKtU1PbuTmlHojzqQjY67QwgtK9S8+qLmHs0E1WlsD0Fx+XTshaf+DJfTB2tQn vVi81DgU0Gsd7tVyOb3ILHjd8vo3qLBaySUSV0RlVJaYnDhvG57H/ea4K6EbS0lD FmThJ85f49V5KbuOgM6KeH1kUHqbiTWGeGgxVfH/RTXYwZAftK0Ut0BHMGwcxhYG fQnHbo/356UxhtBieSjv6qGbLouHE4wan+7FY7Umqjt5SmcrE5g8YgKyirojhZFN pCdERUBSrdM09Y4mgXJbTjOAn955VJMadkS0wWR0dZ9hKRC1BBkhxvBPNPhiU36u kuyYCGIZWukVnNZX1JmsBg== Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2041.outbound.protection.outlook.com [104.47.74.41]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3v5mrxrtng-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 24 Dec 2023 08:21:20 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lr/vs8kJxVe5IItWJ/zyqcl5ux4cNQdhp+VVDqvksQ4Y/QdDHkHjHeZZTQXM8thaI5KVeCldtEK/TOLyQCH8E/wro52I0qYpoYv4NGezvHnjTKP40jd2ux4W5v2Um14uVXrswYFWnAyZaIxG47BAo5NX1IYEnRWesA9f7jIk8LkpMUmpL3VJ8vdmlr5t/f0vrBjpOdEPhMHSdvzBz3pHEs26E4Neol6w/WjTBfzv3qWI4+yxy/Q33Drlsy2wXNWX+dXz8x/Uqi0CVZ7UF1vqpUyS36lP3l46MQhNT+VBKYHrRvNMwT3bcgSOUjIsBq1NY9VfM0hMPG2ZllGak6uuug== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6hgaBw09txHZH0YxfSZGMqUzwtuDDReyweHC1Bg2UKA=; b=e9E3wCk35kOrhpzcxkHIBNCADbSuS6EhC2cOsmljN636Ordwq8OStF1se3sQ213U/Bm/CKiO0pLrzBNzfKrjKJUHHhudxAeM/m5hOjC1TABPRTw0n/SvB/gvQTR/XPwI8f7X6bKU6rjH7tmhTba+tRkS5Fx2kJokkxGkafosjbNGUAzGeHLR1sNAj9h585tCm/G7H2ZpDCbnHpZD3rvDco0iXEB7PTHXHZkp6O/BfXrQ+kIJsYQUEpMkubOo7pDHdVx8q1uVRh/vs352Z9Z3PQtguejgdHgaB24SC0wE6SMInyK7Kvygho0/+aMd8GgaD8x9gjeyXQmlU2BIyhqm/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) by MN2PR11MB4693.namprd11.prod.outlook.com (2603:10b6:208:261::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.24; Sun, 24 Dec 2023 08:21:19 +0000 Received: from DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e]) by DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e%3]) with mapi id 15.20.7113.023; Sun, 24 Dec 2023 08:21:19 +0000 From: ovidiu.panait@windriver.com To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, davem@davemloft.net, festevam@gmail.com Subject: [PATCH v2 13/14] crypto: sahara - remove error message for bad aes request size Date: Sun, 24 Dec 2023 10:21:43 +0200 Message-Id: <20231224082144.3894863-14-ovidiu.panait@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224082144.3894863-1-ovidiu.panait@windriver.com> References: <20231224082144.3894863-1-ovidiu.panait@windriver.com> X-ClientProxiedBy: VI1PR09CA0094.eurprd09.prod.outlook.com (2603:10a6:803:78::17) To DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5327:EE_|MN2PR11MB4693:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a188bc2-1c00-4f81-16d4-08dc04594e00 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Oafm2DO4cxU34Dkn9YmjsjzkgZ3o8Ir8ijUzy4hzn+5I+FYpHP+obQccAEPZP+IUyu7tE+ber51r47f2q2J1KeJjVMxYCkloC/Aefig0E5apcijTRnwet73+iYyEqjZq/IZVeP0+jJ8Gtz72cHXCDVMI4kZ0vyPtbX8MdDs5klorSJ6jhYl81CK05nB318RhLBTPY3EAV2htCIuzKs089jE9433/uQTsM4PC8qS8Bsz+dUdoI1YnSO6oMIVZxqvjjK/BRDpApJI+d6vPZKnV9M1F3+JSOqv/K1Hq2jJcw4bBXkp3nC5fcS9IGKXtjajrorijMeNdNnH9FhLw0EdNobu2ldOX1K65nw3TLjpn6rCwF8c/KDSyP6wmSrzOCkHE0DgOpeq48HjjmpNXzwa0Fll8yBUcQ8SfpoccDAQ7vVKY/PwK5EJJSC8JoEsM6lH2v/yL2zJpHPrHaav5LIRMxh5TWWz1uJDNucjF3fW+C+ApPnDZLME7L6AKfTgoIgYqS9obrcuuNQZmhoFSlYmSNixMrRuj2DIxWNbvvQbcKCSV4g4CYebxOZEIFGFraEe0dx0IsHtlzk2gz8sSeYY6serfoP88y9eNiObVFQ/YEAUtr2dzMlqI+8hZo9D5GGZv X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5327.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(346002)(376002)(136003)(39850400004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(6666004)(6486002)(478600001)(4744005)(2906002)(8936002)(15650500001)(5660300002)(36756003)(52116002)(6916009)(66946007)(66476007)(66556008)(8676002)(38350700005)(9686003)(4326008)(6506007)(6512007)(316002)(83380400001)(86362001)(1076003)(26005)(2616005)(41300700001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eLjkkMJwyaOqKFbKGMUr8BpTCFO+UycungucQbjgW32mHPRIceYsxXKzspy7ULZAfaNJwhkx+Ih74A5Scjdu32ocQN0TTDufySbLrIIo2ypCAiIxjijfcueYYtCZ4eZakrQCovvKK/gpBlhmgdjTy5XvsiZjL2o64e+MlPcaXhRV1QMIoV37pDK9sAkNbpQWNzmQ+KlqykC/rW0pUZVAaVU0sKAjziYrK8peazW55SPvF1B8civolBcV7YTNKKzwuG+5+vjuqRLvmwysjL5wmB6bAiY5MXqATO8ICeugbFP3h+ixLBpoQjmFxi+hT4KKN/qlHserfsjQUFCy8HZDcXUzPTV9R9MO74xSBSbVroLbp0ECuDVZJtn1jbH/0fVghgBh7sICRHjP8CmR5TFWsVqjHJG+oEVJH857cTGJxTMTvpeqRfXwWE0L/POJeu1DaNQBnLsTcF5Deo5NYaiTHbwD5oEYCyzCu643DZsmun/BqIWwahdnHqy3wcYcY7cUhX7FiIEtHIfMtMDQ7zHLcZycVwtzAhDwkUF2hjwrplM7eVz6VppBRKzhFAcnVebvp0USy/pdIoZIhYT71L9fmrW2FnxS6ec6MNZRBR1Fxx5mIcctE6FG3r+7WsaOtvVYs3ZTdUqbN5gZTSsQbOXGx3PaFsV+UPXovJ5pXAIIvqHOhKv2szIqPsL+uWI6nDCKQq8SdiX6Qc6pnyq1RtyfDjTZCz0nnrxFRbfSVOzwgHxBkdkRHCg18CeTQ6IReIZh6vUQ6i4s8qqQSlGhVaeHX4s4zXJ2OxYmWi9Sk4gT0+2VBcXZIX3+CzK/QwUnaseqFOlNKVXaU+2Ccxs0YG2C0DLjDByMtHIyKcs7RXLCC0kk+PHmx3+hsAgp8kNu91ryz3XtFJSbZ2xgQ5mNXuJqbrcK9je0kTpknV9EX1opc2mORqsC5rxm9xaL44g6DvQ/9F11WGvr/twHu6E89OcmsrlMS4RG7HNbdYtck6K3B+9eUKddV96EbLuuRlsyLhJHyC93xWQBXcZkAy4PlOFkEJintCAhxcxrueh8fAUXXsZAJJGUqoGkstOsU+3Yu6P1fsMWDSyjnSsC6fUwi2Qtqkz1y1ISuhRF5oiYmkkffAPVwHyKSH9tYzBJKry2w+DkM5X/sNObMYUjcI5LShX+mELo9FvGeclEWEJNC3shbVogGN8N4KrzbmzKHT3DVEkk8WLisnqKpTurJ2NxQdFpzFncd9/sNZpt58IAmiLHxwl60d8J+uOcRQiDC3OB491SnPgJ/7GoNMFPUyqxEbA9jHkN5RA3z48al1OPy4Qfr4UwliWXL+a7PfDYkxOEgag3zvbgbKonVaHEyzwVysL5F6VWpwUnu2pcOMew+WEc3MJ8f2C4nZU1AvkwlmnRALwPflihdPLxNCwSHLItl3AAjaTCkHhnlsHwCcEw+HmrzSgCSA1nCSRBeSiEtWkfkryLPQquyBjh1HJ3txtkY+C3RMk0trlW8ne4JET3aH6qEVA5fcD4BVnLEEwDnqsq3bBl4q/x/vrWN3pHeyicKyeBVMVjmpSup+fzi0hDOUNJa5UVH9a6UF+zV7YYO9im/05h0PpORPCerkRUE4gAq8PMow== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a188bc2-1c00-4f81-16d4-08dc04594e00 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 08:21:18.9622 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NeaMckp+3wWua2EjmRXuJewNl6VWtx9NwjgRWFz90YQZz6xJOmFfEWPuUNtmr9KrD/R7m+AZnHphzCfFnTNZOiG3dsfqhezami1mOYfDSfw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4693 X-Proofpoint-ORIG-GUID: bcoaBA_6mvra74bGmi3RF_Ux7xYe6TY5 X-Proofpoint-GUID: bcoaBA_6mvra74bGmi3RF_Ux7xYe6TY5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_25,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 bulkscore=0 adultscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 mlxlogscore=889 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312240066 From: Ovidiu Panait Do not spam the kernel log with unnecessary error messages when processing requests that aren't a multiple of AES block size. Signed-off-by: Ovidiu Panait --- drivers/crypto/sahara.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index fdae8c7e7c78..886395603a3a 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -682,11 +682,8 @@ static int sahara_aes_crypt(struct skcipher_request *req, unsigned long mode) dev_dbg(dev->device, "nbytes: %d, enc: %d, cbc: %d\n", req->cryptlen, !!(mode & FLAGS_ENCRYPT), !!(mode & FLAGS_CBC)); - if (!IS_ALIGNED(req->cryptlen, AES_BLOCK_SIZE)) { - dev_err(dev->device, - "request size is not exact amount of AES blocks\n"); + if (!IS_ALIGNED(req->cryptlen, AES_BLOCK_SIZE)) return -EINVAL; - } rctx->mode = mode; From patchwork Sun Dec 24 08:21:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 13504207 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D078539D for ; Sun, 24 Dec 2023 08:21:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="luVbGy/H" Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BO8LBZS021945; Sun, 24 Dec 2023 00:21:23 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=dzqEg4d4RUGBJljTi10lxR9MfKEKd5PH94kTwLCppEw=; b= luVbGy/HBlZ+SGfDEz2fvAzq4oezB564O4QLggYYYo55HQyvhcXi2+u/M1XMH6qT 88kUpDacTmxtQKpgcBqPFnhRF9PXjLuAqNM7kXhIfXqjHBbDeNU5SQ/1Yhlwc94W Xzf/fNIlBspJcQOZyDDHOV2bLxhn4UtRZhc5iV+4TzjcLokQ44Zy0ya/thOuOuoW 7wxxjthT52byCBrSK3prgzGjHlCm7q3iVWqMzqMC+sd8RWCLzSEfFH3JsPU/D3Hi /K7ZEoLcGmsL92xBcObsSXNggQEOt2YuV6HvTuwo+HzFnjkwnMM3vEEkghmGR4on 4xRZNV43TcF3h5d5BRduWQ== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3v5uq4gk8f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 24 Dec 2023 00:21:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SLRU5mIEzJinf+e3UU5c+DDZfEJ6ZsNkbvPXxFX4aVYJMKPNGtm/NcbNG6GhI3RSwW/1Ev4SeoftJDnf95lk0i3CdsQ4m0bVVu9tL8uE9/3862G9B+ZcFdZXEeeoza2dqRdu8Ci+IsehysLTukvCpELtTpVzhapQVZBOsBIe+HMSUuI+haumCC0O3BYOlxBiaP4UK3d3QZ/E+zszjpCb3F9s7Kt9JIBvPJWBlP+d+myF6VMPXqdFJEum/U8PJQ4bQhZ2ZqC73BSrXbxw1BvjM7hhAmvVqLjCj9en7V+RDpUqi7uHJMgE8bxZ1/A/pk+hpa63nxwqhNK33CwleHSnNA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dzqEg4d4RUGBJljTi10lxR9MfKEKd5PH94kTwLCppEw=; b=JAoa4h9mFarJ/y/Pxp7drm7SoIJ72jUu6o6oAnP+z58qR1Guvu6LaQvrCVOefPwmshEjNA001J5jJDnvk+6z9M+mDr2olqtxfaXyrc5NDaz9gdLR42RW2SH75h6o78UdT4VrDTrDa1VeVs3sUlq5c14wy9iAYpBOFsycNVWwKKPBk7ZQMWxxUOqek4U04JIIJ5aFFK7ZNWybLtcZr1TvlygQi666ti3PrIptcdMgtBFWXHC/QDSH41m2e4BDHaFQunKWm1qD3PhHC8j4nZCbMqcap6pRZl/YuwTSAb5VH7dBwCxv/kk0Kt4ae+NIAIdF2U+dpawx4Zl87F3eiBRfGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) by MN2PR11MB4693.namprd11.prod.outlook.com (2603:10b6:208:261::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.24; Sun, 24 Dec 2023 08:21:20 +0000 Received: from DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e]) by DM4PR11MB5327.namprd11.prod.outlook.com ([fe80::7c2e:5b95:fdc2:30e%3]) with mapi id 15.20.7113.023; Sun, 24 Dec 2023 08:21:20 +0000 From: ovidiu.panait@windriver.com To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, davem@davemloft.net, festevam@gmail.com Subject: [PATCH v2 14/14] crypto: sahara - add support for crypto_engine Date: Sun, 24 Dec 2023 10:21:44 +0200 Message-Id: <20231224082144.3894863-15-ovidiu.panait@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224082144.3894863-1-ovidiu.panait@windriver.com> References: <20231224082144.3894863-1-ovidiu.panait@windriver.com> X-ClientProxiedBy: VI1PR09CA0094.eurprd09.prod.outlook.com (2603:10a6:803:78::17) To DM4PR11MB5327.namprd11.prod.outlook.com (2603:10b6:5:392::22) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5327:EE_|MN2PR11MB4693:EE_ X-MS-Office365-Filtering-Correlation-Id: 80ed145b-80b7-4150-9cec-08dc04594ee2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dKBLuRNPSYZklTXAU4X9NQHJmPqAvXSmFDCUy6iHiRPolKIvAnh3oBI7NmIBDvqOKmZ1siZ5dMuBs6alF3/NKV4giJCJ28D2shpvl4inJGWquv+NJ3JFeuWYAPrmKNM5NYroeOaTzKUwpwrB/edVOkzsrAjM3JKC1jKkwLyiHUXNjy5q3kAD9FcnsrCZh0CcccdKl2WqQEI8bzNkbTeW0JsmQXG2RbnLAPAEpU6kPeVuyPIn3tPndLO4nkZlQNvCgyEEcm0DWCC73C2FZqDSdTxYu+cLYKdUpZOnRuagJGZd9v5vZSb9MCzqBHnidifuBYNanlPdpi6LM1gUSxcd3hE/PdLL5KVOOnXTrHBoiN9CDZrbEWtvMx5Nn6hbNdRCHKhr1a4hTvTxB3a6M+jSxrd4nQMAT4k1xpAoxkvSgXAvKX8T0JycX7eLKdUOhdAJHeOEuVwXE1nutLxhE6MVdDZ6zec7sWqv0dKxJpEMces1D8m4OTdtkmqhsqZF3XiUG6JOtD0mV99UVtiosNJE4EGiwc4n1yUM6QfinbLrorTndbCPkIWnQD5NLBC6mPHfDl4z/utNgduxng7xEU4Y58STKTNLJxOUkhfvSImEvTcrFpDLezYEdV9J21CZKrZH X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5327.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(346002)(376002)(136003)(39850400004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(6666004)(6486002)(478600001)(2906002)(8936002)(5660300002)(36756003)(30864003)(52116002)(6916009)(66946007)(66476007)(66556008)(8676002)(38350700005)(9686003)(4326008)(6506007)(6512007)(316002)(83380400001)(86362001)(1076003)(26005)(2616005)(41300700001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 87BOPHm0pXqGF9TXeb5rUPDiso5fXWvnBCn21elCYBG+Wa1i1I9V4uF/g6PlRtWuKw/gZrekuJudLXl52/MmmlxBqjCGA2fZdd9cg3fOAhMHuyarqTyWhJ2OeIlN3YZ2IkDf5ZhJsU0E5c4g77L60Vty/tQBxXhm3Pzjmbr/cEB1tvQ7c3yX656N4TFEemzzAMjQze7maAuv7gFzzklAT71QzhhLnwrX18v1inGBC7XuuBQ5bSilt3mHms51Lg003xXc/33vCA4XWAABvmetmp+QECMYODmKysY29xFksBekAe7cNwK9kOM3DN5hoHRMykBuSem3Cz8jOAwWtB7r7injL9YwNRVT1s+Ve+MndMjJeh7QbP5X8V9M1Kt/bEx2BzDaY+gO7KP19LFZQTSKMvTFhpXurnPDj94QEjVuRNJRHz4Vl/ofwdYhEdJ3AfgvR5QmzJn4I5J0qRiYZv9vozZo1yMq19FBvcRJRqFqaFG3QpWGO3FtNkC9DIODFvGE4lAk0STOj52mqoCVcZWLkBqosHF48s0rc176OgI/sAHtV3XauRIuD+5nJyjfuO6Yppza0NW4jSiMmL7vPDjNsKUEEyKNgWHpYvcN1HxUqK4nfy3Ji4fRdTfuGdK5FKyC9Q57TGEXVCZgg2QGVEGHzvVZAl0uIoua3O/TTBg0ZzGZHYwQIrfb4Twsel/wV0rUwE5UaCSQS+uiN55BOJKSjo/WmswybGIYCplAXMFjMoxGKPYY+3ZS2+hhgfT3xsV08VMClNqNWSPgvXyoQlbwOn8Zfd+v+DrDw11tC3T6vTonSQtn4HarCXadJ1U0mgG0dXR99O90cOigJxjhICZgbBpUM60buVHcUEtBxvdcvvi/k3cnMg1FozUtUhfIaS98H/2UvyXzV2QpFJgDxdGwR2F8v8DWI9zTITFFI8PbvAPcgSvGrmS3XYR2AAZ2JYKs4jpFiXlSRvt7/YVYSs5Hbq+AImuyeAi4aJRF943093IVBsf79L2h6evg9IuOG3VIqmgpSbtrj/+vFtCiYzk+zuig3Hf5QOrk4vxMVuXzx6MZPTPiGIOThL2g7p5MGEq79xRuZaObe5U79fMDlHhAxpfRi906DXw9IoYZkgZduEGwpMdNCumf6ix0kdKukZijMPnbXVZl3clxcARxO7a9cwfe3NsDyCkzojzzg5Thm1wdBZr1AQURdn7ZPWvtMUwVzruVNCUXworbKOPpg8TxdUw4TpjBZOfiuqtJPp8LJYdqSbArvn/vud2UIwKIvwi6kZSh9h/o24wg3z5VxZXcWJTX2EooCTzIfR7A6/3gpXGmMpW2INX4Zw6cUbUZYFUVyXZ5Fn+V7WeHPHoZtv1y/oCviybaOr8eEx3RnEYzQho154jmzgiwsNvo25h1vPR0lKdhTRE+/LCfyWxIVaEDecl7C+OO2bAzxXVIqMgHBIBOE/nl/bzsis0zgKRbMNuK8nMFFc9/ZbIlbua+bOOZi/R2aYU4ppd0gO2l4qQGY6/TSjUytrswGfjuQ2b+TzGKTjyOktO6W+xSaao5lfLFq5A/oZUM/GOJi0Mg+WBoOm+TN3hYY564F1zeiFDOFZ4ZnDv3qsSr5EP5gKwy3B4WAw== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80ed145b-80b7-4150-9cec-08dc04594ee2 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 08:21:20.4518 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: I8QVCfYgJalDhxesnyuR+pwadnJi5RENv4fobZbSdP9+qFaAcgo1hQg8CjzeG6hs1JOnAWEHV7Ig5hrTBo0nCLmeluy/ITVUE+fLvW+hcHs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4693 X-Proofpoint-GUID: Vslx56E2HxXPfkbEDemiE5Yt7u-Jm1g6 X-Proofpoint-ORIG-GUID: Vslx56E2HxXPfkbEDemiE5Yt7u-Jm1g6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_25,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 impostorscore=0 spamscore=0 bulkscore=0 malwarescore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 mlxlogscore=963 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312240066 From: Ovidiu Panait Convert sahara driver to use crypto_engine, rather than doing manual queue management. Signed-off-by: Ovidiu Panait --- drivers/crypto/Kconfig | 1 + drivers/crypto/sahara.c | 325 ++++++++++++++++++---------------------- 2 files changed, 148 insertions(+), 178 deletions(-) diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index 79c3bb9c99c3..0991f026cb07 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig @@ -306,6 +306,7 @@ config CRYPTO_DEV_SAHARA select CRYPTO_SKCIPHER select CRYPTO_AES select CRYPTO_ECB + select CRYPTO_ENGINE help This option enables support for the SAHARA HW crypto accelerator found in some Freescale i.MX chips. diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index 886395603a3a..3423b5cde1c7 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -24,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -73,9 +73,6 @@ #define SAHARA_HDR_MDHA_MAC_FULL BIT(9) #define SAHARA_HDR_MDHA_SSL BIT(10) -/* SAHARA can only process one request at a time */ -#define SAHARA_QUEUE_LENGTH 1 - #define SAHARA_REG_VERSION 0x00 #define SAHARA_REG_DAR 0x04 #define SAHARA_REG_CONTROL 0x08 @@ -191,12 +188,9 @@ struct sahara_dev { void __iomem *regs_base; struct clk *clk_ipg; struct clk *clk_ahb; - spinlock_t queue_spinlock; - struct task_struct *kthread; struct completion dma_completion; struct sahara_ctx *ctx; - struct crypto_queue queue; unsigned long flags; struct sahara_hw_desc *hw_desc[SAHARA_MAX_HW_DESC]; @@ -219,6 +213,8 @@ struct sahara_dev { int nb_in_sg; struct scatterlist *out_sg; int nb_out_sg; + + struct crypto_engine *engine; }; static struct sahara_dev *dev_ptr; @@ -671,7 +667,6 @@ static int sahara_aes_crypt(struct skcipher_request *req, unsigned long mode) struct sahara_ctx *ctx = crypto_skcipher_ctx( crypto_skcipher_reqtfm(req)); struct sahara_dev *dev = dev_ptr; - int err = 0; if (!req->cryptlen) return 0; @@ -687,13 +682,7 @@ static int sahara_aes_crypt(struct skcipher_request *req, unsigned long mode) rctx->mode = mode; - spin_lock_bh(&dev->queue_spinlock); - err = crypto_enqueue_request(&dev->queue, &req->base); - spin_unlock_bh(&dev->queue_spinlock); - - wake_up_process(dev->kthread); - - return err; + return crypto_transfer_skcipher_request_to_engine(dev->engine, req); } static int sahara_aes_ecb_encrypt(struct skcipher_request *req) @@ -994,45 +983,26 @@ static int sahara_sha_process(struct ahash_request *req) return 0; } -static int sahara_queue_manage(void *data) +static int sahara_do_one_request(struct crypto_engine *engine, void *areq) { - struct sahara_dev *dev = data; - struct crypto_async_request *async_req; - struct crypto_async_request *backlog; - int ret = 0; - - do { - __set_current_state(TASK_INTERRUPTIBLE); - - spin_lock_bh(&dev->queue_spinlock); - backlog = crypto_get_backlog(&dev->queue); - async_req = crypto_dequeue_request(&dev->queue); - spin_unlock_bh(&dev->queue_spinlock); - - if (backlog) - crypto_request_complete(backlog, -EINPROGRESS); - - if (async_req) { - if (crypto_tfm_alg_type(async_req->tfm) == - CRYPTO_ALG_TYPE_AHASH) { - struct ahash_request *req = - ahash_request_cast(async_req); - - ret = sahara_sha_process(req); - } else { - struct skcipher_request *req = - skcipher_request_cast(async_req); - - ret = sahara_aes_process(req); - } + struct crypto_async_request *async_req = areq; + int err; - crypto_request_complete(async_req, ret); + if (crypto_tfm_alg_type(async_req->tfm) == CRYPTO_ALG_TYPE_AHASH) { + struct ahash_request *req = ahash_request_cast(async_req); - continue; - } + err = sahara_sha_process(req); + local_bh_disable(); + crypto_finalize_hash_request(engine, req, err); + local_bh_enable(); + } else { + struct skcipher_request *req = skcipher_request_cast(async_req); - schedule(); - } while (!kthread_should_stop()); + err = sahara_aes_process(skcipher_request_cast(async_req)); + local_bh_disable(); + crypto_finalize_skcipher_request(engine, req, err); + local_bh_enable(); + } return 0; } @@ -1041,20 +1011,13 @@ static int sahara_sha_enqueue(struct ahash_request *req, int last) { struct sahara_sha_reqctx *rctx = ahash_request_ctx(req); struct sahara_dev *dev = dev_ptr; - int ret; if (!req->nbytes && !last) return 0; rctx->last = last; - spin_lock_bh(&dev->queue_spinlock); - ret = crypto_enqueue_request(&dev->queue, &req->base); - spin_unlock_bh(&dev->queue_spinlock); - - wake_up_process(dev->kthread); - - return ret; + return crypto_transfer_hash_request_to_engine(dev->engine, req); } static int sahara_sha_init(struct ahash_request *req) @@ -1132,94 +1095,114 @@ static int sahara_sha_cra_init(struct crypto_tfm *tfm) return 0; } -static struct skcipher_alg aes_algs[] = { +static struct skcipher_engine_alg aes_algs[] = { { - .base.cra_name = "ecb(aes)", - .base.cra_driver_name = "sahara-ecb-aes", - .base.cra_priority = 300, - .base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK, - .base.cra_blocksize = AES_BLOCK_SIZE, - .base.cra_ctxsize = sizeof(struct sahara_ctx), - .base.cra_alignmask = 0x0, - .base.cra_module = THIS_MODULE, - - .init = sahara_aes_init_tfm, - .exit = sahara_aes_exit_tfm, - .min_keysize = AES_MIN_KEY_SIZE , - .max_keysize = AES_MAX_KEY_SIZE, - .setkey = sahara_aes_setkey, - .encrypt = sahara_aes_ecb_encrypt, - .decrypt = sahara_aes_ecb_decrypt, + .base = { + .base.cra_name = "ecb(aes)", + .base.cra_driver_name = "sahara-ecb-aes", + .base.cra_priority = 300, + .base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK, + .base.cra_blocksize = AES_BLOCK_SIZE, + .base.cra_ctxsize = sizeof(struct sahara_ctx), + .base.cra_alignmask = 0x0, + .base.cra_module = THIS_MODULE, + + .init = sahara_aes_init_tfm, + .exit = sahara_aes_exit_tfm, + .min_keysize = AES_MIN_KEY_SIZE, + .max_keysize = AES_MAX_KEY_SIZE, + .setkey = sahara_aes_setkey, + .encrypt = sahara_aes_ecb_encrypt, + .decrypt = sahara_aes_ecb_decrypt, + }, + .op = { + .do_one_request = sahara_do_one_request, + }, }, { - .base.cra_name = "cbc(aes)", - .base.cra_driver_name = "sahara-cbc-aes", - .base.cra_priority = 300, - .base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK, - .base.cra_blocksize = AES_BLOCK_SIZE, - .base.cra_ctxsize = sizeof(struct sahara_ctx), - .base.cra_alignmask = 0x0, - .base.cra_module = THIS_MODULE, - - .init = sahara_aes_init_tfm, - .exit = sahara_aes_exit_tfm, - .min_keysize = AES_MIN_KEY_SIZE , - .max_keysize = AES_MAX_KEY_SIZE, - .ivsize = AES_BLOCK_SIZE, - .setkey = sahara_aes_setkey, - .encrypt = sahara_aes_cbc_encrypt, - .decrypt = sahara_aes_cbc_decrypt, + .base = { + .base.cra_name = "cbc(aes)", + .base.cra_driver_name = "sahara-cbc-aes", + .base.cra_priority = 300, + .base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK, + .base.cra_blocksize = AES_BLOCK_SIZE, + .base.cra_ctxsize = sizeof(struct sahara_ctx), + .base.cra_alignmask = 0x0, + .base.cra_module = THIS_MODULE, + + .init = sahara_aes_init_tfm, + .exit = sahara_aes_exit_tfm, + .min_keysize = AES_MIN_KEY_SIZE, + .max_keysize = AES_MAX_KEY_SIZE, + .ivsize = AES_BLOCK_SIZE, + .setkey = sahara_aes_setkey, + .encrypt = sahara_aes_cbc_encrypt, + .decrypt = sahara_aes_cbc_decrypt, + }, + .op = { + .do_one_request = sahara_do_one_request, + }, } }; -static struct ahash_alg sha_v3_algs[] = { +static struct ahash_engine_alg sha_v3_algs[] = { { - .init = sahara_sha_init, - .update = sahara_sha_update, - .final = sahara_sha_final, - .finup = sahara_sha_finup, - .digest = sahara_sha_digest, - .export = sahara_sha_export, - .import = sahara_sha_import, - .halg.digestsize = SHA1_DIGEST_SIZE, - .halg.statesize = sizeof(struct sahara_sha_reqctx), - .halg.base = { - .cra_name = "sha1", - .cra_driver_name = "sahara-sha1", - .cra_priority = 300, - .cra_flags = CRYPTO_ALG_ASYNC | - CRYPTO_ALG_NEED_FALLBACK, - .cra_blocksize = SHA1_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct sahara_ctx), - .cra_alignmask = 0, - .cra_module = THIS_MODULE, - .cra_init = sahara_sha_cra_init, - } + .base = { + .init = sahara_sha_init, + .update = sahara_sha_update, + .final = sahara_sha_final, + .finup = sahara_sha_finup, + .digest = sahara_sha_digest, + .export = sahara_sha_export, + .import = sahara_sha_import, + .halg.digestsize = SHA1_DIGEST_SIZE, + .halg.statesize = sizeof(struct sahara_sha_reqctx), + .halg.base = { + .cra_name = "sha1", + .cra_driver_name = "sahara-sha1", + .cra_priority = 300, + .cra_flags = CRYPTO_ALG_ASYNC | + CRYPTO_ALG_NEED_FALLBACK, + .cra_blocksize = SHA1_BLOCK_SIZE, + .cra_ctxsize = sizeof(struct sahara_ctx), + .cra_alignmask = 0, + .cra_module = THIS_MODULE, + .cra_init = sahara_sha_cra_init, + } + }, + .op = { + .do_one_request = sahara_do_one_request, + }, }, }; -static struct ahash_alg sha_v4_algs[] = { +static struct ahash_engine_alg sha_v4_algs[] = { { - .init = sahara_sha_init, - .update = sahara_sha_update, - .final = sahara_sha_final, - .finup = sahara_sha_finup, - .digest = sahara_sha_digest, - .export = sahara_sha_export, - .import = sahara_sha_import, - .halg.digestsize = SHA256_DIGEST_SIZE, - .halg.statesize = sizeof(struct sahara_sha_reqctx), - .halg.base = { - .cra_name = "sha256", - .cra_driver_name = "sahara-sha256", - .cra_priority = 300, - .cra_flags = CRYPTO_ALG_ASYNC | - CRYPTO_ALG_NEED_FALLBACK, - .cra_blocksize = SHA256_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct sahara_ctx), - .cra_alignmask = 0, - .cra_module = THIS_MODULE, - .cra_init = sahara_sha_cra_init, - } + .base = { + .init = sahara_sha_init, + .update = sahara_sha_update, + .final = sahara_sha_final, + .finup = sahara_sha_finup, + .digest = sahara_sha_digest, + .export = sahara_sha_export, + .import = sahara_sha_import, + .halg.digestsize = SHA256_DIGEST_SIZE, + .halg.statesize = sizeof(struct sahara_sha_reqctx), + .halg.base = { + .cra_name = "sha256", + .cra_driver_name = "sahara-sha256", + .cra_priority = 300, + .cra_flags = CRYPTO_ALG_ASYNC | + CRYPTO_ALG_NEED_FALLBACK, + .cra_blocksize = SHA256_BLOCK_SIZE, + .cra_ctxsize = sizeof(struct sahara_ctx), + .cra_alignmask = 0, + .cra_module = THIS_MODULE, + .cra_init = sahara_sha_cra_init, + } + }, + .op = { + .do_one_request = sahara_do_one_request, + }, }, }; @@ -1249,57 +1232,42 @@ static irqreturn_t sahara_irq_handler(int irq, void *data) static int sahara_register_algs(struct sahara_dev *dev) { int err; - unsigned int i, j, k, l; - for (i = 0; i < ARRAY_SIZE(aes_algs); i++) { - err = crypto_register_skcipher(&aes_algs[i]); - if (err) - goto err_aes_algs; - } + err = crypto_engine_register_skciphers(aes_algs, ARRAY_SIZE(aes_algs)); + if (err) + return err; - for (k = 0; k < ARRAY_SIZE(sha_v3_algs); k++) { - err = crypto_register_ahash(&sha_v3_algs[k]); + err = crypto_engine_register_ahashes(sha_v3_algs, + ARRAY_SIZE(sha_v3_algs)); + if (err) + goto err_aes_algs; + + if (dev->version > SAHARA_VERSION_3) { + err = crypto_engine_register_ahashes(sha_v4_algs, + ARRAY_SIZE(sha_v4_algs)); if (err) goto err_sha_v3_algs; } - if (dev->version > SAHARA_VERSION_3) - for (l = 0; l < ARRAY_SIZE(sha_v4_algs); l++) { - err = crypto_register_ahash(&sha_v4_algs[l]); - if (err) - goto err_sha_v4_algs; - } - return 0; -err_sha_v4_algs: - for (j = 0; j < l; j++) - crypto_unregister_ahash(&sha_v4_algs[j]); - err_sha_v3_algs: - for (j = 0; j < k; j++) - crypto_unregister_ahash(&sha_v3_algs[j]); + crypto_engine_unregister_ahashes(sha_v3_algs, ARRAY_SIZE(sha_v3_algs)); err_aes_algs: - for (j = 0; j < i; j++) - crypto_unregister_skcipher(&aes_algs[j]); + crypto_engine_unregister_skciphers(aes_algs, ARRAY_SIZE(aes_algs)); return err; } static void sahara_unregister_algs(struct sahara_dev *dev) { - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(aes_algs); i++) - crypto_unregister_skcipher(&aes_algs[i]); - - for (i = 0; i < ARRAY_SIZE(sha_v3_algs); i++) - crypto_unregister_ahash(&sha_v3_algs[i]); + crypto_engine_unregister_skciphers(aes_algs, ARRAY_SIZE(aes_algs)); + crypto_engine_unregister_ahashes(sha_v3_algs, ARRAY_SIZE(sha_v3_algs)); if (dev->version > SAHARA_VERSION_3) - for (i = 0; i < ARRAY_SIZE(sha_v4_algs); i++) - crypto_unregister_ahash(&sha_v4_algs[i]); + crypto_engine_unregister_ahashes(sha_v4_algs, + ARRAY_SIZE(sha_v4_algs)); } static const struct of_device_id sahara_dt_ids[] = { @@ -1388,15 +1356,17 @@ static int sahara_probe(struct platform_device *pdev) dev->hw_link[i] = dev->hw_link[i - 1] + 1; } - crypto_init_queue(&dev->queue, SAHARA_QUEUE_LENGTH); - - spin_lock_init(&dev->queue_spinlock); - dev_ptr = dev; - dev->kthread = kthread_run(sahara_queue_manage, dev, "sahara_crypto"); - if (IS_ERR(dev->kthread)) { - return PTR_ERR(dev->kthread); + dev->engine = crypto_engine_alloc_init(&pdev->dev, true); + if (!dev->engine) + return -ENOMEM; + + err = crypto_engine_start(dev->engine); + if (err) { + crypto_engine_exit(dev->engine); + return dev_err_probe(&pdev->dev, err, + "Could not start crypto engine\n"); } init_completion(&dev->dma_completion); @@ -1436,7 +1406,7 @@ static int sahara_probe(struct platform_device *pdev) return 0; err_algs: - kthread_stop(dev->kthread); + crypto_engine_exit(dev->engine); return err; } @@ -1445,8 +1415,7 @@ static void sahara_remove(struct platform_device *pdev) { struct sahara_dev *dev = platform_get_drvdata(pdev); - kthread_stop(dev->kthread); - + crypto_engine_exit(dev->engine); sahara_unregister_algs(dev); }