1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

10 Commits

Author SHA1 Message Date
2b658246b0
sys/luid: move dependency resolution in its own Makefile.dep 2023-06-15 10:24:49 +02:00
Leandro Lanzieri
34594ae1dc
sys/luid: add module to Kconfig 2021-01-26 17:40:30 +01:00
Bas Stottelaar
ffb929d811 sys/*: remove unused assert.h include 2020-10-22 11:29:27 +02:00
Benjamin Valentin
6fa15ff3f6 sys/luid: improve luid_base() algorithm
CPU IDs may contain very little entropy. Often only a single byte
may change between two CPUs.

To mitigate this use a somewhat 'proper' hash algorithm (I chose DJB2
hash simply because it's small) and 'extend' it to the required output
size.

For 50 STM32 CPU IDs from the grenoble site, this produces a much more
random LUID output.
2020-10-18 14:52:02 +02:00
Benjamin Valentin
28d1936fae sys/luid: shuffle bytes
The CPU ID can have large parts that are identical between devices.
To add some more entropy to the generated IDs, shuffle the bytes.
2020-09-11 13:01:31 +02:00
Benjamin Valentin
3b7351753b sys/luid: add luid_netdev_get_eui48() & luid_netdev_get_eui64()
Add functions to generate an EUI based on the netdev ID.
This will always return the same EUI for the same netdev, so it is
stable across netdev resets.
2020-08-18 11:45:45 +02:00
Benjamin Valentin
e195e0269c sys/luid: provide luid_get_lb(), fix documentation
This does two things:

The documentation of `luid_get()` is wrong, or at least confusing.

It talks about

> an 8-bit incrementing counter value into the most significant byte

while the implementation does

    ((uint8_t *)buf)[0] ^= lastused++;	// 0 is LSB!

Now it could be argued that the intention was that the ID is supposed
to be used in Big Endian contexts and that was an omission, however
to keep everyone's sanity, let's keep it simple and just state that this
actually changes the LSB.

Also add a `luid_get_lb()` function that does the same, but modifies the
most significant byte - or the last byte if looking at the index.

This can then be used directly by e.g. #13743
2020-05-13 20:47:53 +02:00
Benjamin Valentin
38e94d09db sys/luid: provide luid_get_eui48() and luid_get_eui64()
The most common use case for luid is to generate those
addresses, so provide helper functions for it.
2019-11-04 21:08:23 +01:00
Benjamin Valentin
f6e7be9a06 sys/luid: allow to overwrite luid_base()
This allows to overwrite luid_base() with a function that reads an
ID from e.g. a EUI64MAC chip if no CPU ID is available.
2019-11-04 21:07:23 +01:00
Hauke Petersen
79a113d1ba sys/drivers: renamed uuid module to luid 2017-02-27 11:01:20 +01:00