eapol_test: Start the identifier at an initial random value

Start the (EAP request) identifier at an initial random value
as recommended by RFC 3748 in section 4.1 Request and Response
on page 21.

Signed-off-by: Martin Stanislav <ms@uakom.sk>
This commit is contained in:
Martin Stanislav 2018-10-01 16:59:03 +02:00 committed by Jouni Malinen
parent 6bcbda4082
commit cfb01f58a6
1 changed files with 2 additions and 1 deletions

View File

@ -711,7 +711,8 @@ static void send_eap_request_identity(void *eloop_ctx, void *timeout_ctx)
eap = (struct eap_hdr *) (hdr + 1);
eap->code = EAP_CODE_REQUEST;
eap->identifier = 0;
if (os_get_random((u8 *) &eap->identifier, sizeof(eap->identifier)) < 0)
eap->identifier = os_random() & 0xff;
eap->length = htons(5);
pos = (u8 *) (eap + 1);
*pos = EAP_TYPE_IDENTITY;