Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp114502pxa; Wed, 26 Aug 2020 06:18:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzY5Vcvpd9jM6Tu32e5SE7/b238JvfXaUUDsNRhvO2Il6x9x04ITDSOlfe3dwO7n9Ui0rQ X-Received: by 2002:aa7:d955:: with SMTP id l21mr15302880eds.343.1598447885731; Wed, 26 Aug 2020 06:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598447885; cv=none; d=google.com; s=arc-20160816; b=uDIGNeNKOCIU6vQ1lHkUi/epmPQdqLUqsKgdlVYSwwJFfoMKIiYNn4zEl+zgoHLJMS vQkTE66eqEVeUlTwb6/aJLyYcFqTaPgzFmAlv3Zy3tAtu+lnR2pv9GqCwUubiFUekHWt H3RVJ4PSMGbC7mANOLC0inJ0m/0f7pW4jRIR2Vj9N/FWD0N3wsmzXLXN5NiBBhZuj671 yJMZHjtEpUjk/lGuyNKoIYBUGFgkYFvYkaHwtIWIoihLOSEijA2ht4vnv7L7ouffzOnX XE23MgHoSVp2WvVR6lYTpCTkSU5WbUTDRuXRms+VcKBGD/49miEdcC6vcD/PASTLBikb weKQ== 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=vU/nQo+UBNG9xvKd9GuEpi2FmWTAJodJN80NdTSBLAk=; b=kN7nUwBBdI3Wun/Ab8nq35Hzs03owhIB3I9zCw6PRsplG7dFyLPjyOQ/Sv5SM7ANpT /KHtcOw09GqbvQy6+j1Y+OwUXZNo0DY0zWE80MnL7ASuFZZkcDYnMaWCR4D3jcAncd3I YQsEDvFNoPvHcxinTnwt2kFOjQwN9Ho8JqPULp7+yWB0DYJkV8WawJsdGYkeQeAgVOSB Uj6H4JxATskNzuJ6saYz0rLhNtWi2odgGmv1pcBEuiZ2qGflTtej6SfWigxHnu9FIZ9r Yjz6FTebKR71S/BbRDj1CF5nEsTHCySKDiuOH6Td37+ZqYiGeTfGEiVRaI2TkvGmLE1G M/PA== 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 b6si1497828ejb.68.2020.08.26.06.17.39; Wed, 26 Aug 2020 06:18:05 -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 S1728132AbgHZNRF (ORCPT + 99 others); Wed, 26 Aug 2020 09:17:05 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:37783 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729177AbgHZNRE (ORCPT ); Wed, 26 Aug 2020 09:17:04 -0400 Received: by mail-lj1-f193.google.com with SMTP id w14so2317761ljj.4; Wed, 26 Aug 2020 06:17:02 -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=vU/nQo+UBNG9xvKd9GuEpi2FmWTAJodJN80NdTSBLAk=; b=RcwuyWIef/Gt4ktGODHegTfBG33CSLzdiIcLnJOlH7LU/w6HDbC8xNHQ/RFczUqRhT 6MqKlpU7s97d7AiekXg23QuheGTPO3QXKK/AQrFtX1ajv74ovFprZF/B9JOuIa9bc+h8 ZLE2bqw2Re1SjHE8/YAkcTqXALSBvwQi4fWHkN2jdpSfAympAohm4/4KS5y2EIFmVUrq DtVnETyAxU3crAwQjgvji2xkdLVoZl/N+54Z7v4hmBspKjCteNGzqVjs9p4/aQN0UwLm AfV/qfnqqR9GvRY4/aq2Vp+EXt3l6HDNBoySrvEBzxr/cTj4v/7yLTRvUeglB+n6+Cex +vcg== X-Gm-Message-State: AOAM530dtR87XfEYg8GYfRqAg75Cmw7LU/2sp/PJpSyBkLddjAFsQgKC IeojRspkEHMXFuNrbtlAKFHV+aFWurI= X-Received: by 2002:a05:651c:152:: with SMTP id c18mr6508091ljd.15.1598447821446; Wed, 26 Aug 2020 06:17:01 -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 u19sm496556ljj.128.2020.08.26.06.17.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2020 06:17:00 -0700 (PDT) From: Denis Efremov To: linux-crypto@vger.kernel.org Cc: Denis Efremov , Corentin Labbe , Herbert Xu , "David S. Miller" , linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] crypto: amlogic - use kfree_sensitive() Date: Wed, 26 Aug 2020 16:16:57 +0300 Message-Id: <20200826131657.398090-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/amlogic/amlogic-gxl-cipher.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/amlogic/amlogic-gxl-cipher.c b/drivers/crypto/amlogic/amlogic-gxl-cipher.c index d93210726697..f3dca456d9f8 100644 --- a/drivers/crypto/amlogic/amlogic-gxl-cipher.c +++ b/drivers/crypto/amlogic/amlogic-gxl-cipher.c @@ -341,8 +341,7 @@ void meson_cipher_exit(struct crypto_tfm *tfm) struct meson_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); } @@ -368,8 +367,7 @@ int meson_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); -- 2.26.2