|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH v2 2/4] lib/ukswrand: Add seed generating function
On 18.10.19 14:59, Simon Kuenzer wrote: Hey Vlad, thanks a lot for you work. I have a few comments inline. Thanks, Simon On 16.10.19 17:41, Vlad-Andrei BĂDOIU (78692) wrote:This patch adds a new function, _get_random_seed32 for seed generaton. If the pre-compiled config option is not selected, then rdrand is used on x86 andukplat_wall_clock on ARM. Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx> --- lib/ukswrand/Config.uk | 7 +++++++ lib/ukswrand/include/uk/swrand.h | 20 ++++++++++++++++++++ lib/ukswrand/mwc.c | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/ukswrand/Config.uk b/lib/ukswrand/Config.uk index c58371bb..8db3af03 100644 --- a/lib/ukswrand/Config.uk +++ b/lib/ukswrand/Config.uk @@ -14,10 +14,17 @@ config LIBUKSWRAND_MWC Use multiply-with-carry algorithm endchoice +config LIBUKSWRAND_USE_INITIALSEED + bool "Use a pre-compiled seed" + default y + +if LIBUKSWRAND_USE_INITIALSEED config LIBUKSWRAND_INITIALSEED int "Initial random seed" default 23Hey, I would rather provide a drop-down menu. This is maybe a little bit more intuitive to use. How about:choice prompt "Initial seed" default LIBUKSWRANDR_INITIALSEED_TIME config LIBUKSWRAND_INITIALSEED_TIME bool "Platform timestamp" config LIBUKSWRAND_INITIALSEED_RDRAND depends on ARCH_X86_64 && (MARCH_X86_64_COREI7AVXI) bool "`rdrand` instruction" config LIBUKSWRAND_INITIALSEED_USECONSTANT bool "Compiled-in constant" endchoice config LIBUKSWRAND_INITIALSEED_CONSTANT int "Initial seed constant" depends on LIBUKSWRAND_INITIALSEED_USECONSTANT default 23Also note that rdrand/rdseed is not available on all x86_64 CPUs. On Intel it got introduced with Ivy-Bridge, afaik.+endif + config LIBUKSWRAND_DEVFS bool "Register random and urandom device to devfs" select LIBDEVFSdiff --git a/lib/ukswrand/include/uk/swrand.h b/lib/ukswrand/include/uk/swrand.h Another thing: maybe move this function (_get_random_seed32()) in the generic source file instead (ukswrand/swrand.c). This way you can keep it internal to the library. You may also want to put the constructor into this file. + /* Uses the pre-initialized default generator *//* TODO: Add assertion when we can test if we are in interrupt context */ _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |