From 473e252168f5bb72d91baa886826fb8da49a758b Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Mon, 6 Nov 2017 15:41:14 +0000 Subject: [PATCH] Generating AUTN correctly. UE considers the network valid now. Starting to handle authentication response. --- srsepc/src/hss/hss.cc | 87 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 74 insertions(+), 13 deletions(-) diff --git a/srsepc/src/hss/hss.cc b/srsepc/src/hss/hss.cc index b41d8978b..64bf758bb 100644 --- a/srsepc/src/hss/hss.cc +++ b/srsepc/src/hss/hss.cc @@ -37,7 +37,7 @@ hss* hss::m_instance = NULL; boost::mutex hss_instance_mutex; hss::hss() - :m_sqn(1) + :m_sqn(0x112233445566) { m_pool = srslte::byte_buffer_pool::get_instance(); return; @@ -97,8 +97,8 @@ hss::gen_auth_info_answer_milenage(uint64_t imsi, uint8_t *k_asme, uint8_t *autn uint8_t ak[6]; uint8_t mac[8]; - uint16_t mcc=1; - uint16_t mnc=1; + uint16_t mcc=61441; //001 + uint16_t mnc=65281; //01 if(!get_k_amf_op(imsi,k,amf,op)) { @@ -131,10 +131,40 @@ hss::gen_auth_info_answer_milenage(uint64_t imsi, uint8_t *k_asme, uint8_t *autn mnc, k_asme); + //Generate AUTN (autn = sqn ^ ak |+| amf |+| mac) + for(int i=0;i<6;i++ ) + { + autn[i] = sqn[i]^ak[i]; + } + for(int i=0;i<2;i++) + { + autn[6+i]=amf[i]; + } + for(int i=0;i<8;i++) + { + autn[8+i]=mac[i]; + } + + std::cout<<"IMSI: "<< imsi << std::endl; + std::cout<<"MCC: "<