tools: use cryptographically safe RNG
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tue, 11 Feb 2025 13:55:22 +0000 (14:55 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 18 Feb 2025 18:30:32 +0000 (12:30 -0600)
commit50e8089c1de107137c7a30fd5691ebd449f42e2d
tree614d639171a8ad4363189ee5093956056db0caa5
parente93f11148ae42bbb805077a48ab8cb63137a3a17
tools: use cryptographically safe RNG

The PRNG implementing the random() function only has 2^31 states and
therefore is unsafe to use for cryptography. Use arc4random() instead.

Fixes: cc34f04efd63 ("tools: image-host.c: use random instead of rand")
Addresses-Coverity-ID: 312953 Calling risky function
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
tools/image-host.c