uhttpd: use hexdump -v for the certificate ID

uhttpd.init appends four random bytes as hex digits to the default
organization of its self-signed certificate. Without -v, hexdump prints
"*" instead of repeated lines, and with the format used here each byte
is a line of its own. When adjacent bytes are equal, the organization
gets a "*" instead of the repeated bytes, followed by a newline if more
bytes follow. For example 8b 35 35 ba gives "OpenWrt8b35*", a newline
and "ba". This happens for about 1 in 86 generated certificates.

Pass -v to hexdump, so all four bytes are printed.

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25628
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Josef Schlehofer authored and Robert Marko committed 2026-10-05 19:42:19 +02:00
1 parent 745bf59e9d
commit c6c02f7e79
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=uhttpd
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git
@@ -50,7 +50,7 @@ generate_keys() {
# Prefer px5g for certificate generation (existence evaluated last)
local GENKEY_CMD=""
local KEY_OPTS="rsa:${bits:-2048}"
local UNIQUEID=$(dd if=/dev/urandom bs=1 count=4 | hexdump -e '1/1 "%02x"')
local UNIQUEID=$(dd if=/dev/urandom bs=1 count=4 | hexdump -v -e '1/1 "%02x"')
[ "$key_type" = "ec" ] && KEY_OPTS="ec -pkeyopt ec_paramgen_curve:${ec_curve:-P-256}"
[ -x "$OPENSSL_BIN" ] && GENKEY_CMD="$OPENSSL_BIN req -x509 -sha256 -outform der -nodes"
[ -x "$PX5G_BIN" ] && GENKEY_CMD="$PX5G_BIN selfsigned -der"