Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp127913pxa; Wed, 26 Aug 2020 06:37:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbiwKuiBPj/qQRCVGYUO36z3jBrDA7dvXqToNXpfuiQu6bOQdgYN+reaB9rJBDq0eXdmmk X-Received: by 2002:a05:6402:16:: with SMTP id d22mr15499052edu.175.1598449059790; Wed, 26 Aug 2020 06:37:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598449059; cv=none; d=google.com; s=arc-20160816; b=fL7bM1Z45CG3X/f0xlc/unJTeB6DHqtG4s/Pdz4djXhY412HpBrKqxxJ7N+lvV6Ufh kaVSTEtYQ3MJSFcrHRkrZ68KLSD39zpH7sHW1HmTuUvlOIGK/UT5Kd6KXDOUrgAE+FgJ f9kmIx0rqYPgwD1aNIYv8/QhQCM+IHC1Wv89bzyoy7A1TQl29f6Zfak6ubw8Qkvn8T3r FrAIlm9VKX7eWqszFT3D7J1emRZCJ5dVvm3btxuebngnPpygeeGevz2fV9UAiMwhxIUL PNDGx7KEC17dtboYvE/RRDrdzNWTl8BbcDJYqs1apa76bZ5eomPSdQ8k2aYOIiZBTsh2 cXSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Qkwmqsb9KNID3kuoDaGDi9EOhJccN3wgQwnGBmSQOw4=; b=gKOTa9yHCGkWWrIB8O5pyBUU5iRxroeNmtxuG5NbSiHryeo+4fvEaSCeLmr99+vmYz +Dkfv7EZtU8TEFD5yc7aaKm5OQhulHy1bRvX8UDRYTZ2oCoMMOMvWJ5ORZVNNiwhkH02 jncvQcqHQtRgWU92Bjz6kHVXB8wC1br5FV9bRpGSGUEEWugmKKDPAqqJow5OlVc76cyY DvVGkeVTP+OHo63E5EyTcFLUSRanve/VXc4l6hQpavNHZGKbD38O/kJjvpBxO3fnz7l+ Rol+kSFoqJFm5iF7aoxoWKwIKX4ySKvtAxwlWr1lsrnJ7ereUFDiTLw9KsQKAOoscTWF qF7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Dquuv/Vo"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f9si1767403ejl.476.2020.08.26.06.37.14; Wed, 26 Aug 2020 06:37:39 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Dquuv/Vo"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729540AbgHZNg2 (ORCPT + 99 others); Wed, 26 Aug 2020 09:36:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728276AbgHZNgZ (ORCPT ); Wed, 26 Aug 2020 09:36:25 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6447FC061574 for ; Wed, 26 Aug 2020 06:36:25 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id h15so1817698wrt.12 for ; Wed, 26 Aug 2020 06:36:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Qkwmqsb9KNID3kuoDaGDi9EOhJccN3wgQwnGBmSQOw4=; b=Dquuv/Vo7kS5gDZVKUxpsTfJuw8OVOczL99h9XKp66W7hGDoEqT+FsEeLQNhi9NYjK hmF58k+rCtuNL2bK7D0MZZ5Nfar/9OTs4VTLpRIY3gaBNJCvO/A9MCp0D5p0O9Kpoy3n 6SCIj9hXene3CVppJb8RPa+5vKAB+1itsVfNgwBrsl24/Z6j5bXISUVXzP1FQKSzLJM3 dDrNU/xTBDLCa+mSwG5aQOORDuYKqXowVEwRgUXiTcWh1E/lZuBKx1UYtzssXwIBFZ5x KsgmWMh/1htY8IaRsh0sDi40PDXu5nTyVg1xQEoRUqJw0emdQZq0SzBb5ey15dsio8Vz rGmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Qkwmqsb9KNID3kuoDaGDi9EOhJccN3wgQwnGBmSQOw4=; b=QnIUjNnaUypFTC33NtsnH7Pq2z8vKHI4HOupqHHXdnfGU3EoSog88dzDSOTrcmsFHt iFSB9g1wYI4X2x6Wc/w5+HNm4IMSqzAJJSG5QFndgtvxzFi4LY+0ALxLF63PVtH27Vly ycrfdvNAXcVU4ndibO3J+ejxm5qvxZETAfjXsYOJyyPATmb3wEZ+a4DcX7SgkJKjKNMa EZPBf1SKE4TBE4JjxY5soWofaGNG8cKcQqDaGc5UHA6d9npzrQI6I4ueZEsuRlRwuCoS q7tutL38noH5aCubH0TEO3jJ76zv6Tpg8r7aA9yu4Kbgnj/v84+GhiZ7ki5j5VqeJFdn quAg== X-Gm-Message-State: AOAM533es0EBJtsVdS7p94s569ss0b7ZTQbQd5VLt9txnmY87bhL6SUU FF9gXSt2IfWTZTNlFK1GtvM= X-Received: by 2002:adf:e9cb:: with SMTP id l11mr11630667wrn.379.1598448984075; Wed, 26 Aug 2020 06:36:24 -0700 (PDT) Received: from Red ([2a01:cb1d:3d5:a100:264b:feff:fe03:2806]) by smtp.googlemail.com with ESMTPSA id f16sm5893730wrw.67.2020.08.26.06.36.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2020 06:36:23 -0700 (PDT) Date: Wed, 26 Aug 2020 15:36:21 +0200 From: Corentin Labbe To: Denis Efremov Cc: linux-crypto@vger.kernel.org, Herbert Xu , "David S. Miller" Subject: Re: [PATCH] crypto: sun8i-ce - use kfree_sensitive() Message-ID: <20200826133621.GC13819@Red> References: <20200826132537.398778-1-efremov@linux.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200826132537.398778-1-efremov@linux.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Aug 26, 2020 at 04:25:37PM +0300, Denis Efremov wrote: > 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 > Hello Same problem than amlogic and sun8i-ss. Please remove if (op->key) Regards