• Miaoqing Pan's avatar
    ath9k: feeding entropy in kernel from ADC capture · ed14dc0a
    Miaoqing Pan authored
    This patch is derived from
    commit 6301566e ("ath9k: export HW random number generator"),
    
    We evaluated the entropy of the ADC data on QCA9531, QCA9561, QCA955x,
    and AR9340, and it has sufficient quality random data (at least 10 bits
    and up to 22 bits of min-entropy for a 32-bit value). We conservatively
    assume the min-entropy is 10 bits out of 32 bits. Thus, ATH9K_RNG_BUF_SIZE
    is set to 320 (u32) i.e., 1.25 kilobytes of data is inserted to fill up
    the pool as soon as the entropy counter becomes 896/4096 (set by random.c).
    Since ADC was not designed to be a dedicated HW RNG, we do not want to bind
    it to /dev/hwrng framework directly. This patch feeds the entropy directly
    from the WiFi driver to the input pool. The ADC register output is only
    used as a seed for the Linux entropy pool. No conditioning is needed,
    since all the conditioning is performed by the pool itself.
    Signed-off-by: default avatarMiaoqing Pan <miaoqing@codeaurora.org>
    Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
    ed14dc0a
rng.c 2.68 KB