From 5f3bf1dbacb633961637b7bbbcd7119cb13cb6c6 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Wed, 13 Dec 2017 14:29:13 -0800 Subject: [PATCH] eap-aka: support for synchronization error If the SQN in AUTN is incorrect the simauth module will return the AUTS parameter, which is sent back to the server and the servers SQN number is updated. --- src/eap-aka.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/eap-aka.c b/src/eap-aka.c index fdefcbc6..6c73e4b8 100644 --- a/src/eap-aka.c +++ b/src/eap-aka.c @@ -37,6 +37,7 @@ * EAP-AKA specific values */ #define EAP_AKA_AUTN_LEN 16 +#define EAP_AKA_AUTS_LEN 14 #define EAP_AKA_RES_LEN 8 #define EAP_AKA_K_RE_LEN 32 @@ -163,6 +164,24 @@ static void check_milenage_cb(const uint8_t *res, const uint8_t *ck, uint8_t ik_p[EAP_AKA_IK_LEN]; uint8_t ck_p[EAP_AKA_CK_LEN]; + if (auts) { + /* + * If AUTS is non NULL then the SQN was not correct, send AUTS + * to server which will update the SQN and send another + * challenge packet. + */ + l_free(aka->chal_pkt); + + pos += eap_sim_build_header(eap, aka->type, + EAP_AKA_ST_SYNC_FAILURE, pos, 24); + pos += eap_sim_add_attribute(pos, EAP_SIM_AT_AUTS, + EAP_SIM_PAD_NONE, auts, EAP_AKA_AUTS_LEN); + + eap_send_response(eap, aka->type, response, 24); + + return; + } + if (!res || !ck || !ik) { l_free(aka->chal_pkt); goto chal_error;