[riot-notifications] [RIOT-OS/RIOT] sys/random: allow seed source selection (#15836)

Leandro Lanzieri notifications at github.com
Wed Jan 27 09:58:45 CET 2021

@leandrolanzieri commented on this pull request.

> +  # select a default seed source for auto initialization if none is selected
+  ifeq (,$(filter random_seed_%,$(USEMODULE)))
+    # by default we select the fixed, if another is possible we disable it
+    DEFAULT_MODULE += random_seed_fixed
+    ifneq (,$(filter puf_sram,$(USEMODULE)))
+      USEMODULE += random_seed_puf_sram
+      DISABLE_MODULE += random_seed_fixed
+    else ifneq (,$(filter periph_hwrng,$(FEATURES_USED)))
+      USEMODULE += random_seed_hwrng
+      DISABLE_MODULE += random_seed_fixed
+    else ifneq (,$(filter periph_cpuid,$(FEATURES_USED)))
+      USEMODULE += random_seed_luid
+      DISABLE_MODULE += random_seed_fixed
+    else
+      FEATURES_OPTIONAL += periph_hwrng
+      FEATURES_OPTIONAL += periph_cpuid
+    endif
+  endif

> True, but now that you mention this I'm a bit concerned about a case where to pkg's might select different `random_seed` modules, I guess that would mean that some pkg's would not be compatible or one of them would have to declare its module as `DEFAULT` so it can potentially be disabled.

If two modules have strong dependencies on different seed sources, those modules are not compatible. If a module would prefer one source over another, then `DEFAULT_MODULE` would be used. The module that has the strong dependency would add the source to `USEMODULE` and disable all others via `DISABLE_MODULE`. In case more than one source is added to `DEFAULT_MODULE`, we can establish a (documented) preference order. Do you think that could work?

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210127/fc88de31/attachment-0001.htm>

More information about the notifications mailing list