Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AUSF
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
Operations
Operations
Metrics
Environments
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
OpenXG
OpenXG-AUSF
Commits
24b835f4
Commit
24b835f4
authored
Aug 01, 2021
by
Niuhaiwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support multiple UEs' authentication
parent
a635a7ad
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
10 deletions
+26
-10
src/impl/DefaultApiImpl.cpp
src/impl/DefaultApiImpl.cpp
+26
-10
No files found.
src/impl/DefaultApiImpl.cpp
View file @
24b835f4
...
...
@@ -59,10 +59,11 @@ typedef struct {
uint8_t
autn
[
16
];
uint8_t
hxresStar
[
16
];
uint8_t
kseaf
[
32
];
uint8_t
XRES_STAR
[
16
];
//store xres*
}
AUSF_AV_s
;
AUSF_AV_s
ausf_av_s
;
vector
<
AUSF_AV_s
>
all_AVs
;
DefaultApiImpl
::
DefaultApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
)
:
DefaultApi
(
rtr
)
{}
...
...
@@ -114,15 +115,29 @@ void DefaultApiImpl::ue_authentications_auth_ctx_id5g_aka_confirmation_put(
uint8_t
authCtxId_seaf
[
16
];
conv
::
hex_str_to_uint8
(
authCtxId
.
c_str
(),
authCtxId_seaf
);
//authCtxId in seaf
Logger
::
ausf_server
().
debug
(
"authCtxId in ausf: %s"
,
(
conv
::
uint8_to_hex_string
(
ausf_av_s
.
autn
,
16
)).
c_str
());
bool
is_auth_vectors_present
=
Authentication_5gaka
::
equal_uint8
(
ausf_av_s
.
autn
,
authCtxId_seaf
,
16
);
if
(
!
is_auth_vectors_present
)
//AV expired
{
int
ausf_av_index
=
0
;
for
(
int
i
=
0
;
i
<
all_AVs
.
size
();
i
++
){
Logger
::
ausf_server
().
debug
(
"authCtxId in ausf: %s"
,
(
conv
::
uint8_to_hex_string
(
all_AVs
[
i
].
autn
,
16
)).
c_str
());
if
(
Authentication_5gaka
::
equal_uint8
(
all_AVs
[
i
].
autn
,
authCtxId_seaf
,
16
)){
ausf_av_index
=
i
;
break
;
}
}
if
(
ausf_av_index
==
all_AVs
.
size
()){
Logger
::
ausf_server
().
error
(
"Authentication failure by home network with authCtxId %s: AV expired"
,
authCtxId
.
c_str
());
confirmResponse
.
setAuthResult
(
is_auth_vectors_present
);
//向SEAF指示,从本地网络角度认证not成功
confirmResponse
.
setAuthResult
(
false
);
//向SEAF指示,从本地网络角度认证not成功
KAUSF_TMP
=
"invalid"
;
}
//Logger::ausf_server().debug("authCtxId in ausf: %s", (conv::uint8_to_hex_string(ausf_av_s.autn, 16)).c_str());
//bool is_auth_vectors_present = Authentication_5gaka::equal_uint8(ausf_av_s.autn,authCtxId_seaf,16);
//if(!is_auth_vectors_present) //AV expired
//{
// Logger::ausf_server().error("Authentication failure by home network with authCtxId %s: AV expired",authCtxId.c_str());
// confirmResponse.setAuthResult(is_auth_vectors_present); //向SEAF指示,从本地网络角度认证not成功
// KAUSF_TMP = "invalid";
//}
else
//AV valid
{
Logger
::
ausf_server
().
info
(
"AV is up to date, handling received res*..."
);
...
...
@@ -132,7 +147,7 @@ void DefaultApiImpl::ue_authentications_auth_ctx_id5g_aka_confirmation_put(
//2.将接收到的RES*与存储的XRES*进行比较:RES*与XRES*相等,AUSF将从家庭网络角度认为认证成功
//get stored xres* -----
uint8_t
xresStar
[
16
]
=
{
0
};
memcpy
(
xresStar
,
XRES_STAR
,
16
);
//xres* stored for 5g-aka-confirmation
memcpy
(
xresStar
,
all_AVs
[
ausf_av_index
].
XRES_STAR
,
16
);
//xres* stored for 5g-aka-confirmation
Logger
::
ausf_server
().
debug
(
"xres* in ausf: %s"
,
(
conv
::
uint8_to_hex_string
(
xresStar
,
16
)).
c_str
());
Logger
::
ausf_server
().
debug
(
"xres in amf: %s"
,
(
conv
::
uint8_to_hex_string
(
resStar
,
16
)).
c_str
());
...
...
@@ -149,7 +164,7 @@ void DefaultApiImpl::ue_authentications_auth_ctx_id5g_aka_confirmation_put(
//4.send KSEAF to SEAF
string
kseaf_s
;
kseaf_s
=
conv
::
uint8_to_hex_string
(
a
usf_av_s
.
kseaf
,
32
);
// convert uint8_t to string
kseaf_s
=
conv
::
uint8_to_hex_string
(
a
ll_AVs
[
ausf_av_index
]
.
kseaf
,
32
);
// convert uint8_t to string
confirmResponse
.
setKseaf
(
kseaf_s
);
//5.send supi when supi_ausf exists
...
...
@@ -342,7 +357,8 @@ void DefaultApiImpl::ue_authentications_post(
memcpy
(
ausf_av_s
.
autn
,
autn_ausf
,
16
);
memcpy
(
ausf_av_s
.
hxresStar
,
hxresStar
,
16
);
memcpy
(
ausf_av_s
.
kseaf
,
kseaf
,
32
);
memcpy
(
XRES_STAR
,
xresStar
,
16
);
//store xres* in ausf
memcpy
(
ausf_av_s
.
XRES_STAR
,
xresStar
,
16
);
//store xres* in ausf
all_AVs
.
push_back
(
ausf_av_s
);
SUPI_AUSF
=
authenticationInfo
.
getSupiOrSuci
();
//store supi in ausf
SERVING_NN
=
snn
;
//store snn in ausf
AUTH_TYPE
=
authType_udm
;
//store authType in ausf
...
...
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