Skip to contentSkip to conversation

ARM: ep93xx: toss the device ID into the entropy pool

PATCH New Linus Walleij 4 participants 4 messages Jun 18, 2015 – Jun 24, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: ep93xx: toss the device ID into the entropy pool

It doesn't hurt to add this random stuff into the entropy pool as is custom to do with device-unique numbers.

---
 arch/arm/mach-ep93xx/core.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/mach-ep93xx/core.c +7 -0
index 5e2151bcc0c5..c393b1b0310d 100644
@@ -37,6 +37,7 @@
 #include <linux/irqchip/arm-vic.h>
 #include <linux/reboot.h>
 #include <linux/usb/ohci_pdriver.h>
+#include <linux/random.h>
 
 #include <mach/hardware.h>
 #include <linux/platform_data/video-ep93xx.h>
@@ -862,6 +863,12 @@ static const char __init *ep93xx_get_soc_id(void)
 	if (id != id2)
 		return "invalid";
 
+	/* Toss the unique ID into the entropy pool */
+	add_device_randomness(&id2, 4);
+	add_device_randomness(&id3, 4);
+	add_device_randomness(&id4, 4);
+	add_device_randomness(&id5, 4);
+
 	snprintf(ep93xx_soc_id, sizeof(ep93xx_soc_id),
 		 "%08x%08x%08x%08x", id2, id3, id4, id5);
 
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/1 ARM: ep93xx: toss the device ID into the entropy pool

Quoted 22 lines · Linus Walleij

It doesn't hurt to add this random stuff into the entropy pool as is custom to do with device-unique numbers.

---
 arch/arm/mach-ep93xx/core.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/mach-ep93xx/core.c +1 -0
index 5e2151bcc0c5..c393b1b0310d 100644
@@ -37,6 +37,7 @@
 #include <linux/irqchip/arm-vic.h>
 #include <linux/reboot.h>
 #include <linux/usb/ohci_pdriver.h>
+#include <linux/random.h>
 
 #include <mach/hardware.h>
 #include <linux/platform_data/video-ep93xx.h>
@@ -862,6 +863,12 @@ static const char __init *ep93xx_get_soc_id(void)
 	if (id != id2)

arch/arm/mach-ep93xx/core.c static const char __init *ep93xx_get_soc_id(void) · line 873

Quoted 10 lines
arch/arm/mach-ep93xx/core.c +6 -0
 		return "invalid";
 
+	/* Toss the unique ID into the entropy pool */
+	add_device_randomness(&id2, 4);
+	add_device_randomness(&id3, 4);
+	add_device_randomness(&id4, 4);
+	add_device_randomness(&id5, 4);
+
 	snprintf(ep93xx_soc_id, sizeof(ep93xx_soc_id),
 		 "%08x%08x%08x%08x", id2, id3, id4, id5);

Make sense.

#2 lore raw

PATCH 1/1 ARM: ep93xx: toss the device ID into the entropy pool

In reply to Linus Walleij

arch/arm/mach-ep93xx/core.c static const char __init *ep93xx_get_soc_id(void) · line 872

Quoted 11 lines · On Thursday 18 June 2015 16:47:39 Linus Walleij wrote:
arch/arm/mach-ep93xx/core.c +6 -0
@@ -862,6 +863,12 @@ static const char __init *ep93xx_get_soc_id(void)
        if (id != id2)
                return "invalid";
 
+       /* Toss the unique ID into the entropy pool */
+       add_device_randomness(&id2, 4);
+       add_device_randomness(&id3, 4);
+       add_device_randomness(&id4, 4);
+       add_device_randomness(&id5, 4);
+
 

A stupid question from someone who does not understand computer
security: Is there any concern about being able to identify a particular machine based on the random numbers generated at runtime afterwards?

Arnd

#3 lore raw

PATCH 1/1 ARM: ep93xx: toss the device ID into the entropy pool

Quoted 5 lines · Arnd Bergmann
Quoted 4 lines · On Thursday 18 June 2015 16:47:39 Linus Walleij wrote:
arch/arm/mach-ep93xx/core.c +0 -0
@@ -862,6 +863,12 @@ static const char __init *ep93xx_get_soc_id(void)
        if (id != id2)
                return "invalid";
 
Quoted 12 lines

arch/arm/mach-ep93xx/core.c static const char __init *ep93xx_get_soc_id(void) · line 874

Quoted 7 lines
arch/arm/mach-ep93xx/core.c +6 -0
+       /* Toss the unique ID into the entropy pool */
+       add_device_randomness(&id2, 4);
+       add_device_randomness(&id3, 4);
+       add_device_randomness(&id4, 4);
+       add_device_randomness(&id5, 4);
+
 

A stupid question from someone who does not understand computer
security: Is there any concern about being able to identify a particular machine based on the random numbers generated at runtime afterwards?

No, not in this case. The reason for this pattern (where any SoC specific data that is not visible out of the SoC is mixed in to the initial entropy pool) is to avoid class attacks against device families due to similarity of initial random numbers affecting this quality of early ephemeral keys.

A general guideline is that any data that cannot be determined unless you're actually running within the SoC can be mixed into the entropy pool.

Of course, nothing beats a half-decent hardware RNG as an initial entropy source.

Michael