diff options
| author | Quentin Thébault <quentin.thebault@defenso.fr> | 2025-07-02 06:17:29 +0000 |
|---|---|---|
| committer | Kyle Evans <kevans@FreeBSD.org> | 2025-07-02 19:33:19 +0000 |
| commit | b2f02b04948cea9b7f019b267e1fc2d083b1417c (patch) | |
| tree | 70fdeac5e01570d4f37ad85c9aac50f7b38b72ef /lib/libdevctl/devctl.c | |
| parent | 79dea0c8af4eeb394c6db6ce62a4da77177bd234 (diff) | |
if_ethersubr: preserve entropy of MAC addresses
Ethernet MAC addresses are currently generated by concatenating the
first bytes of a SHA1 digest. However the digest buffer is defined as a
signed char buffer, which means that any digest digit greater than 0x80
will be promoted to a negative int before the concatenation.
As a result, any digest digit greater than 0x80 will overwrite the
previous ones throught the application of the bitwise-or with its 0xFF
higher bytes, effectively reducing the entropy of addresses generated
and significantly increasing the risk of conflict.
Defining the digest buffer as unsigned ensures there will be no unwanted
consequences during integer promotion and the concatenation will work as
expected.
Signed-off-by: Quentin Thébault <quentin.thebault@defenso.fr>
Closes: https://github.com/freebsd/freebsd-src/pull/1750
Diffstat (limited to 'lib/libdevctl/devctl.c')
0 files changed, 0 insertions, 0 deletions
