Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
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
lizhongxiao
OpenXG-RAN
Commits
b33b4df0
Commit
b33b4df0
authored
Jul 18, 2016
by
Frédéric Leroy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UE/API: rename _usim_api_data to usim_sqn_data and move it to usim_data
parent
ec889250
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
28 deletions
+31
-28
openair3/NAS/UE/API/USIM/usim_api.c
openair3/NAS/UE/API/USIM/usim_api.c
+8
-24
openair3/NAS/UE/API/USIM/usim_api.h
openair3/NAS/UE/API/USIM/usim_api.h
+20
-1
openair3/NAS/UE/EMM/Authentication.c
openair3/NAS/UE/EMM/Authentication.c
+3
-3
No files found.
openair3/NAS/UE/API/USIM/usim_api.c
View file @
b33b4df0
...
@@ -66,22 +66,6 @@ Description Implements the API used by the NAS layer to read/write
...
@@ -66,22 +66,6 @@ Description Implements the API used by the NAS layer to read/write
*/
*/
#define USIM_API_NVRAM_DIRNAME "USIM_DIR"
#define USIM_API_NVRAM_DIRNAME "USIM_DIR"
/*
* List of last used Sequence Numbers SQN
*/
#define USIM_API_AK_SIZE 6
#define USIM_API_SQN_SIZE USIM_API_AK_SIZE
#define USIM_API_SQNMS_SIZE USIM_API_SQN_SIZE
static
struct
_usim_api_data_s
{
/* Highest sequence number the USIM has ever accepted */
uint8_t
sqn_ms
[
USIM_API_SQNMS_SIZE
];
/* List of the last used sequence numbers */
#define USIM_API_SQN_LIST_SIZE 32
uint8_t
n_sqns
;
uint32_t
sqn
[
USIM_API_SQN_LIST_SIZE
];
}
_usim_api_data
;
static
uint8_t
_usim_api_hex_char_to_hex_value
(
char
c
);
static
uint8_t
_usim_api_hex_char_to_hex_value
(
char
c
);
static
void
_usim_api_hex_string_to_hex_value
(
uint8_t
*
hex_value
,
const
char
*
hex_string
,
int
size
);
static
void
_usim_api_hex_string_to_hex_value
(
uint8_t
*
hex_value
,
const
char
*
hex_string
,
int
size
);
static
int
_usim_api_check_sqn
(
uint32_t
seq
,
uint8_t
ind
);
static
int
_usim_api_check_sqn
(
uint32_t
seq
,
uint8_t
ind
);
...
@@ -384,7 +368,7 @@ int usim_api_authenticate_test(const OctetString* rand_pP, const OctetString* au
...
@@ -384,7 +368,7 @@ int usim_api_authenticate_test(const OctetString* rand_pP, const OctetString* au
** Others: None **
** Others: None **
** **
** **
***************************************************************************/
***************************************************************************/
int
usim_api_authenticate
(
u
int8_t
usim_api_k
[
USIM_API_K_SIZE
]
,
const
OctetString
*
rand_pP
,
const
OctetString
*
autn_pP
,
int
usim_api_authenticate
(
u
sim_data_t
*
usim_data
,
const
OctetString
*
rand_pP
,
const
OctetString
*
autn_pP
,
OctetString
*
auts_pP
,
OctetString
*
res_pP
,
OctetString
*
auts_pP
,
OctetString
*
res_pP
,
OctetString
*
ck_pP
,
OctetString
*
ik_pP
)
OctetString
*
ck_pP
,
OctetString
*
ik_pP
)
{
{
...
@@ -402,7 +386,7 @@ int usim_api_authenticate(uint8_t usim_api_k[USIM_API_K_SIZE], const OctetString
...
@@ -402,7 +386,7 @@ int usim_api_authenticate(uint8_t usim_api_k[USIM_API_K_SIZE], const OctetString
/* Compute the anonymity key AK = f5K (RAND) */
/* Compute the anonymity key AK = f5K (RAND) */
u8
ak
[
USIM_API_AK_SIZE
];
u8
ak
[
USIM_API_AK_SIZE
];
f2345
(
usim_api_k
,
rand_pP
->
value
,
f2345
(
usim_
data
->
keys
.
usim_
api_k
,
rand_pP
->
value
,
res_pP
->
value
,
ck_pP
->
value
,
ik_pP
->
value
,
ak
);
res_pP
->
value
,
ck_pP
->
value
,
ik_pP
->
value
,
ak
);
LOG_TRACE
(
INFO
,
"USIM-API - res(f2) :%s"
,
dump_octet_string
(
res_pP
));
LOG_TRACE
(
INFO
,
"USIM-API - res(f2) :%s"
,
dump_octet_string
(
res_pP
));
LOG_TRACE
(
INFO
,
"USIM-API - ck(f3) :%s"
,
dump_octet_string
(
ck_pP
));
LOG_TRACE
(
INFO
,
"USIM-API - ck(f3) :%s"
,
dump_octet_string
(
ck_pP
));
...
@@ -424,7 +408,7 @@ int usim_api_authenticate(uint8_t usim_api_k[USIM_API_K_SIZE], const OctetString
...
@@ -424,7 +408,7 @@ int usim_api_authenticate(uint8_t usim_api_k[USIM_API_K_SIZE], const OctetString
/* Compute XMAC = f1K (SQN || RAND || AMF) */
/* Compute XMAC = f1K (SQN || RAND || AMF) */
#define USIM_API_XMAC_SIZE 8
#define USIM_API_XMAC_SIZE 8
u8
xmac
[
USIM_API_XMAC_SIZE
];
u8
xmac
[
USIM_API_XMAC_SIZE
];
f1
(
usim_api_k
,
rand_pP
->
value
,
sqn
,
&
autn_pP
->
value
[
USIM_API_SQN_SIZE
],
xmac
);
f1
(
usim_
data
->
keys
.
usim_
api_k
,
rand_pP
->
value
,
sqn
,
&
autn_pP
->
value
[
USIM_API_SQN_SIZE
],
xmac
);
LOG_TRACE
(
DEBUG
,
LOG_TRACE
(
DEBUG
,
"USIM-API - Computed XMAC %02X%02X%02X%02X%02X%02X%02X%02X"
,
"USIM-API - Computed XMAC %02X%02X%02X%02X%02X%02X%02X%02X"
,
xmac
[
0
],
xmac
[
1
],
xmac
[
2
],
xmac
[
3
],
xmac
[
0
],
xmac
[
1
],
xmac
[
2
],
xmac
[
3
],
...
@@ -452,19 +436,19 @@ int usim_api_authenticate(uint8_t usim_api_k[USIM_API_K_SIZE], const OctetString
...
@@ -452,19 +436,19 @@ int usim_api_authenticate(uint8_t usim_api_k[USIM_API_K_SIZE], const OctetString
/* Concealed value of the counter SQNms in the USIM:
/* Concealed value of the counter SQNms in the USIM:
* Conc(SQNMS) = SQNMS ⊕ f5*K(RAND) */
* Conc(SQNMS) = SQNMS ⊕ f5*K(RAND) */
f5star
(
usim_api_k
,
rand_pP
->
value
,
ak
);
f5star
(
usim_
data
->
keys
.
usim_
api_k
,
rand_pP
->
value
,
ak
);
u8
sqn_ms
[
USIM_API_SQNMS_SIZE
];
u8
sqn_ms
[
USIM_API_SQNMS_SIZE
];
memset
(
sqn_ms
,
0
,
USIM_API_SQNMS_SIZE
);
memset
(
sqn_ms
,
0
,
USIM_API_SQNMS_SIZE
);
//#define USIM_API_SQN_MS_SIZE 3
//#define USIM_API_SQN_MS_SIZE 3
printf
(
"
_usim_api_data.sqn_ms %p
\n
"
,
_usim_api
_data
.
sqn_ms
);
printf
(
"
usim_data->usim_sqn.sqn_ms %p
\n
"
,
usim_data
->
usim_sqn
_data
.
sqn_ms
);
for
(
i
=
0
;
i
<
USIM_API_SQNMS_SIZE
;
i
++
)
{
for
(
i
=
0
;
i
<
USIM_API_SQNMS_SIZE
;
i
++
)
{
//#warning "LG:BUG HERE TODO"
//#warning "LG:BUG HERE TODO"
printf
(
"i %d: ((uint8_t*)(
_usim_api_data.sqn_ms))[USIM_API_SQNMS_SIZE - i] %d
\n
"
,
i
,
((
uint8_t
*
)(
_usim_api
_data
.
sqn_ms
))[
USIM_API_SQNMS_SIZE
-
i
]);
printf
(
"i %d: ((uint8_t*)(
usim_data->usim_sqn_data.sqn_ms))[USIM_API_SQNMS_SIZE - i] %d
\n
"
,
i
,
((
uint8_t
*
)(
usim_data
->
usim_sqn
_data
.
sqn_ms
))[
USIM_API_SQNMS_SIZE
-
i
]);
sqn_ms
[
USIM_API_SQNMS_SIZE
-
i
]
=
sqn_ms
[
USIM_API_SQNMS_SIZE
-
i
]
=
((
uint8_t
*
)(
_usim_api
_data
.
sqn_ms
))[
USIM_API_SQNMS_SIZE
-
i
];
((
uint8_t
*
)(
usim_data
->
usim_sqn
_data
.
sqn_ms
))[
USIM_API_SQNMS_SIZE
-
i
];
}
}
u8
sqnms
[
USIM_API_SQNMS_SIZE
];
u8
sqnms
[
USIM_API_SQNMS_SIZE
];
...
@@ -480,7 +464,7 @@ int usim_api_authenticate(uint8_t usim_api_k[USIM_API_K_SIZE], const OctetString
...
@@ -480,7 +464,7 @@ int usim_api_authenticate(uint8_t usim_api_k[USIM_API_K_SIZE], const OctetString
* MACS = f1*K(SQNMS || RAND || AMF) */
* MACS = f1*K(SQNMS || RAND || AMF) */
#define USIM_API_MACS_SIZE USIM_API_XMAC_SIZE
#define USIM_API_MACS_SIZE USIM_API_XMAC_SIZE
u8
macs
[
USIM_API_MACS_SIZE
];
u8
macs
[
USIM_API_MACS_SIZE
];
f1star
(
usim_api_k
,
rand_pP
->
value
,
sqn_ms
,
f1star
(
usim_
data
->
keys
.
usim_
api_k
,
rand_pP
->
value
,
sqn_ms
,
&
rand_pP
->
value
[
USIM_API_SQN_SIZE
],
macs
);
&
rand_pP
->
value
[
USIM_API_SQN_SIZE
],
macs
);
LOG_TRACE
(
DEBUG
,
"USIM-API - MACS %02X%02X%02X%02X%02X%02X%02X%02X"
,
LOG_TRACE
(
DEBUG
,
"USIM-API - MACS %02X%02X%02X%02X%02X%02X%02X%02X"
,
macs
[
0
],
macs
[
1
],
macs
[
2
],
macs
[
3
],
macs
[
0
],
macs
[
1
],
macs
[
2
],
macs
[
3
],
...
...
openair3/NAS/UE/API/USIM/usim_api.h
View file @
b33b4df0
...
@@ -115,6 +115,23 @@ typedef struct {
...
@@ -115,6 +115,23 @@ typedef struct {
uint8_t
usim_api_k
[
USIM_API_K_SIZE
];
uint8_t
usim_api_k
[
USIM_API_K_SIZE
];
}
usim_keys_t
;
}
usim_keys_t
;
/*
* List of last used Sequence Numbers SQN
*/
#define USIM_API_AK_SIZE 6
#define USIM_API_SQN_SIZE USIM_API_AK_SIZE
#define USIM_API_SQNMS_SIZE USIM_API_SQN_SIZE
typedef
struct
{
/* Highest sequence number the USIM has ever accepted */
uint8_t
sqn_ms
[
USIM_API_SQNMS_SIZE
];
/* List of the last used sequence numbers */
#define USIM_API_SQN_LIST_SIZE 32
uint8_t
n_sqns
;
uint32_t
sqn
[
USIM_API_SQN_LIST_SIZE
];
}
usim_sqn_data_t
;
/*
/*
* EPS NAS Security Context
* EPS NAS Security Context
* ------------------------
* ------------------------
...
@@ -336,6 +353,8 @@ typedef struct {
...
@@ -336,6 +353,8 @@ typedef struct {
usim_nasconfig_t
nasconfig
;
usim_nasconfig_t
nasconfig
;
/* usim test mode */
/* usim test mode */
uint8_t
usimtestmode
;
uint8_t
usimtestmode
;
usim_sqn_data_t
usim_sqn_data
;
>>>>>>>
UE
/
API
:
rename
_usim_api_data
to
usim_sqn_data
and
move
it
to
usim_data
}
usim_data_t
;
}
usim_data_t
;
/****************************************************************************/
/****************************************************************************/
...
@@ -350,7 +369,7 @@ int usim_api_read(usim_data_t* data);
...
@@ -350,7 +369,7 @@ int usim_api_read(usim_data_t* data);
int
usim_api_write
(
const
usim_data_t
*
data
);
int
usim_api_write
(
const
usim_data_t
*
data
);
int
usim_api_authenticate
(
u
int8_t
usim_api_k
[
USIM_API_K_SIZE
]
,
const
OctetString
*
rand_pP
,
const
OctetString
*
autn_pP
,
int
usim_api_authenticate
(
u
sim_data_t
*
usim_data
,
const
OctetString
*
rand_pP
,
const
OctetString
*
autn_pP
,
OctetString
*
auts
,
OctetString
*
res
,
OctetString
*
auts
,
OctetString
*
res
,
OctetString
*
ck
,
OctetString
*
ik
);
OctetString
*
ck
,
OctetString
*
ik
);
int
usim_api_authenticate_test
(
const
OctetString
*
rand
,
const
OctetString
*
autn
,
int
usim_api_authenticate_test
(
const
OctetString
*
rand
,
const
OctetString
*
autn
,
...
...
openair3/NAS/UE/EMM/Authentication.c
View file @
b33b4df0
...
@@ -75,6 +75,7 @@ Description Defines the authentication EMM procedure executed by the
...
@@ -75,6 +75,7 @@ Description Defines the authentication EMM procedure executed by the
/*
/*
* Retransmission timer handlers
* Retransmission timer handlers
*/
*/
// FIXME REVIEW
extern
void
*
_emm_attach_t3410_handler
(
void
*
);
extern
void
*
_emm_attach_t3410_handler
(
void
*
);
extern
void
*
_emm_service_t3417_handler
(
void
*
);
extern
void
*
_emm_service_t3417_handler
(
void
*
);
extern
void
*
_emm_detach_t3421_handler
(
void
*
);
extern
void
*
_emm_detach_t3421_handler
(
void
*
);
...
@@ -159,7 +160,6 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi,
...
@@ -159,7 +160,6 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi,
int
rc
=
RETURNerror
;
int
rc
=
RETURNerror
;
authentication_data_t
*
authentication_data
=
user
->
authentication_data
;
authentication_data_t
*
authentication_data
=
user
->
authentication_data
;
uint8_t
*
key
=
user
->
usim_data
.
keys
.
usim_api_k
;
emm_timers_t
*
emm_timers
=
user
->
emm_data
->
emm_timers
;
emm_timers_t
*
emm_timers
=
user
->
emm_data
->
emm_timers
;
LOG_TRACE
(
INFO
,
"EMM-PROC - Authentication requested ksi type = %s, ksi = %d"
,
native_ksi
?
"native"
:
"mapped"
,
ksi
);
LOG_TRACE
(
INFO
,
"EMM-PROC - Authentication requested ksi type = %s, ksi = %d"
,
native_ksi
?
"native"
:
"mapped"
,
ksi
);
...
@@ -220,11 +220,11 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi,
...
@@ -220,11 +220,11 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi,
*/
*/
if
(
usim_test
==
0
)
if
(
usim_test
==
0
)
{
{
rc
=
usim_api_authenticate
(
key
,
rand
,
autn
,
&
auts
,
&
res
,
&
ck
,
&
ik
);
rc
=
usim_api_authenticate
(
&
user
->
usim_data
,
rand
,
autn
,
&
auts
,
&
res
,
&
ck
,
&
ik
);
}
}
else
else
{
{
rc
=
usim_api_authenticate_test
(
key
,
rand
,
autn
,
&
auts
,
&
res
,
&
ck
,
&
ik
);
rc
=
usim_api_authenticate_test
(
&
user
->
usim_data
,
rand
,
autn
,
&
auts
,
&
res
,
&
ck
,
&
ik
);
}
}
}
}
...
...
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