From patchwork Wed Mar 11 06:45:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Mueller X-Patchwork-Id: 5982491 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E55119F318 for ; Wed, 11 Mar 2015 06:52:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 22D1D20328 for ; Wed, 11 Mar 2015 06:52:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 07AD12013A for ; Wed, 11 Mar 2015 06:51:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751198AbbCKGv5 (ORCPT ); Wed, 11 Mar 2015 02:51:57 -0400 Received: from mo4-p04-ob.smtp.rzone.de ([81.169.146.178]:41864 "EHLO mo4-p04-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751137AbbCKGv5 (ORCPT ); Wed, 11 Mar 2015 02:51:57 -0400 X-Greylist: delayed 376 seconds by postgrey-1.27 at vger.kernel.org; Wed, 11 Mar 2015 02:51:56 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1426056715; l=686; s=domk; d=chronox.de; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Date:Subject:Cc: To:From; bh=vVGNwYbeUyhi6N1kdrLxNpY8Guq6QOnXOESw4H0PqT8=; b=DcAyVNB2LUBcBh2Frwk9R9/mz10fpHRoF+YoTGYVLEglcVsWVwxWBMVmUeswz/YtYyT JMzv3aaXE4CAqgW+f1w07fbxzHtSNUUlLXxDLvJ3759H0tw/sd2yw7afyIv8VtxORXesY YJb1LxlI11vHUanVVKxw+sV/DO0s3+/VwV4= X-RZG-CLASS-ID: mo04 X-RZG-AUTH: :P2ERcEykfu11Y98lp/T7+hdri+uKZK8QS9ij0PRv0OgBX++LBHK3G42hzgr4 Received: from tachyon.chronox.de ([89.204.137.61]) by smtp.strato.de (RZmta 37.3 SBL|AUTH) with ESMTPSA id N079a2r2B6jbRtX (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate); Wed, 11 Mar 2015 07:45:37 +0100 (CET) From: Stephan Mueller To: 'Herbert Xu Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Subject: [PATCH] crypto: algif_rng - zeroize buffer holding random data Date: Wed, 11 Mar 2015 07:45:35 +0100 Message-ID: <7837811.JDlpL5zc04@tachyon.chronox.de> User-Agent: KMail/4.14.4 (Linux/3.18.7-200.fc21.x86_64; KDE/4.14.4; x86_64; ; ) MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Due to the change to RNGs to always return zero in success case, the RNG interface must zeroize the buffer with the length provided by the caller. Signed-off-by: Stephan Mueller --- crypto/algif_rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) } diff --git a/crypto/algif_rng.c b/crypto/algif_rng.c index 67f612c..a346173 100644 --- a/crypto/algif_rng.c +++ b/crypto/algif_rng.c @@ -87,7 +87,7 @@ static int rng_recvmsg(struct kiocb *unused, struct socket *sock, return genlen; err = memcpy_to_msg(msg, result, len); - memzero_explicit(result, genlen); + memzero_explicit(result, len); return err ? err : len;