[riot-notifications] [RIOT-OS/RIOT] sys/entropy_source: add new module for entropy sources (#14324)
Leandro Lanzieri
notifications at github.com
Wed Nov 25 10:56:15 CET 2020
@leandrolanzieri commented on this pull request.
> + else if (entropy_per_sample < 131072UL) { /* 2 bit/sample */
+ ret = 311;
+ }
+ else if (entropy_per_sample < 131072UL) { /* 4 bit/sample */
+ ret = 177;
+ }
+ else if (entropy_per_sample < 131072UL) { /* 8 bit/sample */
+ ret = 62;
+ }
+ else if (entropy_per_sample == 131072UL) { /* 8 bit/sample */
+ ret = 13;
This does not look OK
> +if KCONFIG_MODULE_ENTROPY_SOURCE_ZERO_ENTROPY
+
+config ENTROPY_SOURCE_ZERO_HMIN
+ int "Estimated entropy per sample (byte)"
+ default 58982
+ help
+ This is a dummy default value for testing. The zero entropy module does not
+ contain any entropy at all.
+
+config ENTROPY_SOURCE_ZERO_HEALTH_TEST
+ bool "Enable health test"
+ default y
+ help
+ Enable health test by default. Testing is the only purpose of this module.
+
+config CONFIG_ENTROPY_SOURCE_ZERO_COND
The `CONFIG_` prefix is added by Kconfig when generating the correspondent macro.
```suggestion
config ENTROPY_SOURCE_ZERO_COND
```
> + * A common component provides optional access to health tests and conditioning that can be run on
+ * parallel instantiations. The conditioning currently implements a von Neumann extractor to
+ * unbias samples. It adds a variable runtime (dependent on the input samples) but is lightweight.
+ * In future, other conditioning mechanisms such as hash based derivation functions might be
+ * included.
Maybe add a reference on how to enable this conditioning? Or at least a pointer to the compile-time configuration groups that contain that option.
> @@ -0,0 +1,74 @@
+# Copyright (c) 2020 HAW Hamburg
+#
+# This file is subject to the terms and conditions of the GNU Lesser
+# General Public License v2.1. See the file LICENSE in the top level
+# directory for more details.
+
+menuconfig KCONFIG_MODULE_ENTROPY_SOURCE_ADC_NOISE
+ bool "Configure ADC Noise entropy source module"
+ depends on MODULE_ENTROPY_SOURCE_ADC_NOISE
These need to be updated to the new prefixes
```suggestion
depends on USEMODULE_ENTROPY_SOURCE_ADC_NOISE
```
> @@ -0,0 +1,37 @@
+# Copyright (c) 2020 HAW Hamburg
+#
+# This file is subject to the terms and conditions of the GNU Lesser
+# General Public License v2.1. See the file LICENSE in the top level
+# directory for more details.
+
+menuconfig KCONFIG_MODULE_ENTROPY_SOURCE
+ bool "Configure entropy source module"
+ depends on MODULE_ENTROPY_SOURCE
```suggestion
depends on USEMODULE_ENTROPY_SOURCE
```
> @@ -0,0 +1,37 @@
+# Copyright (c) 2020 HAW Hamburg
+#
+# This file is subject to the terms and conditions of the GNU Lesser
+# General Public License v2.1. See the file LICENSE in the top level
+# directory for more details.
+
+menuconfig KCONFIG_MODULE_ENTROPY_SOURCE
```suggestion
menuconfig KCONFIG_USEMODULE_ENTROPY_SOURCE
```
> @@ -0,0 +1,74 @@
+# Copyright (c) 2020 HAW Hamburg
+#
+# This file is subject to the terms and conditions of the GNU Lesser
+# General Public License v2.1. See the file LICENSE in the top level
+# directory for more details.
+
+menuconfig KCONFIG_MODULE_ENTROPY_SOURCE_ADC_NOISE
```suggestion
menuconfig KCONFIG_USEMODULE_ENTROPY_SOURCE_ADC_NOISE
```
> @@ -0,0 +1,35 @@
+# Copyright (c) 2020 HAW Hamburg
+#
+# This file is subject to the terms and conditions of the GNU Lesser
+# General Public License v2.1. See the file LICENSE in the top level
+# directory for more details.
+
+menuconfig KCONFIG_MODULE_ENTROPY_SOURCE_ZERO_ENTROPY
+ bool "Configure zero entropy source module"
+ depends on MODULE_ENTROPY_SOURCE_ZERO_ENTROPY
```suggestion
depends on USEMODULE_ENTROPY_SOURCE_ZERO_ENTROPY
```
> @@ -0,0 +1,35 @@
+# Copyright (c) 2020 HAW Hamburg
+#
+# This file is subject to the terms and conditions of the GNU Lesser
+# General Public License v2.1. See the file LICENSE in the top level
+# directory for more details.
+
+menuconfig KCONFIG_MODULE_ENTROPY_SOURCE_ZERO_ENTROPY
```suggestion
menuconfig KCONFIG_USEMODULE_ENTROPY_SOURCE_ZERO_ENTROPY
```
> @@ -0,0 +1,35 @@
+# Copyright (c) 2020 HAW Hamburg
+#
+# This file is subject to the terms and conditions of the GNU Lesser
+# General Public License v2.1. See the file LICENSE in the top level
+# directory for more details.
+
+menuconfig KCONFIG_MODULE_ENTROPY_SOURCE_ZERO_ENTROPY
+ bool "Configure zero entropy source module"
+ depends on MODULE_ENTROPY_SOURCE_ZERO_ENTROPY
+ help
+ Configure the zero entropy source using Kconfig.
+
+if KCONFIG_MODULE_ENTROPY_SOURCE_ZERO_ENTROPY
```suggestion
if KCONFIG_USEMODULE_ENTROPY_SOURCE_ZERO_ENTROPY
```
> @@ -0,0 +1,37 @@
+# Copyright (c) 2020 HAW Hamburg
+#
+# This file is subject to the terms and conditions of the GNU Lesser
+# General Public License v2.1. See the file LICENSE in the top level
+# directory for more details.
+
+menuconfig KCONFIG_MODULE_ENTROPY_SOURCE
+ bool "Configure entropy source module"
+ depends on MODULE_ENTROPY_SOURCE
+ help
+ Configure entropy sources using Kconfig.
+
+if KCONFIG_MODULE_ENTROPY_SOURCE
```suggestion
if KCONFIG_USEMODULE_ENTROPY_SOURCE
```
> +#define CONFIG_ENTROPY_SOURCE_ADC_LINE ADC_LINE(CONFIG_ENTROPY_SOURCE_ADC_LINE_NUM)
+#else
+#define CONFIG_ENTROPY_SOURCE_ADC_LINE ADC_LINE(0)
+#endif
+
+/**
+ * @brief ADC estimated entropy per sample [2^16 * bit/sample].
+ *
+ * The entropy value needs to be estimated and evaluated thoroughly beforehand
+ * deployment! To avoid float, the
+ * actual entropy value per one byte sample needs to be manually multiplied by
+ * 2^16 before setting it as configuration parameter. See
+ * @ref sys_entropy_source for further information about entropy source
+ * validation.
+ */
+#if !defined(CONFIG_KCONFIG_MODULE_ENTROPY_SOURCE_ADC_NOISE) || defined(DOXYGEN)
```suggestion
#if !defined(CONFIG_KCONFIG_USEMODULE_ENTROPY_SOURCE_ADC_NOISE) || defined(DOXYGEN)
```
> @@ -0,0 +1,13 @@
+# Only include adc noise source if BOARD is not native
```suggestion
# Only include adc noise source if BOARD has an adc
```
> @@ -0,0 +1,35 @@
+# Copyright (c) 2020 HAW Hamburg
+#
+# This file is subject to the terms and conditions of the GNU Lesser
+# General Public License v2.1. See the file LICENSE in the top level
+# directory for more details.
+
+menuconfig KCONFIG_MODULE_ENTROPY_SOURCE_ZERO_ENTROPY
+ bool "Configure zero entropy source module"
+ depends on MODULE_ENTROPY_SOURCE_ZERO_ENTROPY
+ help
+ Configure the zero entropy source using Kconfig.
+
+if KCONFIG_MODULE_ENTROPY_SOURCE_ZERO_ENTROPY
There may be others similar to this, please check
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/14324#pullrequestreview-536334739
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201125/19d2cb8d/attachment-0001.htm>
More information about the notifications
mailing list