From patchwork Tue Jan 16 09:44:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gaurav Jain X-Patchwork-Id: 188474 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp147556dye; Tue, 16 Jan 2024 01:47:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IEunmFjfbTVg8ukqApCqdGdt1A+L9qCRwDZophESGzBd0shmPYPODEdoAVIpmvGPAEGMrhw X-Received: by 2002:aa7:c3d8:0:b0:557:16e9:487b with SMTP id l24-20020aa7c3d8000000b0055716e9487bmr3167123edr.44.1705398437234; Tue, 16 Jan 2024 01:47:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705398437; cv=pass; d=google.com; s=arc-20160816; b=K95d7+5IBTV4oqs5AYDIXKI+Uq88U1G9+SQb6ZnEDBdrfsbTriXaNS7KsQw61ZtcXb lROVlalSKNwQclA1+FDz2YsfUACPvcMrZs5dsrxA+W6J024E9kEEOBOjnIjDPwKE0NA3 3kZsE4d7wu5yzwL0imW2U+3wt52Z8B2W6bZXBxHUIdfZIdB+KTTkL7pgL8xIjsHxDyz4 rIwK4c0gjElWD9TEsysasdE0gUw2BAahj1j9+Q8wmX+r6o9a85Hd81zS0Oi+aXIKVZol P941ps2TxlQa1H0o/iEjjUH2Q/fL85XLPIgwDAMGhiAt4fUiiH/KU5nqvK+XiBD3VF3+ PyTg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:message-id:date:subject:cc:to:from :dkim-signature; bh=atlg8dxnphJL9TCY0wetHzfuFq0SbE3ZSHivqTkOpEs=; fh=9/0PQoqBI6GX0Wchc9KBIURTMRtW8rv0w+c9l8c0PHg=; b=TgKgMdLHk/xTQZ5cWjgILy+9pJ50APGM+0ErISfS0vr/4kMOxwUEHV83UT3b9v1q0q FRAKFfrMR5aNssK+RgVhETW14qoiGnc3+zGV3pV5DJHahvdeT4+ocSj0q1KLr76Z6DvL BatH63+C2NxT25N6GrLtwdY8EuJHpVGlva9mjiKqAu1f+k9DDAOv6QiiXUFIBdr6Xgkn FfN1ZJGqrPHxCFw30x0D76lQf6gh/h5WboKv+PGX2zio/brXLyVbDUyWGDOYzf3VncXM 8YVXxzPJTicLNrAikpT0HdA8pl8B1RPAR6hXu4JWpHO6nDv/jxKUoavQmSNGkSVMnF/f dvsQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=CeSxxNMp; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel+bounces-27196-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27196-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id fk27-20020a056402399b00b00558266abe02si4985247edb.9.2024.01.16.01.47.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 01:47:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27196-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=CeSxxNMp; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel+bounces-27196-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27196-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 79B681F230BF for ; Tue, 16 Jan 2024 09:47:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3946313AFA; Tue, 16 Jan 2024 09:44:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="CeSxxNMp" Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2089.outbound.protection.outlook.com [40.107.22.89]) (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 D33D4134D7; Tue, 16 Jan 2024 09:44:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PrC56yTD6pbnbKRp8Edv5mEPhVaGo0tHnPqbXkx1ePg112cOejfQmGq3Jr+7vxfICOu4mSaFQj6BheL9V4qESqY9BFKOH9EM4YxmXOTUR3tAzEzSjUZwh6wWbNMBkBYrp1hI3EIk0/CwYEOuIeTHlIwpt7RjqdMo0TUVFBjfkTZgtwhHng2VO1NmQzyaRi9/Gpwiz3tWQps4amkS8F3VW48gVHFyomjAS/SklcTpV98239PZNhDjby/QtO8F9axuhck0SqSc1CYJVjYjHDSJyd2pLXuDIuH5fVZrXT0uigwqhJKVU/l2SjMlx3dMYMYbpmvWsFR3OfDnunFmVYmPqA== 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=atlg8dxnphJL9TCY0wetHzfuFq0SbE3ZSHivqTkOpEs=; b=MoCp/joI1lcQ+PvwJ3/vI/cfLDpRSp9JH3/IN9cpYy1L2+saq1EkhhnqNdBKgp08Y9WRTkyCAx8Fyw9xRs+09xVKy60oi9WbJ4Gmm1QtDQO/xuLvhFy1A7t3/MWZPMDP/C6L56sh9OinsW/x/6pkj+E8DnyGfMTQcxcSOF530SmofAs755D/SPNXUk5ewkDzWx7rf4omraQYJ4niJfouLrT7xJ1jDWv2jaQHHDss27C38cIBcYgPxKiolNbaxknAEETUG8TnWKAaVGlwj6zBcltLjCsdrJk3txsjwXZzLVfsUZFMrsckV8qId41P1AN6qRwh8apTSaVczDSTD0H9pA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=atlg8dxnphJL9TCY0wetHzfuFq0SbE3ZSHivqTkOpEs=; b=CeSxxNMpH82SdCmPRc5lp0GMj9rHqZD4k4zfPOxq/agsagSPWH/czYuc5J3GQQG+R/MH3A2OP/7pPONHu/jo2Jx4p811f/vZVMuWvaJzmRLpOZguzzq2wDaLPE3gtQIpwZoRrWQPIuxZV+jGhtv5A9BnBAUC5usk++lwB7jLZW8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6004.eurprd04.prod.outlook.com (2603:10a6:208:11a::11) by AM9PR04MB8337.eurprd04.prod.outlook.com (2603:10a6:20b:3e8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.29; Tue, 16 Jan 2024 09:44:28 +0000 Received: from AM0PR04MB6004.eurprd04.prod.outlook.com ([fe80::72db:548e:8011:b12f]) by AM0PR04MB6004.eurprd04.prod.outlook.com ([fe80::72db:548e:8011:b12f%4]) with mapi id 15.20.7181.026; Tue, 16 Jan 2024 09:44:28 +0000 From: Gaurav Jain To: Herbert Xu , "David S . Miller" , Eric Biggers , Horia Geanta , Pankaj Gupta , Varun Sethi , Meenakshi Aggarwal , Aisheng Dong Cc: Silvano Di Ninno , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, Gaurav Jain Subject: [PATCH] crypto: caam/hash - fix asynchronous hash Date: Tue, 16 Jan 2024 15:14:05 +0530 Message-Id: <20240116094405.744466-1-gaurav.jain@nxp.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: SI1PR02CA0021.apcprd02.prod.outlook.com (2603:1096:4:1f4::14) To AM0PR04MB6004.eurprd04.prod.outlook.com (2603:10a6:208:11a::11) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6004:EE_|AM9PR04MB8337:EE_ X-MS-Office365-Filtering-Correlation-Id: db7e6c08-eabe-4a4c-9bae-08dc1677bb4a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jWqdXcRIxZJwQagwpydcWm8PWU3PRJA2Oap6h3qGB4/YnyOQB4Og27WxE/k0tN+1SHygd7MNqtGmMR52zKaH1n/G5Ud61fth2grBKIVkkE9tUkNZNzV0J6G5JJg2nw4iFLYjrvmPxw0K8EhkNQaGeTIVkgiXwiEaI+TZokXU+u1F3MUzEmP+qow0px19KftQxrHg33b4Fk5Ln7r0EcFMY1uYmObskfZxDV7OUOL29J8jiuJ+H5SL0GFQ1l+P2UWZPxz0YQL62f/WsUWHH+LN45abaFXcGtM7cOp7RMM9U5zzk+UVjD+vJkGxxTjdbdYWihcOlI3p1leuims3sx0jkhjT7/9/OPdGaOktYMIKoPefEwkFFUcizKuMVE1MAVl91efFOFccDfnUKqCEDrD3xCRHL5XQwv20QFUlwfa8TAUAckgcU4UdWA3CWMh8Ds4clU/9yPYD+PGHHhuqth3Z08BIFOF9YHg9azI7KrOsSFjMQ7951tlsd+c1M5cJjnuv+Zj9RjRQeALU7TkXXJYO55mSh9vuXDk1N+WC/lEwuYlk9DBVnCyvjHxQBMzroNEUCEcNSMFT+VZ2d1IhRct14JmXc5igaTqqZpK2JXgMcFQrLifsfY1ljpb8dT5rUn/r X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6004.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(376002)(39860400002)(366004)(136003)(346002)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(41300700001)(38100700002)(83380400001)(38350700005)(36756003)(86362001)(44832011)(110136005)(66946007)(316002)(54906003)(66476007)(66556008)(6636002)(8936002)(2906002)(4326008)(8676002)(5660300002)(2616005)(1076003)(26005)(6486002)(478600001)(52116002)(6512007)(6666004)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AFZpKaINR7bduMezTGwOpFeQYhsSxfDBHwFMSTI/e5qYzf8wPOlczWVZlR/AlrIiPheUqJG7gF7pPOHR40l+g0j18euVz3lCmsfL43t8PtbCGMGsIyXn0Hngn3jGSTT0F5ujTsa6JIs4mGZUadGbAkkewpElpvx5Bmfx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jvdO/2PmLMkjiUgVpmE9aHb9b6NbnZpkGKWZQfSF9tlqvORpVrevfw1hwuRpuo2C7GyTyEGLi7Cm3YHfEJIptc5zgMtGVM+hDfunP2ZJi1ebDQL+6sDnhfCTyigHS5L1bPLA67fsavmy+/QuLx706SNVXIBHNsRegQCwFuQGbMSGgJeAsNtAZODEa8UMVCdSq9BH3K2cfAp8/MvTMGnFAEcxNGt2lvd4vrtoK84BxMTOdpuun3AxNAPZWJiPnKzESRAXT18r54ahyYhtNA4YDaIYdgy50FugMbXUTpp81aNjgRjv7QMurHWsLlKdkzfo3fv9WwNMVVBLjoEWWZ9t51d3xSIZ3y X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: db7e6c08-eabe-4a4c-9bae-08dc1677bb4a X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6004.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2024 09:44:28.0733 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gIrFBVEBXdqgSmQ5nxqJekxw1BAmeAacBmm6mqgqL/Y3T1R3rmdct4VI21Z3MhNKnMYqiyh20s46flOJhWNNHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8337 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788239871689878250 X-GMAIL-MSGID: 1788239871689878250 ahash_alg->setkey is updated to ahash_nosetkey in ahash.c so updating the handling of setkey in caam driver. Fixes: 2f1f34c1bf7b ("crypto: ahash - optimize performance when wrapping shash") Signed-off-by: Gaurav Jain --- drivers/crypto/caam/caamalg_qi2.c | 4 ++-- drivers/crypto/caam/caamhash.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c index a148ff1f0872..93a400e286b4 100644 --- a/drivers/crypto/caam/caamalg_qi2.c +++ b/drivers/crypto/caam/caamalg_qi2.c @@ -4571,7 +4571,7 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm) ctx->dev = caam_hash->dev; - if (alg->setkey) { + if (crypto_hash_alg_has_setkey(halg)) { ctx->adata.key_dma = dma_map_single_attrs(ctx->dev, ctx->key, ARRAY_SIZE(ctx->key), DMA_TO_DEVICE, @@ -4611,7 +4611,7 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm) * For keyed hash algorithms shared descriptors * will be created later in setkey() callback */ - return alg->setkey ? 0 : ahash_set_sh_desc(ahash); + return crypto_hash_alg_has_setkey(halg) ? 0 : ahash_set_sh_desc(ahash); } static void caam_hash_cra_exit(struct crypto_tfm *tfm) diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index 290c8500c247..4d50356b593c 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c @@ -1804,7 +1804,7 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm) } else { if (priv->era >= 6) { ctx->dir = DMA_BIDIRECTIONAL; - ctx->key_dir = alg->setkey ? DMA_TO_DEVICE : DMA_NONE; + ctx->key_dir = crypto_hash_alg_has_setkey(halg) ? DMA_TO_DEVICE : DMA_NONE; } else { ctx->dir = DMA_TO_DEVICE; ctx->key_dir = DMA_NONE; @@ -1862,7 +1862,7 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm) * For keyed hash algorithms shared descriptors * will be created later in setkey() callback */ - return alg->setkey ? 0 : ahash_set_sh_desc(ahash); + return crypto_hash_alg_has_setkey(halg) ? 0 : ahash_set_sh_desc(ahash); } static void caam_hash_cra_exit(struct crypto_tfm *tfm)