From e5d07a4231cf2e3841c725af04118f95aac3e211 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Thu, 1 Feb 2018 12:54:40 +0000 Subject: [PATCH 1/2] Starting to extract AMF value from authentication request (AUTN) in srsUE. --- srsue/src/upper/usim.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/srsue/src/upper/usim.cc b/srsue/src/upper/usim.cc index fe70797e3..f8b45d625 100644 --- a/srsue/src/upper/usim.cc +++ b/srsue/src/upper/usim.cc @@ -356,6 +356,11 @@ void usim::gen_auth_res_milenage( uint8_t *rand, { sqn[i] = autn_enb[i] ^ ak[i]; } + // Extract AMF from autn + for(int i=0;i<2;i++) + { + amf[i]=autn_enb[6+i]; + } // Generate MAC security_milenage_f1( k, @@ -431,6 +436,10 @@ void usim::gen_auth_res_xor(uint8_t *rand, for(i=0;i<6;i++) { sqn[i] = autn_enb[i] ^ ak[i]; } + // Extract AMF from autn + for(int i=0;i<2;i++){ + amf[i]=autn_enb[6+i]; + } // Generate cdout for(i=0; i<6; i++) { From e4b1525982e72736499ba05fda8875abf5eb4b1e Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Thu, 1 Feb 2018 14:08:16 +0000 Subject: [PATCH 2/2] Removed AMF from USIM configuration. AMF is exctracted from the authentication request now. --- srsue/hdr/upper/usim.h | 1 - srsue/src/main.cc | 1 - srsue/src/upper/usim.cc | 7 ------- srsue/test/upper/nas_test.cc | 2 -- srsue/test/upper/usim_test.cc | 1 - srsue/ue.conf.example | 1 - 6 files changed, 13 deletions(-) diff --git a/srsue/hdr/upper/usim.h b/srsue/hdr/upper/usim.h index cf5a4c820..e37f58218 100644 --- a/srsue/hdr/upper/usim.h +++ b/srsue/hdr/upper/usim.h @@ -43,7 +43,6 @@ typedef enum{ typedef struct{ std::string algo; std::string op; - std::string amf; std::string imsi; std::string imei; std::string k; diff --git a/srsue/src/main.cc b/srsue/src/main.cc index 98966510c..498aacd54 100644 --- a/srsue/src/main.cc +++ b/srsue/src/main.cc @@ -124,7 +124,6 @@ void parse_args(all_args_t *args, int argc, char *argv[]) { ("usim.algo", bpo::value(&args->usim.algo), "USIM authentication algorithm") ("usim.op", bpo::value(&args->usim.op), "USIM operator variant") - ("usim.amf", bpo::value(&args->usim.amf), "USIM authentication management field") ("usim.imsi", bpo::value(&args->usim.imsi), "USIM IMSI") ("usim.imei", bpo::value(&args->usim.imei), "USIM IMEI") ("usim.k", bpo::value(&args->usim.k), "USIM K") diff --git a/srsue/src/upper/usim.cc b/srsue/src/upper/usim.cc index f8b45d625..b9f4fda0e 100644 --- a/srsue/src/upper/usim.cc +++ b/srsue/src/upper/usim.cc @@ -53,13 +53,6 @@ void usim::init(usim_args_t *args, srslte::log *usim_log_) usim_log->console("Invalid length for OP: %d should be %d", args->op.length(), 32); } - if(4 == args->amf.length()) { - str_to_hex(args->amf, amf); - } else { - usim_log->error("Invalid length for AMF: %d should be %d", args->amf.length(), 4); - usim_log->console("Invalid length for AMF: %d should be %d", args->amf.length(), 4); - } - if(15 == args->imsi.length()) { imsi = 0; for(i=0; i<15; i++) diff --git a/srsue/test/upper/nas_test.cc b/srsue/test/upper/nas_test.cc index f328d77df..4f4ffb687 100644 --- a/srsue/test/upper/nas_test.cc +++ b/srsue/test/upper/nas_test.cc @@ -117,7 +117,6 @@ int security_command_test() usim_args_t args; args.algo = "xor"; - args.amf = "9001"; args.imei = "353490069873319"; args.imsi = "001010123456789"; args.k = "00112233445566778899aabbccddeeff"; @@ -179,7 +178,6 @@ int mme_attach_request_test() srsue::usim usim; usim_args_t args; args.algo = "xor"; - args.amf = "9001"; args.imei = "353490069873319"; args.imsi = "001010123456789"; args.k = "00112233445566778899aabbccddeeff"; diff --git a/srsue/test/upper/usim_test.cc b/srsue/test/upper/usim_test.cc index 4ac468673..bf60e124c 100644 --- a/srsue/test/upper/usim_test.cc +++ b/srsue/test/upper/usim_test.cc @@ -74,7 +74,6 @@ int main(int argc, char **argv) usim_args_t args; args.algo = "milenage"; - args.amf = "8000"; args.imei = "35609204079301"; args.imsi = "208930000000001"; args.k = "8BAF473F2F8FD09487CCCBD7097C6862"; diff --git a/srsue/ue.conf.example b/srsue/ue.conf.example index 347822072..140662ac0 100644 --- a/srsue/ue.conf.example +++ b/srsue/ue.conf.example @@ -93,7 +93,6 @@ file_max_size = -1 [usim] algo = xor op = 63BFA50EE6523365FF14C1F45F88737D -amf = 9001 k = 00112233445566778899aabbccddeeff imsi = 001010123456789 imei = 353490069873319