Commit 3a662d95 authored by Masayuki Harada's avatar Masayuki Harada

Move memory for USIM information to UICC.

parent ec7958ed
...@@ -56,14 +56,6 @@ uint8_t *registration_request_buf; ...@@ -56,14 +56,6 @@ uint8_t *registration_request_buf;
uint32_t registration_request_len; uint32_t registration_request_len;
extern char *baseNetAddress; extern char *baseNetAddress;
static uicc_t * checkUicc(int Mod_id) {
if (!PHY_vars_UE_g[Mod_id][0]->uicc) {
char uiccName[64];
sprintf(uiccName,"uicc%d", Mod_id);
PHY_vars_UE_g[Mod_id][0]->uicc=(void*)init_uicc(uiccName);
}
return (uicc_t*) PHY_vars_UE_g[Mod_id][0]->uicc;
}
static int nas_protected_security_header_encode( static int nas_protected_security_header_encode(
char *buffer, char *buffer,
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <openair3/UICC/usim_interface.h> #include <openair3/UICC/usim_interface.h>
#include <openair3/NAS/COMMON/milenage.h> #include <openair3/NAS/COMMON/milenage.h>
extern uint16_t NB_UE_INST;
#define UICC_SECTION "uicc" #define UICC_SECTION "uicc"
#define UICC_CONFIG_HELP_OPTIONS " list of comma separated options to interface a simulated (real UICC to be developped). Available options: \n"\ #define UICC_CONFIG_HELP_OPTIONS " list of comma separated options to interface a simulated (real UICC to be developped). Available options: \n"\
...@@ -43,6 +44,8 @@ ...@@ -43,6 +44,8 @@
{"sqn", "USIM sqn\n", 0, strptr:&(uicc->sqnStr), defstrval:"000000", TYPE_STRING, 0 },\ {"sqn", "USIM sqn\n", 0, strptr:&(uicc->sqnStr), defstrval:"000000", TYPE_STRING, 0 },\
}; };
static uicc_t** uiccArray=NULL;
const char *hexTable="0123456789abcdef"; const char *hexTable="0123456789abcdef";
static inline uint8_t mkDigit(unsigned char in) { static inline uint8_t mkDigit(unsigned char in) {
for (int i=0; i<16; i++) for (int i=0; i<16; i++)
...@@ -91,3 +94,15 @@ void uicc_milenage_generate(uint8_t *autn, uicc_t *uicc) { ...@@ -91,3 +94,15 @@ void uicc_milenage_generate(uint8_t *autn, uicc_t *uicc) {
log_dump(SIM,autn,sizeof(autn), LOG_DUMP_CHAR,"milenage output autn:"); log_dump(SIM,autn,sizeof(autn), LOG_DUMP_CHAR,"milenage output autn:");
} }
uicc_t * checkUicc(int Mod_id) {
AssertFatal(Mod_id < NB_UE_INST, "Mod_id must be less than NB_UE_INST. Mod_id:%d NB_UE_INST:%d", Mod_id,NB_UE_INST);
if(uiccArray==NULL){
uiccArray=(uicc_t **)calloc(1,sizeof(uicc_t*)*NB_UE_INST);
}
if (!uiccArray[Mod_id]) {
char uiccName[64];
sprintf(uiccName,"uicc%d", Mod_id);
uiccArray[Mod_id]=(void*)init_uicc(uiccName);
}
return (uicc_t*) uiccArray[Mod_id];
}
...@@ -68,4 +68,5 @@ typedef struct { ...@@ -68,4 +68,5 @@ typedef struct {
*/ */
uicc_t *init_uicc(char *sectionName); uicc_t *init_uicc(char *sectionName);
void uicc_milenage_generate(uint8_t * autn, uicc_t *uicc); void uicc_milenage_generate(uint8_t * autn, uicc_t *uicc);
uicc_t * checkUicc(int Mod_id);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment