[PATCH] Switch from os_get_time(...) to os_get_reltime(...) to avoid malfunction if-and-when the system clock shifts.
Nick Lowe
nick.lowe at lugatech.com
Wed Feb 10 03:26:14 PST 2016
Switch from os_get_time(...) to os_get_reltime(...) to avoid
malfunction if-and-when the system clock shifts.
Signed-off-by: Nick Lowe <nick.lowe at lugatech.com>
---
src/eap_server/eap_server_fast.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/eap_server/eap_server_fast.c b/src/eap_server/eap_server_fast.c
index 6993159..a8c57d5 100644
--- a/src/eap_server/eap_server_fast.c
+++ b/src/eap_server/eap_server_fast.c
@@ -127,7 +127,7 @@ static int eap_fast_session_ticket_cb(void *ctx,
const u8 *ticket, size_t len,
size_t pac_opaque_len;
u8 *buf, *pos, *end, *pac_key = NULL;
os_time_t lifetime = 0;
- struct os_time now;
+ struct os_reltime now;
u8 *identity = NULL;
size_t identity_len = 0;
@@ -242,7 +242,7 @@ done:
}
}
- if (os_get_time(&now) < 0 || lifetime <= 0 || now.sec > lifetime) {
+ if (os_get_reltime(&now) < 0 || lifetime <= 0 || now.sec > lifetime) {
wpa_printf(MSG_DEBUG, "EAP-FAST: PAC-Key not valid anymore "
"(lifetime=%ld now=%ld)", lifetime, now.sec);
data->send_new_pac = 2;
@@ -692,10 +692,10 @@ static struct wpabuf * eap_fast_build_pac(struct
eap_sm *sm,
struct eap_tlv_hdr *pac_tlv;
struct pac_tlv_hdr *pac_info;
struct eap_tlv_result_tlv *result;
- struct os_time now;
+ struct os_reltime now;
if (random_get_bytes(pac_key, EAP_FAST_PAC_KEY_LEN) < 0 ||
- os_get_time(&now) < 0)
+ os_get_reltime(&now) < 0)
return NULL;
wpa_hexdump_key(MSG_DEBUG, "EAP-FAST: Generated PAC-Key",
pac_key, EAP_FAST_PAC_KEY_LEN);
--
2.5.0
More information about the Hostap
mailing list