[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v1] libxl/arm: provide guests with random seed


On 24/05/2021 09:00, Sergiy Kibrik wrote:
Pass random seed via FDT, so that guests' CRNGs are better seeded early at boot.
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.

Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@xxxxxxxx>
  tools/libxl/libxl_arm.c | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 34f8a29056..05c58a428c 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -342,6 +342,12 @@ static int make_chosen_node(libxl__gc *gc, void *fdt, bool 
          if (res) return res;
+ uint8_t seed[128];

I couldn't find any documentation for the property (although, I have found code in Linux). Can you explain where the 128 come from?

Also, local variables should be defined at the beginning of the function.

+    res = libxl__random_bytes(gc, seed, sizeof(seed)); > +    if (res) return 
+    res = fdt_property(fdt, "rng-seed", seed, sizeof(seed));
+    if (res) return res;
      res = fdt_end_node(fdt);
      if (res) return res;


Julien Grall



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.