[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XEN PATCH v2] libxl/arm: provide guests with random seed
Pass 128 bytes of random seed via FDT, so that guests' CRNGs are better seeded early at boot. This is larger than ChaCha20 key size of 32, so each byte of CRNG state will be mixed 4 times using this seed. There does not seem to be advantage in larger seed though. Depending on its configuration Linux can use the seed as device randomness or to just quickly initialize CRNG. In either case this will provide extra randomness to further harden CRNG. CC: Julien Grall <julien@xxxxxxx> Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@xxxxxxxx> --- tools/libxl/libxl_arm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index 34f8a29056..d3a4a72fb7 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -304,6 +304,9 @@ static int make_chosen_node(libxl__gc *gc, void *fdt, bool ramdisk, { int res; + /* 1024 bit enough to mix Linux CRNG state several times */ + uint8_t seed[128]; + /* See linux Documentation/devicetree/... */ res = fdt_begin_node(fdt, "chosen"); if (res) return res; @@ -342,6 +345,11 @@ static int make_chosen_node(libxl__gc *gc, void *fdt, bool ramdisk, if (res) return res; } + res = libxl__random_bytes(gc, seed, sizeof(seed)); + if (res) return res; + res = fdt_property(fdt, "rng-seed", seed, sizeof(seed)); + if (res) return res; + res = fdt_end_node(fdt); if (res) return res; -- 2.25.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |