Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG UE
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Michael Black
OpenXG UE
Commits
689a27e6
Commit
689a27e6
authored
Jul 26, 2016
by
Frédéric Leroy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UE/USIM/API: fix interface for storing usim_data
parent
77155996
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
45 deletions
+43
-45
openair3/NAS/TOOLS/usim_data.c
openair3/NAS/TOOLS/usim_data.c
+12
-3
openair3/NAS/UE/API/USIM/usim_api.c
openair3/NAS/UE/API/USIM/usim_api.c
+8
-39
openair3/NAS/UE/API/USIM/usim_api.h
openair3/NAS/UE/API/USIM/usim_api.h
+13
-2
openair3/NAS/UE/EMM/emm_main.c
openair3/NAS/UE/EMM/emm_main.c
+1
-1
openair3/NAS/UE/nas_ue_task.c
openair3/NAS/UE/nas_ue_task.c
+8
-0
openair3/NAS/UE/user_defs.h
openair3/NAS/UE/user_defs.h
+1
-0
No files found.
openair3/NAS/TOOLS/usim_data.c
View file @
689a27e6
...
@@ -100,6 +100,16 @@ int main (int argc, const char* argv[])
...
@@ -100,6 +100,16 @@ int main (int argc, const char* argv[])
unsigned
char
gen_data
;
unsigned
char
gen_data
;
/* Get USIM application pathname */
char
*
path
=
memory_get_path
(
USIM_API_NVRAM_DIRNAME
,
USIM_API_NVRAM_FILENAME
);
if
(
path
==
NULL
)
{
fprintf
(
stderr
,
"USIM-API - Failed to get USIM pathname"
);
free
(
path
);
exit
(
EXIT_FAILURE
);
}
/*
/*
* Read command line parameters
* Read command line parameters
*/
*/
...
@@ -415,7 +425,7 @@ int main (int argc, const char* argv[])
...
@@ -415,7 +425,7 @@ int main (int argc, const char* argv[])
/*
/*
* Write USIM application data
* Write USIM application data
*/
*/
rc
=
usim_api_write
(
&
usim_data
);
rc
=
usim_api_write
(
path
,
&
usim_data
);
if
(
rc
!=
RETURNok
)
{
if
(
rc
!=
RETURNok
)
{
perror
(
"ERROR
\t
: usim_api_write() failed"
);
perror
(
"ERROR
\t
: usim_api_write() failed"
);
...
@@ -427,7 +437,7 @@ int main (int argc, const char* argv[])
...
@@ -427,7 +437,7 @@ int main (int argc, const char* argv[])
* Read USIM application data
* Read USIM application data
*/
*/
memset
(
&
usim_data
,
0
,
sizeof
(
usim_data_t
));
memset
(
&
usim_data
,
0
,
sizeof
(
usim_data_t
));
rc
=
usim_api_read
(
&
usim_data
);
rc
=
usim_api_read
(
path
,
&
usim_data
);
if
(
rc
!=
RETURNok
)
{
if
(
rc
!=
RETURNok
)
{
perror
(
"ERROR
\t
: usim_api_read() failed"
);
perror
(
"ERROR
\t
: usim_api_read() failed"
);
...
@@ -443,7 +453,6 @@ int main (int argc, const char* argv[])
...
@@ -443,7 +453,6 @@ int main (int argc, const char* argv[])
/*
/*
* Display USIM file location
* Display USIM file location
*/
*/
char
*
path
=
memory_get_path
(
"USIM_DIR"
,
".usim.nvram"
);
printf
(
"
\n
USIM data file: %s
\n
"
,
path
);
printf
(
"
\n
USIM data file: %s
\n
"
,
path
);
free
(
path
);
free
(
path
);
...
...
openair3/NAS/UE/API/USIM/usim_api.c
View file @
689a27e6
...
@@ -47,6 +47,7 @@ Description Implements the API used by the NAS layer to read/write
...
@@ -47,6 +47,7 @@ Description Implements the API used by the NAS layer to read/write
#include "aka_functions.h"
#include "aka_functions.h"
#include <string.h> // memcpy, memset
#include <string.h> // memcpy, memset
#include <stdlib.h> // malloc, free
#include <stdlib.h> // malloc, free
#include <stdio.h>
/****************************************************************************/
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
...
@@ -56,17 +57,6 @@ Description Implements the API used by the NAS layer to read/write
...
@@ -56,17 +57,6 @@ Description Implements the API used by the NAS layer to read/write
/******************* L O C A L D E F I N I T I O N S *******************/
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
/****************************************************************************/
/*
* The name of the file where are stored data of the USIM application
*/
#define USIM_API_NVRAM_FILENAME ".usim.nvram"
/*
* The name of the environment variable which defines the directory
* where the USIM application file is located
*/
#define USIM_API_NVRAM_DIRNAME "USIM_DIR"
static
int
_usim_api_check_sqn
(
uint32_t
seq
,
uint8_t
ind
);
static
int
_usim_api_check_sqn
(
uint32_t
seq
,
uint8_t
ind
);
/****************************************************************************/
/****************************************************************************/
...
@@ -87,24 +77,14 @@ static int _usim_api_check_sqn(uint32_t seq, uint8_t ind);
...
@@ -87,24 +77,14 @@ static int _usim_api_check_sqn(uint32_t seq, uint8_t ind);
** Others: None **
** Others: None **
** **
** **
***************************************************************************/
***************************************************************************/
int
usim_api_read
(
usim_data_t
*
data
)
int
usim_api_read
(
const
char
*
filename
,
usim_data_t
*
data
)
{
{
LOG_FUNC_IN
;
LOG_FUNC_IN
;
/* Get USIM application pathname */
char
*
path
=
memory_get_path
(
USIM_API_NVRAM_DIRNAME
,
USIM_API_NVRAM_FILENAME
);
if
(
path
==
NULL
)
{
LOG_TRACE
(
ERROR
,
"USIM-API - Failed to get USIM pathname"
);
LOG_FUNC_RETURN
(
RETURNerror
);
}
/* Read USIM application data */
/* Read USIM application data */
if
(
memory_read
(
path
,
data
,
sizeof
(
usim_data_t
))
!=
RETURNok
)
{
if
(
memory_read
(
filename
,
data
,
sizeof
(
usim_data_t
))
!=
RETURNok
)
{
LOG_TRACE
(
ERROR
,
"USIM-API - %s file is either not valid "
LOG_TRACE
(
ERROR
,
"USIM-API - %s file is either not valid "
"or not present"
,
path
);
"or not present"
,
filename
);
free
(
path
);
LOG_FUNC_RETURN
(
RETURNerror
);
LOG_FUNC_RETURN
(
RETURNerror
);
}
}
...
@@ -123,7 +103,7 @@ int usim_api_read(usim_data_t* data)
...
@@ -123,7 +103,7 @@ int usim_api_read(usim_data_t* data)
0x11
,
0x11
,
0x11
,
0x11
,
0x11
,
0x11
,
0x11
,
0x11
};
0x11
,
0x11
,
0x11
,
0x11
,
0x11
,
0x11
,
0x11
,
0x11
};
#endif
#endif
memcpy
(
data
->
keys
.
op
,
_op
,
sizeof
(
_op
));
memcpy
(
data
->
keys
.
op
,
_op
,
sizeof
(
_op
));
free
(
path
);
LOG_FUNC_RETURN
(
RETURNok
);
LOG_FUNC_RETURN
(
RETURNok
);
}
}
...
@@ -141,28 +121,17 @@ int usim_api_read(usim_data_t* data)
...
@@ -141,28 +121,17 @@ int usim_api_read(usim_data_t* data)
** Others: None **
** Others: None **
** **
** **
***************************************************************************/
***************************************************************************/
int
usim_api_write
(
const
usim_data_t
*
data
)
int
usim_api_write
(
const
char
*
filename
,
const
usim_data_t
*
data
)
{
{
LOG_FUNC_IN
;
LOG_FUNC_IN
;
/* Get USIM application pathname */
char
*
path
=
memory_get_path
(
USIM_API_NVRAM_DIRNAME
,
USIM_API_NVRAM_FILENAME
);
if
(
path
==
NULL
)
{
LOG_TRACE
(
ERROR
,
"USIM-API - Failed to get USIM pathname"
);
LOG_FUNC_RETURN
(
RETURNerror
);
}
/* Write USIM application data */
/* Write USIM application data */
if
(
memory_write
(
path
,
data
,
sizeof
(
usim_data_t
))
!=
RETURNok
)
{
if
(
memory_write
(
filename
,
data
,
sizeof
(
usim_data_t
))
!=
RETURNok
)
{
LOG_TRACE
(
ERROR
,
"USIM-API - Unable to write USIM file %s"
,
path
);
LOG_TRACE
(
ERROR
,
"USIM-API - Unable to write USIM file %s"
,
filename
);
free
(
path
);
LOG_FUNC_RETURN
(
RETURNerror
);
LOG_FUNC_RETURN
(
RETURNerror
);
}
}
free
(
path
);
LOG_FUNC_RETURN
(
RETURNok
);
LOG_FUNC_RETURN
(
RETURNok
);
}
}
...
...
openair3/NAS/UE/API/USIM/usim_api.h
View file @
689a27e6
...
@@ -54,6 +54,17 @@ Description Implements the API used by the NAS layer to read/write
...
@@ -54,6 +54,17 @@ Description Implements the API used by the NAS layer to read/write
#define USIM_API_K_SIZE 16
#define USIM_API_K_SIZE 16
#define USIM_API_K_VALUE "fec86ba6eb707ed08905757b1bb44b8f"
#define USIM_API_K_VALUE "fec86ba6eb707ed08905757b1bb44b8f"
/*
* The name of the file where are stored data of the USIM application
*/
#define USIM_API_NVRAM_FILENAME ".usim.nvram"
/*
* The name of the environment variable which defines the directory
* where the USIM application file is located
*/
#define USIM_API_NVRAM_DIRNAME "USIM_DIR"
/****************************************************************************/
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/****************************************************************************/
...
@@ -366,9 +377,9 @@ typedef struct {
...
@@ -366,9 +377,9 @@ typedef struct {
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
/****************************************************************************/
int
usim_api_read
(
usim_data_t
*
data
);
int
usim_api_read
(
const
char
*
filename
,
usim_data_t
*
data
);
int
usim_api_write
(
const
usim_data_t
*
data
);
int
usim_api_write
(
const
char
*
filename
,
const
usim_data_t
*
data
);
int
usim_api_authenticate
(
usim_data_t
*
usim_data
,
const
OctetString
*
rand_pP
,
const
OctetString
*
autn_pP
,
int
usim_api_authenticate
(
usim_data_t
*
usim_data
,
const
OctetString
*
rand_pP
,
const
OctetString
*
autn_pP
,
OctetString
*
auts
,
OctetString
*
res
,
OctetString
*
auts
,
OctetString
*
res
,
...
...
openair3/NAS/UE/EMM/emm_main.c
View file @
689a27e6
...
@@ -193,7 +193,7 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
...
@@ -193,7 +193,7 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
/*
/*
* Get USIM application data
* Get USIM application data
*/
*/
if
(
usim_api_read
(
&
user
->
usim_data
)
!=
RETURNok
)
{
if
(
usim_api_read
(
user
->
usim_data_store
,
&
user
->
usim_data
)
!=
RETURNok
)
{
/* The USIM application may not be present or not valid */
/* The USIM application may not be present or not valid */
LOG_TRACE
(
WARNING
,
"EMM-MAIN - Failed to read USIM application data"
);
LOG_TRACE
(
WARNING
,
"EMM-MAIN - Failed to read USIM application data"
);
}
else
{
}
else
{
...
...
openair3/NAS/UE/nas_ue_task.c
View file @
689a27e6
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
# include "nas_parser.h"
# include "nas_parser.h"
# include "nas_proc.h"
# include "nas_proc.h"
# include "msc.h"
# include "msc.h"
# include "memory.h"
#include "nas_user.h"
#include "nas_user.h"
...
@@ -94,6 +95,13 @@ void *nas_ue_task(void *args_p)
...
@@ -94,6 +95,13 @@ void *nas_ue_task(void *args_p)
MSC_START_USE
();
MSC_START_USE
();
/* Initialize UE NAS (EURECOM-NAS) */
/* Initialize UE NAS (EURECOM-NAS) */
{
{
/* Get USIM data application filename */
user
->
usim_data_store
=
memory_get_path
(
USIM_API_NVRAM_DIRNAME
,
USIM_API_NVRAM_FILENAME
);
if
(
user
->
usim_data_store
==
NULL
)
{
LOG_E
(
NAS
,
"[UE %d] - Failed to get USIM data application filename"
,
user
->
ueid
);
exit
(
EXIT_FAILURE
);
}
/* Initialize user interface (to exchange AT commands with user process) */
/* Initialize user interface (to exchange AT commands with user process) */
nas_user_api_id_initialize
(
user
);
nas_user_api_id_initialize
(
user
);
user
->
user_at_commands
=
calloc_or_fail
(
sizeof
(
user_at_commands_t
));
user
->
user_at_commands
=
calloc_or_fail
(
sizeof
(
user_at_commands_t
));
...
...
openair3/NAS/UE/user_defs.h
View file @
689a27e6
...
@@ -75,6 +75,7 @@ typedef struct {
...
@@ -75,6 +75,7 @@ typedef struct {
security_data_t
*
security_data
;
//Internal data used for security mode control procedure
security_data_t
*
security_data
;
//Internal data used for security mode control procedure
// Hardware persistent storage
// Hardware persistent storage
usim_data_t
usim_data
;
// USIM application data
usim_data_t
usim_data
;
// USIM application data
const
char
*
usim_data_store
;
// USIM application data filename
user_nvdata_t
*
nas_user_nvdata
;
//UE parameters stored in the UE's non-volatile memory device
user_nvdata_t
*
nas_user_nvdata
;
//UE parameters stored in the UE's non-volatile memory device
//
//
nas_user_context_t
*
nas_user_context
;
nas_user_context_t
*
nas_user_context
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment