Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AMF-Simple
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
CommunityXG
OpenXG-AMF-Simple
Commits
510181bb
Commit
510181bb
authored
Mar 02, 2021
by
yangjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG: Part of the Ausf code was accidentally deleted
parent
7914083c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
24 deletions
+33
-24
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+33
-24
No files found.
src/amf-app/amf_n1.cpp
View file @
510181bb
...
@@ -1730,30 +1730,39 @@ void amf_n1::authentication_response_handle(uint32_t ran_ue_ngap_id,
...
@@ -1730,30 +1730,39 @@ void amf_n1::authentication_response_handle(uint32_t ran_ue_ngap_id,
Logger
::
amf_n1
().
warn
(
Logger
::
amf_n1
().
warn
(
"Cannot receive AuthenticationResponseParameter (RES*)"
);
"Cannot receive AuthenticationResponseParameter (RES*)"
);
}
else
{
}
else
{
// Get stored XRES*
if
(
amf_cfg
.
is_Nausf
)
int
secu_index
=
nc
.
get
()
->
security_ctx
->
vector_pointer
;
{
uint8_t
*
hxresStar
=
nc
.
get
()
->
_5g_av
[
secu_index
].
hxresStar
;
std
::
string
data
=
bdata
(
resStar
);
// Calculate HRES* from received RES*, then compare with XRES stored in
if
(
!
_5g_aka_confirmation_from_ausf
(
nc
,
data
))
// nas_context
isAuthOk
=
false
;
uint8_t
inputstring
[
32
];
}
uint8_t
*
res
=
(
uint8_t
*
)
bdata
(
resStar
);
else
Logger
::
amf_n1
().
debug
(
"Start to calculate HRES* from received RES*"
);
{
memcpy
(
&
inputstring
[
0
],
nc
.
get
()
->
_5g_av
[
secu_index
].
rand
,
16
);
// Get stored XRES*
memcpy
(
&
inputstring
[
16
],
res
,
blength
(
resStar
));
int
secu_index
=
nc
.
get
()
->
security_ctx
->
vector_pointer
;
unsigned
char
sha256Out
[
Sha256
::
DIGEST_SIZE
];
uint8_t
*
hxresStar
=
nc
.
get
()
->
_5g_av
[
secu_index
].
hxresStar
;
sha256
((
unsigned
char
*
)
inputstring
,
16
+
blength
(
resStar
),
sha256Out
);
// Calculate HRES* from received RES*, then compare with XRES stored in
uint8_t
hres
[
16
];
// nas_context
for
(
int
i
=
0
;
i
<
16
;
i
++
)
hres
[
i
]
=
(
uint8_t
)
sha256Out
[
i
];
uint8_t
inputstring
[
32
];
print_buffer
(
"amf_n1"
,
"Received RES* From Authentication-Response"
,
res
,
uint8_t
*
res
=
(
uint8_t
*
)
bdata
(
resStar
);
16
);
Logger
::
amf_n1
().
debug
(
"Start to calculate HRES* from received RES*"
);
print_buffer
(
"amf_n1"
,
"Stored XRES* in 5G HE AV"
,
memcpy
(
&
inputstring
[
0
],
nc
.
get
()
->
_5g_av
[
secu_index
].
rand
,
16
);
nc
.
get
()
->
_5g_he_av
[
secu_index
].
xresStar
,
16
);
memcpy
(
&
inputstring
[
16
],
res
,
blength
(
resStar
));
print_buffer
(
"amf_n1"
,
"Stored XRES in 5G HE AV"
,
unsigned
char
sha256Out
[
Sha256
::
DIGEST_SIZE
];
nc
.
get
()
->
_5g_he_av
[
secu_index
].
xres
,
8
);
sha256
((
unsigned
char
*
)
inputstring
,
16
+
blength
(
resStar
),
sha256Out
);
print_buffer
(
"amf_n1"
,
"Computed HRES* from RES*"
,
hres
,
16
);
uint8_t
hres
[
16
];
print_buffer
(
"amf_n1"
,
"Computed HXRES* from XRES*"
,
hxresStar
,
16
);
for
(
int
i
=
0
;
i
<
16
;
i
++
)
hres
[
i
]
=
(
uint8_t
)
sha256Out
[
i
];
for
(
int
i
=
0
;
i
<
16
;
i
++
)
{
print_buffer
(
"amf_n1"
,
"Received RES* From Authentication-Response"
,
res
,
if
(
hxresStar
[
i
]
!=
hres
[
i
])
isAuthOk
=
false
;
16
);
print_buffer
(
"amf_n1"
,
"Stored XRES* in 5G HE AV"
,
nc
.
get
()
->
_5g_he_av
[
secu_index
].
xresStar
,
16
);
print_buffer
(
"amf_n1"
,
"Stored XRES in 5G HE AV"
,
nc
.
get
()
->
_5g_he_av
[
secu_index
].
xres
,
8
);
print_buffer
(
"amf_n1"
,
"Computed HRES* from RES*"
,
hres
,
16
);
print_buffer
(
"amf_n1"
,
"Computed HXRES* from XRES*"
,
hxresStar
,
16
);
for
(
int
i
=
0
;
i
<
16
;
i
++
)
{
if
(
hxresStar
[
i
]
!=
hres
[
i
])
isAuthOk
=
false
;
}
}
}
}
}
// If success, start SMC procedure; else if failure, response registration
// If success, start SMC procedure; else if failure, response registration
...
...
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