Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp122328pxa; Wed, 26 Aug 2020 06:29:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJBdlC+ZiThUElZ0S0YUrf/sYV2eN3oObTb8E3dAvR7FpiofVyJW6LGLvEL8fgHdBD+kvG X-Received: by 2002:a17:906:4887:: with SMTP id v7mr15095497ejq.282.1598448592014; Wed, 26 Aug 2020 06:29:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598448592; cv=none; d=google.com; s=arc-20160816; b=llbYtMvDRQZx391RdtfpVYrGj7oWUB4KFWu/dwzpXLoXGEnggI4j08Ep+CGkdWQD1g RGk71G+I41KHIHyHWzxg5/EAE+Q+UNcUkWpvKwgOfTmra0M6tS+axUGFVu0AbFL9V+pz 1kb2MAEp8F9A3lusE7+0OQq9NqJq4WKiysm6rh9GZ+LMEzCfvRwpNgKpn8gsErqpEw6j Nm9a6sS1moUNneNicsOQN429Wp+4aoyCweyprweqBI+hMJnciU8XGbRkEVgPsriY0EVa VxeFIb7+NQDkk7uNsQ02jervtAddKohobaNVmeUy21UPKTXfKIYYdv+ekRB3KF9AO4av dQFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Rkb8UGFOuSR99GBMzJc4tfKvf9BH0mXjbOlM0/9ubsU=; b=KY8iG6C++mYLxKeOvvAIvD2L45G/3IZC9vuCcPwrC/M2mRYOU5BKHip/HxalqEGuoR DyCVX1jqxd9OW5lcyLr+CsRFbBEvVubF2GMz7eR/vW+ruG2HHGQR2zhQOLg+1NSy5ppd ZnmXaqutHtUeFsJF6kHNH3RCpS0cklBM2HpoOw4b8ayOq/nurPomDLsOLt4oAnETdHXZ quQRVrmNhtDralMGLxDu1bkfXSx2mc04iypEXo+UJlfQw1bIUpb2w8fK+EzvJB8gJifn P8MkurGk3YOjsw/23Mx8gwEv6/AkW47/SLAre5u66pJ70S0dfqLKd85XD5vhSJt1nmyu QcfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f19si1352485eds.21.2020.08.26.06.29.27; Wed, 26 Aug 2020 06:29:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729334AbgHZNZr (ORCPT + 99 others); Wed, 26 Aug 2020 09:25:47 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:39165 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728132AbgHZNZq (ORCPT ); Wed, 26 Aug 2020 09:25:46 -0400 Received: by mail-lj1-f194.google.com with SMTP id v9so2341174ljk.6 for ; Wed, 26 Aug 2020 06:25:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Rkb8UGFOuSR99GBMzJc4tfKvf9BH0mXjbOlM0/9ubsU=; b=V7ap62wvsXFqM4kXUawF/XtScohWFcyDX9iHw8sUScSJXCKrUd85ddNf9CW3KfniVk LAMJ2RfLtKtD0SyUsa90dVGe8W777iJw26QONXc9pzvOUM/8138aHJYi220dsoQA7ip1 KIzDFFcVctwwnaVnHFGvF/MdtrBlPdYwwH/cOZhZaMa9r1sm1sCq8DFc//66mzJQMFvh 9TrfwsY+5hSkYDJZab1MRdIKFNrzKUYo94LxIIb1wem5hL3eX/8k7uHYmozmRbNNrtZm p7pcqqjVGzjmEEtCdapF1t5roE8Y0zFbPRLuwx/a+/kq1fRhZ0rfk878BkTraWYt6aEi Kx5Q== X-Gm-Message-State: AOAM532N5f6lhh4qM/ZuOmfQm5ucd8RObbq+19pim1dNfVEjMSyk+5Fp LtgES8wb0oKVjZ91xudM4+FWdCnpX8E= X-Received: by 2002:a2e:98d7:: with SMTP id s23mr6398726ljj.117.1598448343537; Wed, 26 Aug 2020 06:25:43 -0700 (PDT) Received: from localhost.localdomain (broadband-37-110-38-130.ip.moscow.rt.ru. [37.110.38.130]) by smtp.googlemail.com with ESMTPSA id v10sm573402lfo.11.2020.08.26.06.25.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2020 06:25:43 -0700 (PDT) From: Denis Efremov To: linux-crypto@vger.kernel.org Cc: Denis Efremov , Corentin Labbe , Herbert Xu , "David S. Miller" Subject: [PATCH] crypto: sun8i-ce - use kfree_sensitive() Date: Wed, 26 Aug 2020 16:25:37 +0300 Message-Id: <20200826132537.398778-1-efremov@linux.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Use kfree_sensitive() instead of open-coding it. Signed-off-by: Denis Efremov --- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c index b4d5fea27d20..970084463dbb 100644 --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c @@ -367,8 +367,7 @@ void sun8i_ce_cipher_exit(struct crypto_tfm *tfm) struct sun8i_cipher_tfm_ctx *op = crypto_tfm_ctx(tfm); if (op->key) { - memzero_explicit(op->key, op->keylen); - kfree(op->key); + kfree_sensitive(op->key); } crypto_free_skcipher(op->fallback_tfm); pm_runtime_put_sync_suspend(op->ce->dev); @@ -392,8 +391,7 @@ int sun8i_ce_aes_setkey(struct crypto_skcipher *tfm, const u8 *key, return -EINVAL; } if (op->key) { - memzero_explicit(op->key, op->keylen); - kfree(op->key); + kfree_sensitive(op->key); } op->keylen = keylen; op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA); @@ -417,8 +415,7 @@ int sun8i_ce_des3_setkey(struct crypto_skcipher *tfm, const u8 *key, return err; if (op->key) { - memzero_explicit(op->key, op->keylen); - kfree(op->key); + kfree_sensitive(op->key); } op->keylen = keylen; op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA); -- 2.26.2