PPP, magic, improved magic_randomize() for PPP_MD5_RANDM is not enabled

A disabled PPP_MD5_RANDM should not be used when challenge are used, but
anyway, improved magic_randomize() so magic_randomseed is not equals to
sys_jiffies() which is pretty useless because that's fully predicable.
This commit is contained in:
Sylvain Rochet 2015-08-30 20:44:13 +02:00
parent a24f4421d6
commit 541e3b6eb4

View File

@ -226,17 +226,14 @@ void magic_init(void) {
* bits.
*/
void magic_randomize(void) {
static u32_t last_jiffies;
if (!magic_randomized) {
magic_randomized = !0;
magic_init();
/* The initialization function also updates the seed. */
} else {
/* magic_randomseed += (magic_randomseed << 16) + TM1; */
magic_randomseed += (sys_jiffies() - last_jiffies); /* XXX */
magic_randomseed += sys_jiffies() & 0xffff; /* XXX */
}
last_jiffies = sys_jiffies();
}
/*