Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openairinterface5G
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dyyu
openairinterface5G
Commits
b33b4df0
Commit
b33b4df0
authored
8 years ago
by
FredericLeroy
Browse files
Options
Downloads
Patches
Plain Diff
UE/API: rename _usim_api_data to usim_sqn_data and move it to usim_data
parent
ec889250
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
openair3/NAS/UE/API/USIM/usim_api.c
+8
-24
8 additions, 24 deletions
openair3/NAS/UE/API/USIM/usim_api.c
openair3/NAS/UE/API/USIM/usim_api.h
+20
-1
20 additions, 1 deletion
openair3/NAS/UE/API/USIM/usim_api.h
openair3/NAS/UE/EMM/Authentication.c
+3
-3
3 additions, 3 deletions
openair3/NAS/UE/EMM/Authentication.c
with
31 additions
and
28 deletions
openair3/NAS/UE/API/USIM/usim_api.c
+
8
−
24
View file @
b33b4df0
...
...
@@ -66,22 +66,6 @@ Description Implements the API used by the NAS layer to read/write
*/
#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
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
);
...
...
@@ -384,7 +368,7 @@ int usim_api_authenticate_test(const OctetString* rand_pP, const OctetString* au
** 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
*
ck_pP
,
OctetString
*
ik_pP
)
{
...
...
@@ -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) */
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
);
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
));
...
...
@@ -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) */
#define USIM_API_XMAC_SIZE 8
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
,
"USIM-API - Computed XMAC %02X%02X%02X%02X%02X%02X%02X%02X"
,
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
/* Concealed value of the counter SQNms in the USIM:
* 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
];
memset
(
sqn_ms
,
0
,
USIM_API_SQNMS_SIZE
);
//#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
++
)
{
//#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
]
=
((
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
];
...
...
@@ -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) */
#define USIM_API_MACS_SIZE USIM_API_XMAC_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
);
LOG_TRACE
(
DEBUG
,
"USIM-API - MACS %02X%02X%02X%02X%02X%02X%02X%02X"
,
macs
[
0
],
macs
[
1
],
macs
[
2
],
macs
[
3
],
...
...
This diff is collapsed.
Click to expand it.
openair3/NAS/UE/API/USIM/usim_api.h
+
20
−
1
View file @
b33b4df0
...
...
@@ -115,6 +115,23 @@ typedef struct {
uint8_t
usim_api_k
[
USIM_API_K_SIZE
];
}
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
* ------------------------
...
...
@@ -336,6 +353,8 @@ typedef struct {
usim_nasconfig_t
nasconfig
;
/* usim test mode */
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
;
/****************************************************************************/
...
...
@@ -350,7 +369,7 @@ int usim_api_read(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
*
ck
,
OctetString
*
ik
);
int
usim_api_authenticate_test
(
const
OctetString
*
rand
,
const
OctetString
*
autn
,
...
...
This diff is collapsed.
Click to expand it.
openair3/NAS/UE/EMM/Authentication.c
+
3
−
3
View file @
b33b4df0
...
...
@@ -75,6 +75,7 @@ Description Defines the authentication EMM procedure executed by the
/*
* Retransmission timer handlers
*/
// FIXME REVIEW
extern
void
*
_emm_attach_t3410_handler
(
void
*
);
extern
void
*
_emm_service_t3417_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,
int
rc
=
RETURNerror
;
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
;
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,
*/
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
{
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
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment