|
@@ -56,6 +56,7 @@ struct eap_aka_data {
|
|
|
int kdf_negotiation;
|
|
|
u16 last_kdf_attrs[EAP_AKA_PRIME_KDF_MAX];
|
|
|
size_t last_kdf_count;
|
|
|
+ int error_code;
|
|
|
};
|
|
|
|
|
|
|
|
@@ -99,6 +100,9 @@ static void * eap_aka_init(struct eap_sm *sm)
|
|
|
|
|
|
data->eap_method = EAP_TYPE_AKA;
|
|
|
|
|
|
+ /* Zero is a valid error code, so we need to initialize */
|
|
|
+ data->error_code = NO_EAP_METHOD_ERROR;
|
|
|
+
|
|
|
eap_aka_state(data, CONTINUE);
|
|
|
data->prev_id = -1;
|
|
|
|
|
@@ -1180,6 +1184,7 @@ static struct wpabuf * eap_aka_process_notification(
|
|
|
|
|
|
eap_sim_report_notification(sm->msg_ctx, attr->notification, 1);
|
|
|
if (attr->notification >= 0 && attr->notification < 32768) {
|
|
|
+ data->error_code = attr->notification;
|
|
|
eap_aka_state(data, FAILURE);
|
|
|
} else if (attr->notification == EAP_SIM_SUCCESS &&
|
|
|
data->state == RESULT_SUCCESS)
|
|
@@ -1524,6 +1529,23 @@ static u8 * eap_aka_get_emsk(struct eap_sm *sm, void *priv, size_t *len)
|
|
|
}
|
|
|
|
|
|
|
|
|
+static int eap_aka_get_error_code(void *priv)
|
|
|
+{
|
|
|
+ struct eap_aka_data *data = priv;
|
|
|
+ int current_data_error;
|
|
|
+
|
|
|
+ if (!data)
|
|
|
+ return NO_EAP_METHOD_ERROR;
|
|
|
+
|
|
|
+ current_data_error = data->error_code;
|
|
|
+
|
|
|
+ /* Now reset for next transaction */
|
|
|
+ data->error_code = NO_EAP_METHOD_ERROR;
|
|
|
+
|
|
|
+ return current_data_error;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
int eap_peer_aka_register(void)
|
|
|
{
|
|
|
struct eap_method *eap;
|
|
@@ -1544,6 +1566,7 @@ int eap_peer_aka_register(void)
|
|
|
eap->init_for_reauth = eap_aka_init_for_reauth;
|
|
|
eap->get_identity = eap_aka_get_identity;
|
|
|
eap->get_emsk = eap_aka_get_emsk;
|
|
|
+ eap->get_error_code = eap_aka_get_error_code;
|
|
|
|
|
|
return eap_peer_method_register(eap);
|
|
|
}
|
|
@@ -1571,6 +1594,7 @@ int eap_peer_aka_prime_register(void)
|
|
|
eap->init_for_reauth = eap_aka_init_for_reauth;
|
|
|
eap->get_identity = eap_aka_get_identity;
|
|
|
eap->get_emsk = eap_aka_get_emsk;
|
|
|
+ eap->get_error_code = eap_aka_get_error_code;
|
|
|
|
|
|
return eap_peer_method_register(eap);
|
|
|
}
|