forked from openwrt/openwrt
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
urandom-seed: go back to seeding with shell script temporarily
This reverts commit 2edc017. We shouldn't be using a shell script here, but the SeedRNG integration into OpenWRT requires a bit more thought. Etienne raised some important points immediately after this was merged and planned to send some follow up commits, but became busy with other things. The points he raised are important enough that we should actually back this out until it's ready to go, and then merge it as a cohesive unit. So let's revert this for now, and come back to it later on. Cc: Etienne Champetier <champetier.etienne@gmail.com> Cc: Petr Štetiar <ynezz@true.cz> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
- Loading branch information
Showing
5 changed files
with
35 additions
and
442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
trap '[ "$?" -eq 0 ] || echo "An error occured" >&2' EXIT | ||
|
||
save() { | ||
touch "$1.tmp" | ||
chown root:root "$1.tmp" | ||
chmod 600 "$1.tmp" | ||
getrandom 512 > "$1.tmp" | ||
mv "$1.tmp" "$1" | ||
echo "Seed saved ($1)" | ||
} | ||
|
||
SEED="$(uci -q get system.@system[0].urandom_seed || true)" | ||
[ "${SEED:0:1}" = "/" ] && save "$SEED" | ||
|
||
SEED=/etc/urandom.seed | ||
[ ! -f $SEED ] && save "$SEED" | ||
true |
Oops, something went wrong.