Skip to contentSkip to conversation

Documentation: dt-bindings: Document 'rng-seed' for /chosen

PATCH In review Florian Fainelli 4 participants 5 messages Apr 2, 2020 – Apr 3, 2020 Device tree bindings

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Documentation: dt-bindings: Document 'rng-seed' for /chosen

The /chosen node can have a 'rng-seed' property read as a u32 quantity which would contain a random number provided by the boot agent. This is useful in configurations where the kernel does not have access to a random number generator.

---
 Documentation/devicetree/bindings/chosen.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)
Documentation/devicetree/bindings/chosen.txt +13 -0
index 45e79172a646..126b31eecfeb 100644
@@ -28,6 +28,19 @@ mode) when EFI_RNG_PROTOCOL is supported, it will be overwritten by
 the Linux EFI stub (which will populate the property itself, using
 EFI_RNG_PROTOCOL).
 
+rng-seed
+--------
+
+This property is used to initialize the kernel's entropy pool from a
+trusted boot agent capable of providing a random number. It is parsed
+as a u32 value, e.g.
+
+/ {
+	chosen {
+		rng-seed = <0xcafef00d>;
+	};
+};
+
 stdout-path
 -----------
 
Signature · 1 line
2.17.1
#1 lore raw

Hi Florian,

Quoted 9 lines · Florian Fainelli

The /chosen node can have a 'rng-seed' property read as a u32 quantity which would contain a random number provided by the boot agent. This is useful in configurations where the kernel does not have access to a random number generator.

---
 Documentation/devicetree/bindings/chosen.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Thanks for doing this; I realised it was undocumented the other day when I tried to look it up myself.

Quoted 5 lines
Documentation/devicetree/bindings/chosen.txt +0 -0
index 45e79172a646..126b31eecfeb 100644

Documentation/devicetree/bindings/chosen.txt mode) when EFI_RNG_PROTOCOL is supported, it will be overwritten by · line 36

Quoted 9 lines
Documentation/devicetree/bindings/chosen.txt +6 -0
@@ -28,6 +28,19 @@ mode) when EFI_RNG_PROTOCOL is supported, it will be overwritten by
 the Linux EFI stub (which will populate the property itself, using
 EFI_RNG_PROTOCOL).
 
+rng-seed
+--------
+
+This property is used to initialize the kernel's entropy pool from a
+trusted boot agent capable of providing a random number. It is parsed
+as a u32 value, e.g.

Are you sure about this being limited to a u32 value? I thought you could pass an arbitrary-length value here.

Will

maintainer
#2 lore raw
Quoted 9 lines · Will Deacon

Hi Florian,

Quoted 5 lines · Florian Fainelli

The /chosen node can have a 'rng-seed' property read as a u32 quantity which would contain a random number provided by the boot agent. This is useful in configurations where the kernel does not have access to a random number generator.

Quoted 7 lines
Quoted 4 lines
---
 Documentation/devicetree/bindings/chosen.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Thanks for doing this; I realised it was undocumented the other day when I tried to look it up myself.

Already documented here[1]. I've been meaning to delete chosen.txt so that's a bit more obvious.

I realize it's a bit harder to find what's documented where. Long term we'd like to generate documentation from the schema and integrate as part of the spec. Short term, it would be quite trivial to make a 'am I documented' utility.

Rob

[1] https://github.com/devicetree-org/dt-schema/blob/master/schemas/chosen.yaml

#3 lore raw
In reply to Will Deacon
Quoted 24 lines · Will Deacon

Hi Florian,

Quoted 9 lines · Florian Fainelli

The /chosen node can have a 'rng-seed' property read as a u32 quantity which would contain a random number provided by the boot agent. This is useful in configurations where the kernel does not have access to a random number generator.

---
 Documentation/devicetree/bindings/chosen.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Thanks for doing this; I realised it was undocumented the other day when I tried to look it up myself.

Quoted 8 lines
Documentation/devicetree/bindings/chosen.txt +0 -0
index 45e79172a646..126b31eecfeb 100644
@@ -28,6 +28,19 @@ mode) when EFI_RNG_PROTOCOL is supported, it will be overwritten by
 the Linux EFI stub (which will populate the property itself, using
 EFI_RNG_PROTOCOL).
 
Quoted 9 lines

Documentation/devicetree/bindings/chosen.txt mode) when EFI_RNG_PROTOCOL is supported, it will be overwritten by · line 36

Quoted 6 lines
Documentation/devicetree/bindings/chosen.txt +6 -0
+rng-seed
+--------
+
+This property is used to initialize the kernel's entropy pool from a
+trusted boot agent capable of providing a random number. It is parsed
+as a u32 value, e.g.

Are you sure about this being limited to a u32 value? I thought you could pass an arbitrary-length value here.

Humm indeed, we can pass an arbitrary value, I completely conflated the type of "l" here:

	int l;
	...
        rng_seed = of_get_flat_dt_prop(node, "rng-seed", &l);

with how much we would be reading from the property, which is complete nonsense. Out of curiosity, what property length do platforms typically populate?

Signature · 1 line
Florian
#4 lore raw
Quoted 11 lines · Florian Fainelli
Quoted 3 lines

Are you sure about this being limited to a u32 value? I thought you could pass an arbitrary-length value here.

Humm indeed, we can pass an arbitrary value, I completely conflated the type of "l" here:

        int l;
        ...
        rng_seed = of_get_flat_dt_prop(node, "rng-seed", &l);
Quoted 5 lines

with how much we would be reading from the property, which is complete nonsense. Out of curiosity, what property length do platforms typically populate?
--
Florian

64 bytes should be able to init crng. (pass CRNG_INIT_CNT_THRESH)