From patchwork Wed Apr 29 23:51:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Kossifidis X-Patchwork-Id: 6299281 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@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 249999F373 for ; Wed, 29 Apr 2015 23:52:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 475002017D for ; Wed, 29 Apr 2015 23:52:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D44920160 for ; Wed, 29 Apr 2015 23:52:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751900AbbD2XwX (ORCPT ); Wed, 29 Apr 2015 19:52:23 -0400 Received: from mail-ie0-f174.google.com ([209.85.223.174]:33315 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751871AbbD2XwU (ORCPT ); Wed, 29 Apr 2015 19:52:20 -0400 Received: by iecrt8 with SMTP id rt8so55310091iec.0 for ; Wed, 29 Apr 2015 16:52:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QA/7u+CaYDzNedKq/rqE/iv9xNGojG0pQalHTjRsEco=; b=ShWKxvcWoWF0FUOZsiAuv6zksEQ1IDG2kPNPF7WdYI+PEy4nCC/Hit5atyM5VBC3Rl 1SrRDN+2N0Bg5Vw8aa0jkYcvKlcdE3Tw1uZYOPHOBuZ8KsycVyXK5MXpAqs8Iggi0ILo Gh1zCkdbip3AZuCoz6uEot13OHx3JVQwMwWhFcnuqqsr+mamAEPuw5Eavj6aufv7QULn VS+HdwjJCP2m3ynmIjMAjUcqEium7URqmew/0pAbxQzE4jBi3vpc6VOk1o7d5CRzODop 7VjKNdEUpRXTBbKee8mq6A18QF8GO35x2G67L/JDFYNQVmCmmr55U9kcdPtrS09IH5iV lDyQ== X-Received: by 10.107.18.170 with SMTP id 42mr2205395ios.38.1430351540277; Wed, 29 Apr 2015 16:52:20 -0700 (PDT) Received: from cobra (rochester-wireless-nat.mayo.edu. [129.176.197.220]) by mx.google.com with ESMTPSA id j4sm10214207igm.21.2015.04.29.16.52.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Apr 2015 16:52:19 -0700 (PDT) Received: by cobra (sSMTP sendmail emulation); Wed, 29 Apr 2015 23:52:18 +0000 From: "Nick Kossifidis" To: kvalo@codeaurora.org, ath9k-devel@qca.qualcomm.com Cc: linux-wireless@vger.kernel.org, ath9k-devel@lists.ath9k.org, adrian.chadd@gmail.com, Nick Kossifidis Subject: [PATCH 10/11] ath9k: Mix the received FFT bins to the random pool Date: Wed, 29 Apr 2015 23:51:21 +0000 Message-Id: <1430351482-59418-11-git-send-email-mickflemm@gmail.com> X-Mailer: git-send-email 2.3.5 In-Reply-To: <1430351482-59418-1-git-send-email-mickflemm@gmail.com> References: <1430351482-59418-1-git-send-email-mickflemm@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, 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 E/M noise is a pretty good source of entropy so we mix the FFT measurements of the E/M spectrum to /dev/random pool. Note that this doesn't increase the pool's entropy count but it still helps on improving the output of /dev/(u)random. Signed-off-by: Nick Kossifidis --- drivers/net/wireless/ath/ath9k/common-spectral.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net/wireless/ath/ath9k/common-spectral.c index 5840b37..a876271 100644 --- a/drivers/net/wireless/ath/ath9k/common-spectral.c +++ b/drivers/net/wireless/ath/ath9k/common-spectral.c @@ -15,6 +15,7 @@ */ #include +#include #include "ath9k.h" static s8 fix_rssi_inv_only(u8 rssi_val) @@ -647,13 +648,24 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_h tsf, freq, chan_type); memset(sample_buf, 0, SPECTRAL_SAMPLE_MAX_LEN); + + /* Mix the received bins to the /dev/random + * pool + */ + add_device_randomness(sample_buf, num_bins); } /* Process a normal frame */ - if (sample_bytes == sample_len) + if (sample_bytes == sample_len) { ret = fft_handler(rs, spec_priv, sample_start, tsf, freq, chan_type); + /* Mix the received bins to the /dev/random + * pool + */ + add_device_randomness(sample_start, num_bins); + } + /* Short report processed, break out of the * loop. */