From patchwork Mon Nov 14 19:02:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Cope X-Patchwork-Id: 9428275 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 04474602F0 for ; Mon, 14 Nov 2016 19:11:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED031289D4 for ; Mon, 14 Nov 2016 19:11:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E05FD28ABE; Mon, 14 Nov 2016 19:11:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 695AE28AA4 for ; Mon, 14 Nov 2016 19:11:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934469AbcKNTLC (ORCPT ); Mon, 14 Nov 2016 14:11:02 -0500 Received: from mail-pg0-f52.google.com ([74.125.83.52]:35844 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933387AbcKNTLA (ORCPT ); Mon, 14 Nov 2016 14:11:00 -0500 X-Greylist: delayed 439 seconds by postgrey-1.27 at vger.kernel.org; Mon, 14 Nov 2016 14:11:00 EST Received: by mail-pg0-f52.google.com with SMTP id f188so56957804pgc.3 for ; Mon, 14 Nov 2016 11:11:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=GbeLt5Y41cCUJZvMiYETQAgw0UKfqunaiaw+h5JlAdQ=; b=ouCu5wBUzbFTp4lhbtIQyjYdjyXSWbBYPRFvn8f3OUNDLgRCp6UNssnJA6tKEfB9cZ hyW2xAO4aNWQrshCBP2blm/5aSqUW8/4+cqsgdOt52GxQi/WRvYX0Eh+47l27LydiXOC T3Yk8n1UhzhxAmE05wvSrvmIP2kUByW05f3Ovz7TqZDfwSAY4KRCYOPiVbejfeq5cMz1 /3B8YneZpk5UPIh2Z+UMFQMPGwOVqlVCSCBtlDDGltV8qBr7bozcd1ya1WpjGNn6YYJq mfOpSTr5CMChm4cYLSzooSlMvI5tn7Qd3KPnuUofOexeCMdY5xpW3HXegSLvKJYjZpwZ F+hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=GbeLt5Y41cCUJZvMiYETQAgw0UKfqunaiaw+h5JlAdQ=; b=krbKxwRHrQDnJEuSfjwg9ExYmgZYYYdzCB2myTQP/VHTEdNCo+mMutCpn0qX4BxOfx NnEJKi3vipD2Izak36AJ072QbXs/hu7V1hy77XYAda8vE/2fdW9zkdOzyqO0sCkwigi7 9d4SxtFh07hBd0AJd0El7Y7+Q14BoOQ0vMZCEizh2X8Cs+MvuW3u6nvuK1Xp1zCwJIj2 +dKtViUfhiJxba4iQ+GS77YnyX4V1N1OEhuo+0NIIlketXACblHIPX8jHm5SJa3IeKsG wv054TPJIRKIfz35D29uy0hDn634NtwtSuI69ytMk7TtD4o4IzFAXm1jQHAYzA+onA6L m52Q== X-Gm-Message-State: ABUngvf0pMsyp/hX5OF3kD8k76MCO1OKzMQQgDOwmxwAkZzOkMB1zpsmECnrGqrtqVngcdCG X-Received: by 10.98.41.3 with SMTP id p3mr224604pfp.22.1479150215437; Mon, 14 Nov 2016 11:03:35 -0800 (PST) Received: from alexcope-linuxxworkstation.kir.corp.google.com ([172.23.164.32]) by smtp.gmail.com with ESMTPSA id xi6sm24334561pab.5.2016.11.14.11.03.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Nov 2016 11:03:35 -0800 (PST) From: Alex Cope To: linux-crypto@vger.kernel.org Cc: Alex Cope , Eric Biggers Subject: [PATCH] crypto: gf128mul - Zero memory when freeing multiplication table Date: Mon, 14 Nov 2016 11:02:54 -0800 Message-Id: <1479150174-128347-1-git-send-email-alexcope@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP GF(2^128) multiplication tables are typically used for secret information, so it's a good idea to zero them on free. Signed-off-by: Alex Cope Signed-off-by: Eric Biggers --- crypto/gf128mul.c | 4 ++-- include/crypto/gf128mul.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto/gf128mul.c b/crypto/gf128mul.c index 5276607..0594dd6 100644 --- a/crypto/gf128mul.c +++ b/crypto/gf128mul.c @@ -352,8 +352,8 @@ void gf128mul_free_64k(struct gf128mul_64k *t) int i; for (i = 0; i < 16; i++) - kfree(t->t[i]); - kfree(t); + kzfree(t->t[i]); + kzfree(t); } EXPORT_SYMBOL(gf128mul_free_64k); diff --git a/include/crypto/gf128mul.h b/include/crypto/gf128mul.h index da2530e..7217fe6 100644 --- a/include/crypto/gf128mul.h +++ b/include/crypto/gf128mul.h @@ -177,7 +177,7 @@ void gf128mul_4k_bbe(be128 *a, struct gf128mul_4k *t); static inline void gf128mul_free_4k(struct gf128mul_4k *t) { - kfree(t); + kzfree(t); }