Add more verbose debug output for GSM-Milenage use (RAND,SRES,Kc)

This commit is contained in:
Jouni Malinen 2008-11-22 14:06:58 +02:00
parent fe2c5241b5
commit a532c108bd

View file

@ -171,6 +171,7 @@ static int eap_sim_gsm_auth(struct eap_sm *sm, struct eap_sim_data *data)
if (conf->password) { if (conf->password) {
u8 opc[16], k[16]; u8 opc[16], k[16];
const char *pos; const char *pos;
size_t i;
wpa_printf(MSG_DEBUG, "EAP-SIM: Use internal GSM-Milenage " wpa_printf(MSG_DEBUG, "EAP-SIM: Use internal GSM-Milenage "
"implementation for authentication"); "implementation for authentication");
if (conf->password_len < 65) { if (conf->password_len < 65) {
@ -189,17 +190,21 @@ static int eap_sim_gsm_auth(struct eap_sm *sm, struct eap_sim_data *data)
if (hexstr2bin(pos, opc, 16)) if (hexstr2bin(pos, opc, 16))
return -1; return -1;
if (gsm_milenage(opc, k, data->rand[0], for (i = 0; i < data->num_chal; i++) {
data->sres[0], data->kc[0]) || if (gsm_milenage(opc, k, data->rand[i],
gsm_milenage(opc, k, data->rand[1], data->sres[i], data->kc[i])) {
data->sres[1], data->kc[1]) || wpa_printf(MSG_DEBUG, "EAP-SIM: "
(data->num_chal > 2 && "GSM-Milenage authentication "
gsm_milenage(opc, k, data->rand[2], "could not be completed");
data->sres[2], data->kc[2]))) {
wpa_printf(MSG_DEBUG, "EAP-SIM: GSM-Milenage "
"authentication could not be completed");
return -1; return -1;
} }
wpa_hexdump(MSG_DEBUG, "EAP-SIM: RAND",
data->rand[i], GSM_RAND_LEN);
wpa_hexdump_key(MSG_DEBUG, "EAP-SIM: SRES",
data->sres[i], EAP_SIM_SRES_LEN);
wpa_hexdump_key(MSG_DEBUG, "EAP-SIM: Kc",
data->kc[i], EAP_SIM_KC_LEN);
}
return 0; return 0;
} }
#endif /* CONFIG_SIM_SIMULATOR */ #endif /* CONFIG_SIM_SIMULATOR */