summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ath/ath9k/common-spectral.c
diff options
context:
space:
mode:
authorNick Kossifidis <mickflemm@gmail.com>2015-04-29 23:51:21 +0000
committerKalle Valo <kvalo@codeaurora.org>2015-05-09 16:46:18 +0300
commit2aa56cca3571fd08c0c38f3e2d4bb0bfb3def3c5 (patch)
tree09da61c650e82a2d6dca4b3cd4ad4a7c0304c07a /drivers/net/wireless/ath/ath9k/common-spectral.c
parent3ea2ce3f7e63728b97fb52be4034ba3d8f5ddba5 (diff)
ath9k: Mix the received FFT bins to the random pool
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 <mickflemm@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/common-spectral.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/common-spectral.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net/wireless/ath/ath9k/common-spectral.c
index 5840b3731d5b..a8762711ad74 100644
--- a/drivers/net/wireless/ath/ath9k/common-spectral.c
+++ b/drivers/net/wireless/ath/ath9k/common-spectral.c
@@ -15,6 +15,7 @@
*/
#include <linux/relay.h>
+#include <linux/random.h>
#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.
*/