aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_server/eap_sim.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2007-12-01 03:46:12 (GMT)
committerJouni Malinen <j@w1.fi>2007-12-01 03:46:12 (GMT)
commit190919b400acf238c5ca50cecdb108c5a4251050 (patch)
tree07d5d76f82cd262d65df15750ce4c57306d3da8d /src/eap_server/eap_sim.c
parentae5dcfd4fa5fe703f7022c314015412218869759 (diff)
downloadhostap-history-190919b400acf238c5ca50cecdb108c5a4251050.zip
hostap-history-190919b400acf238c5ca50cecdb108c5a4251050.tar.gz
hostap-history-190919b400acf238c5ca50cecdb108c5a4251050.tar.bz2
Added 'os_' prefix to common C library functions.
Converted some printf() calls to use wpa_printf().
Diffstat (limited to 'src/eap_server/eap_sim.c')
-rw-r--r--src/eap_server/eap_sim.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/eap_server/eap_sim.c b/src/eap_server/eap_sim.c
index 3078717..f08a131 100644
--- a/src/eap_server/eap_sim.c
+++ b/src/eap_server/eap_sim.c
@@ -89,9 +89,9 @@ static void * eap_sim_init(struct eap_sm *sm)
static void eap_sim_reset(struct eap_sm *sm, void *priv)
{
struct eap_sim_data *data = priv;
- free(data->next_pseudonym);
- free(data->next_reauth_id);
- free(data);
+ os_free(data->next_pseudonym);
+ os_free(data->next_reauth_id);
+ os_free(data);
}
@@ -122,10 +122,10 @@ static int eap_sim_build_encr(struct eap_sm *sm, struct eap_sim_data *data,
struct eap_sim_msg *msg, u16 counter,
const u8 *nonce_s)
{
- free(data->next_pseudonym);
+ os_free(data->next_pseudonym);
data->next_pseudonym =
eap_sim_db_get_next_pseudonym(sm->eap_sim_db_priv, 0);
- free(data->next_reauth_id);
+ os_free(data->next_reauth_id);
if (data->counter <= EAP_SIM_MAX_FAST_REAUTHS) {
data->next_reauth_id =
eap_sim_db_get_next_reauth_id(sm->eap_sim_db_priv, 0);
@@ -158,18 +158,18 @@ static int eap_sim_build_encr(struct eap_sm *sm, struct eap_sim_data *data,
wpa_printf(MSG_DEBUG, " *AT_NEXT_PSEUDONYM (%s)",
data->next_pseudonym);
eap_sim_msg_add(msg, EAP_SIM_AT_NEXT_PSEUDONYM,
- strlen(data->next_pseudonym),
+ os_strlen(data->next_pseudonym),
(u8 *) data->next_pseudonym,
- strlen(data->next_pseudonym));
+ os_strlen(data->next_pseudonym));
}
if (data->next_reauth_id) {
wpa_printf(MSG_DEBUG, " *AT_NEXT_REAUTH_ID (%s)",
data->next_reauth_id);
eap_sim_msg_add(msg, EAP_SIM_AT_NEXT_REAUTH_ID,
- strlen(data->next_reauth_id),
+ os_strlen(data->next_reauth_id),
(u8 *) data->next_reauth_id,
- strlen(data->next_reauth_id));
+ os_strlen(data->next_reauth_id));
}
if (eap_sim_msg_add_encr_end(msg, data->k_encr, EAP_SIM_AT_PADDING)) {
@@ -344,11 +344,11 @@ static void eap_sim_process_start(struct eap_sm *sm,
}
if (attr->identity) {
- free(sm->identity);
- sm->identity = malloc(attr->identity_len);
+ os_free(sm->identity);
+ sm->identity = os_malloc(attr->identity_len);
if (sm->identity) {
- memcpy(sm->identity, attr->identity,
- attr->identity_len);
+ os_memcpy(sm->identity, attr->identity,
+ attr->identity_len);
sm->identity_len = attr->identity_len;
}
}
@@ -375,8 +375,8 @@ static void eap_sim_process_start(struct eap_sm *sm,
identity = data->reauth->identity;
identity_len = data->reauth->identity_len;
data->counter = data->reauth->counter;
- memcpy(data->mk, data->reauth->mk,
- EAP_SIM_MK_LEN);
+ os_memcpy(data->mk, data->reauth->mk,
+ EAP_SIM_MK_LEN);
}
}
}
@@ -419,7 +419,7 @@ static void eap_sim_process_start(struct eap_sm *sm,
wpa_hexdump_ascii(MSG_DEBUG, "EAP-SIM: Identity for MK derivation",
sm->identity, sm->identity_len);
- memcpy(data->nonce_mt, attr->nonce_mt, EAP_SIM_NONCE_MT_LEN);
+ os_memcpy(data->nonce_mt, attr->nonce_mt, EAP_SIM_NONCE_MT_LEN);
WPA_PUT_BE16(ver_list, EAP_SIM_VERSION);
eap_sim_derive_mk(sm->identity, sm->identity_len, attr->nonce_mt,
attr->selected_version, ver_list, sizeof(ver_list),
@@ -515,7 +515,7 @@ static void eap_sim_process_reauth(struct eap_sm *sm,
eattr.counter, data->counter);
goto fail;
}
- free(decrypted);
+ os_free(decrypted);
decrypted = NULL;
wpa_printf(MSG_DEBUG, "EAP-SIM: Re-authentication response includes "
@@ -558,7 +558,7 @@ fail:
eap_sim_state(data, FAILURE);
eap_sim_db_remove_reauth(sm->eap_sim_db_priv, data->reauth);
data->reauth = NULL;
- free(decrypted);
+ os_free(decrypted);
}
@@ -632,10 +632,10 @@ static u8 * eap_sim_getKey(struct eap_sm *sm, void *priv, size_t *len)
if (data->state != SUCCESS)
return NULL;
- key = malloc(EAP_SIM_KEYING_DATA_LEN);
+ key = os_malloc(EAP_SIM_KEYING_DATA_LEN);
if (key == NULL)
return NULL;
- memcpy(key, data->msk, EAP_SIM_KEYING_DATA_LEN);
+ os_memcpy(key, data->msk, EAP_SIM_KEYING_DATA_LEN);
*len = EAP_SIM_KEYING_DATA_LEN;
return key;
}
@@ -649,10 +649,10 @@ static u8 * eap_sim_get_emsk(struct eap_sm *sm, void *priv, size_t *len)
if (data->state != SUCCESS)
return NULL;
- key = malloc(EAP_EMSK_LEN);
+ key = os_malloc(EAP_EMSK_LEN);
if (key == NULL)
return NULL;
- memcpy(key, data->emsk, EAP_EMSK_LEN);
+ os_memcpy(key, data->emsk, EAP_EMSK_LEN);
*len = EAP_EMSK_LEN;
return key;
}