User Tools

Site Tools


Random generator


  • This guide describes how to utilize a fast RNG for OpenWrt.
  • It may help to minimize system startup time on low performance devices.


  • Minimize startup time for cryptography-dependent services.
    • Avoid potential deadlock states and race conditions.


Provide RNG via rng-tools.

# Install packages
opkg update
opkg install rng-tools
# Configure RNG
uci set system.@rngd[0].enabled="1"
uci commit system
service rngd restart

Use a software RNG by default.

# Use software RNG
uci set system.@rngd[0].device="/dev/urandom"
uci commit system
service rngd restart

Use a hardware RNG if available.

# Use hardware RNG
uci set system.@rngd[0].device="/dev/hwrng"
uci commit system
service rngd restart


Test the entropy pool size.

cat /proc/sys/kernel/random/entropy_avail

Use rngtest to check the randomness of data.

RNG_DEV="$(uci get system.@rngd[0].device)"
rngtest -c 1000 < ${RNG_DEV}


Collect and analyze the following information.

# Restart the services
service log restart; service rngd restart
# Log and status
logread -e rngd; pgrep -f -a rngd
# Persistent configuration
uci show system
docs/guide-user/services/rng.txt · Last modified: 2019/04/28 02:36 by vgaetera