Skip to content

airoha: reduce HWRNG quality - #21722

Merged
openwrt-bot merged 1 commit into
openwrt:mainfrom
abajk:airoha-trng-entropy
Jan 27, 2026
Merged

openwrt-bot merged 1 commit into
openwrt:mainfrom
abajk:airoha-trng-entropy

Conversation

@abajk

@abajk abajk commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

Backport a patch that reduces the quality of HWRNG. HWRNG has lower entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski [email protected]

@github-actions github-actions Bot added the target/airoha pull request/issue for airoha target label Jan 27, 2026

@merbanan merbanan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Backport a patch that reduces the quality of HWRNG. HWRNG has lower
entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: openwrt#21722
Signed-off-by: Hauke Mehrtens <[email protected]>
@hauke
hauke force-pushed the airoha-trng-entropy branch from ca1d166 to 5cd1769 Compare January 27, 2026 23:52
@openwrt-bot
openwrt-bot merged commit 5cd1769 into openwrt:main Jan 27, 2026
4 checks passed
@abajk
abajk deleted the airoha-trng-entropy branch January 28, 2026 00:00
@hailfinger

Copy link
Copy Markdown
Contributor

With these rngtest values, is it even appropriate to call it a random number generator?
Either the HWRNG is missing some initialization (see https://lists.infradead.org/pipermail/linux-arm-kernel/2021-February/640687.html for an example) or the quality is abysmally bad and the quality value should be reduced to something like 100.

@abajk

abajk commented Jan 28, 2026

Copy link
Copy Markdown
Contributor Author

With these rngtest values, is it even appropriate to call it a random number generator?

In fact, the samples look like real random data. It would require full NIST testing to confirm this.

Either the HWRNG is missing some initialization

It's hard to say how to fix it without knowing how it works inside. In the commit description, I saw that the noise comes from multiple sources, so it's probably not just the TERO loops.

@hailfinger

Copy link
Copy Markdown
Contributor

In fact, the samples look like real random data. It would require full NIST testing to confirm this.

If it can be compressed, it's not random. The rngtest results look more like a catastrophic failure.

Successes: 0
Failures: 10000

I get that when base64-encoding real random data, i.e. when there are only 6 bits of entropy per byte. For the HWRNG here, we only know the upper bound is roughly 7 bits per byte, but probably way less.

MattzFiber pushed a commit to MattzFiber/openwrt that referenced this pull request Feb 3, 2026
Backport a patch that reduces the quality of HWRNG. HWRNG has lower
entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: openwrt#21722
Signed-off-by: Hauke Mehrtens <[email protected]>
pesa1234 pushed a commit to pesa1234/openwrt that referenced this pull request Feb 5, 2026
Backport a patch that reduces the quality of HWRNG. HWRNG has lower
entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: openwrt#21722
Signed-off-by: Hauke Mehrtens <[email protected]>
lukasz1992 pushed a commit to lukasz1992/openwrt that referenced this pull request Feb 9, 2026
Backport a patch that reduces the quality of HWRNG. HWRNG has lower
entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: openwrt#21722
Signed-off-by: Hauke Mehrtens <[email protected]>
lukasz1992 pushed a commit to lukasz1992/openwrt that referenced this pull request Feb 19, 2026
Backport a patch that reduces the quality of HWRNG. HWRNG has lower
entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: openwrt#21722
Signed-off-by: Hauke Mehrtens <[email protected]>
lukasz1992 pushed a commit to lukasz1992/openwrt that referenced this pull request Mar 3, 2026
Backport a patch that reduces the quality of HWRNG. HWRNG has lower
entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: openwrt#21722
Signed-off-by: Hauke Mehrtens <[email protected]>
lukasz1992 pushed a commit to lukasz1992/openwrt that referenced this pull request Mar 10, 2026
Backport a patch that reduces the quality of HWRNG. HWRNG has lower
entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: openwrt#21722
Signed-off-by: Hauke Mehrtens <[email protected]>
@abajk

abajk commented Mar 11, 2026 •

Copy link
Copy Markdown
Contributor Author

I get that when base64-encoding real random data, i.e. when there are only 6 bits of entropy per byte. For the HWRNG here, we only know the upper bound is roughly 7 bits per byte, but probably way less.

@hailfinger Can you measure entropy based on the provided data?

@abajk

abajk commented Mar 11, 2026 •

Copy link
Copy Markdown
Contributor Author

It seems to me that HWRNG lacks an entropy extractor. It works like DRBG and calculates the hash. It takes 24 bytes of data as input and produces 16 bytes of entropy as output. This comes at the cost of slower noise generation. In fact, HWRNG in Aroha has DRBG, but it is faster than RAW mode, so it reduces entropy even further.

slow-boat pushed a commit to slow-boat/openwrt that referenced this pull request Mar 20, 2026
Backport a patch that reduces the quality of HWRNG. HWRNG has lower
entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: openwrt#21722
Signed-off-by: Hauke Mehrtens <[email protected]>
lukasz1992 pushed a commit to lukasz1992/openwrt that referenced this pull request Mar 21, 2026
Backport a patch that reduces the quality of HWRNG. HWRNG has lower
entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: openwrt#21722
Signed-off-by: Hauke Mehrtens <[email protected]>
YaleiZang pushed a commit to YaleiZang/openwrt-25.12-airoha that referenced this pull request Apr 7, 2026
Backport a patch that reduces the quality of HWRNG. HWRNG has lower
entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: openwrt#21722
Signed-off-by: Hauke Mehrtens <[email protected]>
(cherry picked from commit 5cd1769)
Ansuel pushed a commit to YaleiZang/openwrt-25.12-airoha that referenced this pull request Apr 22, 2026
Backport a patch that reduces the quality of HWRNG. HWRNG has lower
entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: openwrt#21722
Signed-off-by: Hauke Mehrtens <[email protected]>
(cherry picked from commit 5cd1769)
Link: openwrt#22820
Signed-off-by: Christian Marangi <[email protected]>
harphy pushed a commit to harphy/openwrt that referenced this pull request Apr 23, 2026
Backport a patch that reduces the quality of HWRNG. HWRNG has lower
entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: openwrt#21722
Signed-off-by: Hauke Mehrtens <[email protected]>
(cherry picked from commit 5cd1769)
Link: openwrt#22820
Signed-off-by: Christian Marangi <[email protected]>
Vladdrako pushed a commit to Vladdrako/openwrt that referenced this pull request May 4, 2026
Backport a patch that reduces the quality of HWRNG. HWRNG has lower
entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: openwrt#21722
Signed-off-by: Hauke Mehrtens <[email protected]>
liudf0716 pushed a commit to liudf0716/chawrt that referenced this pull request May 21, 2026
Backport a patch that reduces the quality of HWRNG. HWRNG has lower
entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: openwrt/openwrt#21722
Signed-off-by: Hauke Mehrtens <[email protected]>
(cherry picked from commit 5cd1769)
Link: openwrt/openwrt#22820
Signed-off-by: Christian Marangi <[email protected]>
(cherry picked from commit 4d9eeb8642e0b7bfbcc1ca8582c8eb841053fc84)
LuisMitaHL pushed a commit to LuisMitaHL/LooperWrt that referenced this pull request Sep 21, 2026
Backport a patch that reduces the quality of HWRNG. HWRNG has lower
entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: openwrt#21722
Signed-off-by: Hauke Mehrtens <[email protected]>
(cherry picked from commit 5cd1769)
Link: openwrt#22820
Signed-off-by: Christian Marangi <[email protected]>
Quarx2k pushed a commit to Quarx2k/OpenWRT-BE7000 that referenced this pull request Sep 22, 2026
Backport a patch that reduces the quality of HWRNG. HWRNG has lower
entropy than expected. Thanks to this patch, it has a lower priority.

Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: openwrt/openwrt#21722
Signed-off-by: Hauke Mehrtens <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

target/airoha pull request/issue for airoha target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants