Remove references to time_t/time()/random()
Replace direct calls in AP mode code with os_*() wrappers.
This commit is contained in:
parent
c2197bc9bc
commit
0b04889f0d
5 changed files with 31 additions and 23 deletions
|
@ -244,15 +244,15 @@ static u16 auth_shared_key(struct hostapd_data *hapd, struct sta_info *sta,
|
|||
if (!sta->challenge) {
|
||||
/* Generate a pseudo-random challenge */
|
||||
u8 key[8];
|
||||
time_t now;
|
||||
struct os_time now;
|
||||
int r;
|
||||
sta->challenge = os_zalloc(WLAN_AUTH_CHALLENGE_LEN);
|
||||
if (sta->challenge == NULL)
|
||||
return WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
|
||||
now = time(NULL);
|
||||
r = random();
|
||||
os_memcpy(key, &now, 4);
|
||||
os_get_time(&now);
|
||||
r = os_random();
|
||||
os_memcpy(key, &now.sec, 4);
|
||||
os_memcpy(key + 4, &r, 4);
|
||||
rc4_skip(key, sizeof(key), 0,
|
||||
sta->challenge, WLAN_AUTH_CHALLENGE_LEN);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue