diff options
author | Martin Willi <martin@strongswan.org> | 2009-10-09 09:03:13 +0200 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2009-10-09 13:02:20 +0200 |
commit | 424ddf801c2150fb38da603bba88e7254477242d (patch) | |
tree | d6c63023d8b6af8ce0417be03e2025da7ec37a93 | |
parent | 655728621bcdd00f5cadfe2b47c718b251eed778 (diff) | |
download | strongswan-424ddf801c2150fb38da603bba88e7254477242d.tar.bz2 strongswan-424ddf801c2150fb38da603bba88e7254477242d.tar.xz |
Do not use monotonic time for AKA sequence numbers, it has an undefined starting point
-rw-r--r-- | src/charon/plugins/eap_aka_3gpp2/eap_aka_3gpp2_provider.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/charon/plugins/eap_aka_3gpp2/eap_aka_3gpp2_provider.c b/src/charon/plugins/eap_aka_3gpp2/eap_aka_3gpp2_provider.c index af20ead38..10e03c83c 100644 --- a/src/charon/plugins/eap_aka_3gpp2/eap_aka_3gpp2_provider.c +++ b/src/charon/plugins/eap_aka_3gpp2/eap_aka_3gpp2_provider.c @@ -75,14 +75,12 @@ void eap_aka_3gpp2_get_sqn(char sqn[AKA_SQN_LEN], int offset) { timeval_t time; - time_monotonic(&time); - /* set sqn to an integer containing seconds followed by most - * significant useconds */ + gettimeofday(&time, NULL); + /* set sqn to an integer containing 4 bytes seconds + 2 bytes usecs */ time.tv_sec = htonl(time.tv_sec + offset); /* usec's are never larger than 0x000f423f, so we shift the 12 first bits */ - time.tv_usec <<= 12; - time.tv_usec = htonl(time.tv_usec); - memcpy(sqn, &time.tv_sec, 4); + time.tv_usec = htonl(time.tv_usec << 12); + memcpy(sqn, (char*)&time.tv_sec + sizeof(time_t) - 4, 4); memcpy(sqn + 4, &time.tv_usec, 2); } |