From d39f929675e037d9119dcffd7f4204f9cc711366 Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Sun, 27 Sep 2015 17:15:31 +0200 Subject: [PATCH] PPP: magic: don't truncate sys_jiffies() return value It used to be this way because the original implementation was close to the hardware and used a free running 16 bits timer so it was necessary. Currently what it is only doing is removing potential entropy we might get from upper bits, that's a bad idea. --- src/netif/ppp/magic.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/netif/ppp/magic.c b/src/netif/ppp/magic.c index 280fd0e7..66ab1226 100644 --- a/src/netif/ppp/magic.c +++ b/src/netif/ppp/magic.c @@ -117,7 +117,7 @@ static void magic_churnrand(char *rand_data, u32_t rand_len) { u32_t rand; #endif /* LWIP_RAND */ } sys_data; - magic_randomseed += sys_jiffies() & 0xffff; + magic_randomseed += sys_jiffies(); sys_data.jiffies = magic_randomseed; #ifdef LWIP_RAND sys_data.rand = LWIP_RAND(); @@ -244,8 +244,7 @@ void magic_randomize(void) { /* The initialization function also updates the seed. */ } else { #endif /* LWIP_RAND */ - /* magic_randomseed += (magic_randomseed << 16) + TM1; */ - magic_randomseed += sys_jiffies() & 0xffff; /* XXX */ + magic_randomseed += sys_jiffies(); #ifndef LWIP_RAND } #endif /* LWIP_RAND */