mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.2 KiB
C++
74 lines
2.2 KiB
C++
/**
|
|
*
|
|
* \section COPYRIGHT
|
|
*
|
|
* Copyright 2013-2020 Software Radio Systems Limited
|
|
*
|
|
* By using this file, you agree to the terms and conditions set
|
|
* forth in the LICENSE file which can be found at the top level of
|
|
* the distribution.
|
|
*
|
|
*/
|
|
|
|
#ifndef SRSUE_USIM_H
|
|
#define SRSUE_USIM_H
|
|
|
|
#include "srslte/common/common.h"
|
|
#include "srslte/common/security.h"
|
|
#include "usim_base.h"
|
|
#include <string>
|
|
|
|
namespace srsue {
|
|
|
|
class usim : public usim_base
|
|
{
|
|
public:
|
|
explicit usim(srslog::basic_logger& logger);
|
|
int init(usim_args_t* args);
|
|
void stop();
|
|
|
|
// NAS interface
|
|
auth_result_t generate_authentication_response(uint8_t* rand,
|
|
uint8_t* autn_enb,
|
|
uint16_t mcc,
|
|
uint16_t mnc,
|
|
uint8_t* res,
|
|
int* res_len,
|
|
uint8_t* k_asme);
|
|
|
|
private:
|
|
auth_result_t gen_auth_res_milenage(uint8_t* rand,
|
|
uint8_t* autn_enb,
|
|
uint16_t mcc,
|
|
uint16_t mnc,
|
|
uint8_t* res,
|
|
int* res_len,
|
|
uint8_t* k_asme);
|
|
auth_result_t gen_auth_res_xor(uint8_t* rand,
|
|
uint8_t* autn_enb,
|
|
uint16_t mcc,
|
|
uint16_t mnc,
|
|
uint8_t* res,
|
|
int* res_len,
|
|
uint8_t* k_asme);
|
|
|
|
// Helpers
|
|
virtual std::string get_mnc_str(const uint8_t* imsi_vec, std::string mcc_str) final;
|
|
void str_to_hex(std::string str, uint8_t* hex);
|
|
|
|
// User data
|
|
auth_algo_t auth_algo = auth_algo_milenage;
|
|
uint8_t amf[2] = {}; // 3GPP 33.102 v10.0.0 Annex H
|
|
uint8_t op[16] = {};
|
|
uint8_t opc[16] = {};
|
|
uint8_t k[16] = {};
|
|
|
|
// Security variables
|
|
uint8_t mac[8] = {};
|
|
uint8_t autn[16] = {};
|
|
};
|
|
|
|
} // namespace srsue
|
|
|
|
#endif // SRSUE_USIM_H
|