Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp121758pxa; Wed, 26 Aug 2020 06:28:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDJO3iVPDjviUELYytemchW4Q1zgK2zqdIC2L5IyQgdFIe0Zg5/ToS8uOF784tYXE0U9pJ X-Received: by 2002:a05:6402:2212:: with SMTP id cq18mr15107265edb.34.1598448536628; Wed, 26 Aug 2020 06:28:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598448536; cv=none; d=google.com; s=arc-20160816; b=Swm57/n+fXl4HRVPgTuqZr/ghto2t0INvQDRzeaVRUhxiow2Bi9VIdspRZaSNtfyrc NKSDcU2QiVIXW6Am024wCkqcoD/EHbN1ECykkIFg7ZrqrLdDnV52rZnKX25G5ErfdRqj waVp+3zmq2VAIY/lWfW7K/0pKPnoJFT8x6FmfflfcOSTVtqEba7bYhnwpslEiNG63PZ3 0VioNqaZpJotTahe6wfg8sc8ALvqS6x72J38FbwPRwLeufwg2NgfS4ye0QNuuSI4oqKp eHLKQPH1wQL4Dx1x6TBT/OVdJH1dhochHLaf4u9hZmRwVmD6BAkoI5RPXXtXjFxBgtDZ q9ng== 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=GXD+w9Y3wUdFkrAipgBiJuVffVg3UlyXwVKrdNA82vA=; b=lGdYLCta8JfcEUPm/VV80dpLEPSD8TWqy5m+zPyC3+Z928vfWbpoOlEKY5GaGcGNRq MjzcaN/4zmCaR+PsjxxUhPL6n3+I1FXZpmSmAf9mtWbZVJtLvmiQ0WEaBu0viFZLxw26 0CnR3IkNBkFInewaYrRhy4nxQh8H+ENox4EVS2v7nw2TUyVHcIM/0qwBqsNbznJaQEkh ZEBUREWs/jQCAGX0IwfWHG9oqwHbWB1XVIx9a2CTycodIa/KwQD5kg/YNMH9f/bTHrnr 1QOCfqC5RzF1dJKTQ1y04u2sFmv7hoEVeXa62j3M4gxvPdKFXH+HdV4T+emAMuyN3Wt4 eBaw== 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 u6si1581287ejc.54.2020.08.26.06.28.31; Wed, 26 Aug 2020 06:28:56 -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 S1730210AbgHZNZG (ORCPT + 99 others); Wed, 26 Aug 2020 09:25:06 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:38111 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728132AbgHZNZF (ORCPT ); Wed, 26 Aug 2020 09:25:05 -0400 Received: by mail-lf1-f67.google.com with SMTP id k10so977456lfm.5 for ; Wed, 26 Aug 2020 06:25:04 -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=GXD+w9Y3wUdFkrAipgBiJuVffVg3UlyXwVKrdNA82vA=; b=YtHZsfnaWWCyhkkf+J7Jgm9BKptbAUuKVU+uO4pob/ELgJ56DoT9nwTa30iFIAO4bV DgROp/Mz2vNFhT4c5X4628U4r3rF7OctSgLs0SARz7r5VwGrQlBl6wur4bztElBiN4de hxPjprQIHoBiOBqk0T2rR12b6JJR+46cEHHkDpJtxqw5r+jQvQJMbcY2Vs2jIZj0ss45 2QozetMAOmO1H9kXt3VYbqHWzDpfyeWMbDWmxZPPaTCCy4NmQWGFi/wxqyyMjQNE6Hhp tVv7lgQO3thJR67JuEEr6MlUgA/pcPPUwKnMJJnVVLkMEvSbxD+bTQ+QBZ9uLpoKruP/ kc8w== X-Gm-Message-State: AOAM533gUnzoAgK03cAzDXt453keUIaJtljMUKYG3eWd9jZbUrcnEpN6 AfniiH/ktszRtBAGIsXsmNXYmI93u54= X-Received: by 2002:a05:6512:3189:: with SMTP id i9mr4732243lfe.41.1598448301710; Wed, 26 Aug 2020 06:25: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 i26sm506856ljj.102.2020.08.26.06.25.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2020 06:25:00 -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-ss - use kfree_sensitive() Date: Wed, 26 Aug 2020 16:24:51 +0300 Message-Id: <20200826132451.398651-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-ss/sun8i-ss-cipher.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c index 7b39b4495571..49d89b31eb6b 100644 --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c @@ -369,8 +369,7 @@ void sun8i_ss_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(op->ss->dev); @@ -394,8 +393,7 @@ int sun8i_ss_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); @@ -420,8 +418,7 @@ int sun8i_ss_des3_setkey(struct crypto_skcipher *tfm, const u8 *key, } 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