mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-07-04 20:08:57 +00:00
PPP, magic: dot not assume LWIP_RAND will return 32 bits of randomness
Do not assume LWIP_RAND will return 32 bits of randomness because it is probably going to be defined to directly return the rand() value. For example, LCP magic numbers are 32-bit random values.
This commit is contained in:
parent
e239222775
commit
332119d7e0
|
@ -254,7 +254,7 @@ void magic_randomize(void) {
|
||||||
*/
|
*/
|
||||||
u32_t magic(void) {
|
u32_t magic(void) {
|
||||||
#ifdef LWIP_RAND
|
#ifdef LWIP_RAND
|
||||||
return LWIP_RAND() + magic_randomseed;
|
return (LWIP_RAND() << 16) + LWIP_RAND() + magic_randomseed;
|
||||||
#else /* LWIP_RAND */
|
#else /* LWIP_RAND */
|
||||||
return ((u32_t)rand() << 16) + (u32_t)rand() + magic_randomseed;
|
return ((u32_t)rand() << 16) + (u32_t)rand() + magic_randomseed;
|
||||||
#endif /* LWIP_RAND */
|
#endif /* LWIP_RAND */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user