|
|
@ -264,34 +264,33 @@ bool hss::gen_auth_info_answer(uint64_t imsi, uint8_t* k_asme, uint8_t* autn, ui
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ret = false; // FIXME
|
|
|
|
|
|
|
|
switch (ue_ctx->algo) {
|
|
|
|
switch (ue_ctx->algo) {
|
|
|
|
case HSS_ALGO_XOR:
|
|
|
|
case HSS_ALGO_XOR:
|
|
|
|
gen_auth_info_answer_xor(ue_ctx, k_asme, autn, rand, xres);
|
|
|
|
gen_auth_info_answer_xor(ue_ctx, k_asme, autn, rand, xres);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case HSS_ALGO_MILENAGE:
|
|
|
|
case HSS_ALGO_MILENAGE:
|
|
|
|
ret = gen_auth_info_answer_milenage(imsi, k_asme, autn, rand, xres);
|
|
|
|
gen_auth_info_answer_milenage(ue_ctx, k_asme, autn, rand, xres);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
increment_ue_sqn(imsi);
|
|
|
|
increment_ue_sqn(imsi);
|
|
|
|
return ret;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool hss::gen_auth_info_answer_milenage(uint64_t imsi, uint8_t* k_asme, uint8_t* autn, uint8_t* rand, uint8_t* xres)
|
|
|
|
void hss::gen_auth_info_answer_milenage(hss_ue_ctx_t* ue_ctx, uint8_t* k_asme, uint8_t* autn, uint8_t* rand, uint8_t* xres)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint8_t k[16];
|
|
|
|
// Get K, AMF, OPC and SQN
|
|
|
|
uint8_t amf[2];
|
|
|
|
uint8_t *k = ue_ctx->key;
|
|
|
|
uint8_t opc[16];
|
|
|
|
uint8_t *amf = ue_ctx->amf;
|
|
|
|
uint8_t sqn[6];
|
|
|
|
uint8_t *opc = ue_ctx->opc;
|
|
|
|
|
|
|
|
uint8_t *sqn = ue_ctx->sqn;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Temp variables
|
|
|
|
|
|
|
|
uint8_t xdout[16];
|
|
|
|
uint8_t ck[16];
|
|
|
|
uint8_t ck[16];
|
|
|
|
uint8_t ik[16];
|
|
|
|
uint8_t ik[16];
|
|
|
|
uint8_t ak[6];
|
|
|
|
uint8_t ak[6];
|
|
|
|
uint8_t mac[8];
|
|
|
|
uint8_t mac[8];
|
|
|
|
|
|
|
|
|
|
|
|
if (!get_k_amf_opc_sqn(imsi, k, amf, opc, sqn)) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
gen_rand(rand);
|
|
|
|
gen_rand(rand);
|
|
|
|
|
|
|
|
|
|
|
|
srslte::security_milenage_f2345(k, opc, rand, xres, ck, ik, ak);
|
|
|
|
srslte::security_milenage_f2345(k, opc, rand, xres, ck, ik, ak);
|
|
|
@ -327,8 +326,9 @@ bool hss::gen_auth_info_answer_milenage(uint64_t imsi, uint8_t* k_asme, uint8_t*
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_hss_log->debug_hex(autn, 16, "User AUTN: ");
|
|
|
|
m_hss_log->debug_hex(autn, 16, "User AUTN: ");
|
|
|
|
|
|
|
|
|
|
|
|
set_last_rand(imsi, rand);
|
|
|
|
// Set last RAND
|
|
|
|
return true;
|
|
|
|
memcpy(ue_ctx->last_rand, rand, 16);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void hss::gen_auth_info_answer_xor(hss_ue_ctx_t* ue_ctx, uint8_t* k_asme, uint8_t* autn, uint8_t* rand, uint8_t* xres)
|
|
|
|
void hss::gen_auth_info_answer_xor(hss_ue_ctx_t* ue_ctx, uint8_t* k_asme, uint8_t* autn, uint8_t* rand, uint8_t* xres)
|
|
|
|