diff mbox

When generating a MS-MPPE-Send-Key, don't use a weak PRNG for the salt.

Message ID CAGnO3dpXx5B9_9CnUJM32KOHdyH6LwTpkT1ZY9AGuBnipjdKLg@mail.gmail.com
State Accepted
Headers show

Commit Message

Nick Lowe Feb. 7, 2016, 10:11 a.m. UTC
When generating a MS-MPPE-Send-Key, don't use a weak PRNG for the salt.

Signed-off-by: Nick Lowe <nick.lowe@lugatech.com>
---
 src/radius/radius.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Jouni Malinen Feb. 7, 2016, 4:51 p.m. UTC | #1
On Sun, Feb 07, 2016 at 10:11:46AM +0000, Nick Lowe wrote:
> When generating a MS-MPPE-Send-Key, don't use a weak PRNG for the salt.

Thanks, applied.
diff mbox

Patch

diff --git a/src/radius/radius.c b/src/radius/radius.c
index d4b84c1..b5166d9 100644
--- a/src/radius/radius.c
+++ b/src/radius/radius.c
@@ -1201,7 +1201,10 @@  int radius_msg_add_mppe_keys(struct radius_msg *msg,
  vhdr = (struct radius_attr_vendor *) pos;
  vhdr->vendor_type = RADIUS_VENDOR_ATTR_MS_MPPE_SEND_KEY;
  pos = (u8 *) (vhdr + 1);
- salt = os_random() | 0x8000;
+ if (os_get_random((u8 *) &salt, sizeof(salt)) < 0) {
+ return 0;
+ }
+ salt |= 0x8000;
  WPA_PUT_BE16(pos, salt);
  pos += 2;
  encrypt_ms_key(send_key, send_key_len, salt, req_authenticator, secret,