From a1ceb34bec6ad3a200623dd5e53d2407822bb626 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Wed, 13 Dec 2017 13:19:36 -0800 Subject: [PATCH] simauth: fixup to add proper return values The GSM and Milenage API's should return an integer which can be used to cancel the request, they were returning bool. --- src/simauth.c | 8 ++++---- src/simauth.h | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/simauth.c b/src/simauth.c index 76ecd334..2c0bccd5 100644 --- a/src/simauth.c +++ b/src/simauth.c @@ -152,12 +152,12 @@ void sim_auth_unregistered_watch_remove(struct iwd_sim_auth *auth, watchlist_remove(&auth->auth_watchers, id); } -bool sim_auth_check_milenage(struct iwd_sim_auth *auth, +int sim_auth_check_milenage(struct iwd_sim_auth *auth, const uint8_t *rand, const uint8_t *autn, sim_auth_check_milenage_cb_t cb, void *data) { if (!auth->aka_supported) - return false; + return -1; /* save ID in case simauth is destroyed */ auth->pending = auth->driver->check_milenage(auth, rand, autn, @@ -166,11 +166,11 @@ bool sim_auth_check_milenage(struct iwd_sim_auth *auth, return auth->pending; } -bool sim_auth_run_gsm(struct iwd_sim_auth *auth, const uint8_t *rands, +int sim_auth_run_gsm(struct iwd_sim_auth *auth, const uint8_t *rands, int num_rands, sim_auth_run_gsm_cb_t cb, void *data) { if (!auth->sim_supported) - return false; + return -1; /* save ID in case simauth is destroyed */ auth->pending = auth->driver->run_gsm(auth, rands, num_rands, cb, data); diff --git a/src/simauth.h b/src/simauth.h index 6b9bcda5..6ffb049a 100644 --- a/src/simauth.h +++ b/src/simauth.h @@ -126,9 +126,10 @@ struct iwd_sim_auth *iwd_sim_auth_find(bool sim, bool aka); * @param cb Callback with milenage values * @param data User data * - * @param False if there was an error + * @return Transaction ID, used to cancel the request if needed + * < 0 in case of an error */ -bool sim_auth_check_milenage(struct iwd_sim_auth *auth, +int sim_auth_check_milenage(struct iwd_sim_auth *auth, const uint8_t *rand, const uint8_t *autn, sim_auth_check_milenage_cb_t cb, void *data); @@ -141,9 +142,10 @@ bool sim_auth_check_milenage(struct iwd_sim_auth *auth, * @param cb Callback with GSM key values * @param data User data * - * @return False if there was an error + * @return Transaction ID, used to cancel the request if needed + * < 0 in case of an error */ -bool sim_auth_run_gsm(struct iwd_sim_auth *auth, const uint8_t *rands, +int sim_auth_run_gsm(struct iwd_sim_auth *auth, const uint8_t *rands, int num_rands, sim_auth_run_gsm_cb_t cb, void *data); void sim_auth_cancel_request(struct iwd_sim_auth *auth, int id);