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
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
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-AMF
Commits
7ae3dee0
Commit
7ae3dee0
authored
Feb 08, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup Authentication Response/Result
parent
57928508
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
16 deletions
+18
-16
src/nas/ies/EapMessage.cpp
src/nas/ies/EapMessage.cpp
+2
-1
src/nas/ies/EapMessage.hpp
src/nas/ies/EapMessage.hpp
+2
-2
src/nas/msgs/AuthenticationResponse.cpp
src/nas/msgs/AuthenticationResponse.cpp
+3
-2
src/nas/msgs/AuthenticationResponse.hpp
src/nas/msgs/AuthenticationResponse.hpp
+2
-2
src/nas/msgs/AuthenticationResult.cpp
src/nas/msgs/AuthenticationResult.cpp
+8
-8
src/nas/msgs/AuthenticationResult.hpp
src/nas/msgs/AuthenticationResult.hpp
+1
-1
No files found.
src/nas/ies/EapMessage.cpp
View file @
7ae3dee0
...
@@ -37,7 +37,8 @@ EapMessage::EapMessage(uint8_t iei) : Type6NasIe(iei), eap_() {
...
@@ -37,7 +37,8 @@ EapMessage::EapMessage(uint8_t iei) : Type6NasIe(iei), eap_() {
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
EapMessage
::
EapMessage
(
const
uint8_t
iei
,
bstring
eap
)
:
Type6NasIe
(
iei
)
{
EapMessage
::
EapMessage
(
const
uint8_t
iei
,
const
bstring
&
eap
)
:
Type6NasIe
(
iei
)
{
eap_
=
bstrcpy
(
eap
);
eap_
=
bstrcpy
(
eap
);
SetLengthIndicator
(
blength
(
eap
));
SetLengthIndicator
(
blength
(
eap
));
}
}
...
...
src/nas/ies/EapMessage.hpp
View file @
7ae3dee0
...
@@ -34,8 +34,8 @@ class EapMessage : public Type6NasIe {
...
@@ -34,8 +34,8 @@ class EapMessage : public Type6NasIe {
public:
public:
EapMessage
();
EapMessage
();
EapMessage
(
uint8_t
iei
);
EapMessage
(
uint8_t
iei
);
EapMessage
(
bstring
eap
);
EapMessage
(
const
bstring
&
eap
);
EapMessage
(
uint8_t
iei
,
bstring
eap
);
EapMessage
(
uint8_t
iei
,
const
bstring
&
eap
);
~
EapMessage
();
~
EapMessage
();
static
std
::
string
GetIeName
()
{
return
kEapMessageIeName
;
}
static
std
::
string
GetIeName
()
{
return
kEapMessageIeName
;
}
...
...
src/nas/msgs/AuthenticationResponse.cpp
View file @
7ae3dee0
...
@@ -49,7 +49,8 @@ void AuthenticationResponse::SetAuthenticationResponseParameter(
...
@@ -49,7 +49,8 @@ void AuthenticationResponse::SetAuthenticationResponseParameter(
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
AuthenticationResponse
::
GetAuthenticationResponseParameter
(
bstring
&
para
)
{
bool
AuthenticationResponse
::
GetAuthenticationResponseParameter
(
bstring
&
para
)
const
{
if
(
ie_authentication_response_parameter
.
has_value
())
{
if
(
ie_authentication_response_parameter
.
has_value
())
{
ie_authentication_response_parameter
.
value
().
GetValue
(
para
);
ie_authentication_response_parameter
.
value
().
GetValue
(
para
);
return
true
;
return
true
;
...
@@ -64,7 +65,7 @@ void AuthenticationResponse::SetEapMessage(const bstring& eap) {
...
@@ -64,7 +65,7 @@ void AuthenticationResponse::SetEapMessage(const bstring& eap) {
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
AuthenticationResponse
::
GetEapMessage
(
bstring
&
eap
)
{
bool
AuthenticationResponse
::
GetEapMessage
(
bstring
&
eap
)
const
{
if
(
ie_eap_message
.
has_value
())
{
if
(
ie_eap_message
.
has_value
())
{
ie_eap_message
.
value
().
GetValue
(
eap
);
ie_eap_message
.
value
().
GetValue
(
eap
);
return
true
;
return
true
;
...
...
src/nas/msgs/AuthenticationResponse.hpp
View file @
7ae3dee0
...
@@ -37,10 +37,10 @@ class AuthenticationResponse : public NasMmPlainHeader {
...
@@ -37,10 +37,10 @@ class AuthenticationResponse : public NasMmPlainHeader {
void
SetHeader
(
uint8_t
security_header_type
);
void
SetHeader
(
uint8_t
security_header_type
);
void
SetAuthenticationResponseParameter
(
const
bstring
&
para
);
void
SetAuthenticationResponseParameter
(
const
bstring
&
para
);
bool
GetAuthenticationResponseParameter
(
bstring
&
para
);
bool
GetAuthenticationResponseParameter
(
bstring
&
para
)
const
;
void
SetEapMessage
(
const
bstring
&
eap
);
void
SetEapMessage
(
const
bstring
&
eap
);
bool
GetEapMessage
(
bstring
&
eap
);
bool
GetEapMessage
(
bstring
&
eap
)
const
;
public:
public:
std
::
optional
<
AuthenticationResponseParameter
>
std
::
optional
<
AuthenticationResponseParameter
>
...
...
src/nas/msgs/AuthenticationResult.cpp
View file @
7ae3dee0
...
@@ -42,9 +42,9 @@ void AuthenticationResult::SetHeader(uint8_t security_header_type) {
...
@@ -42,9 +42,9 @@ void AuthenticationResult::SetHeader(uint8_t security_header_type) {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
AuthenticationResult
::
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
)
{
void
AuthenticationResult
::
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
)
{
ie_ng
KSI
.
Set
(
false
);
// 4 lower bits
ie_ng
_ksi
.
Set
(
false
);
// 4 lower bits
ie_ng
KSI
.
SetTypeOfSecurityContext
(
tsc
);
ie_ng
_ksi
.
SetTypeOfSecurityContext
(
tsc
);
ie_ng
KSI
.
SetNasKeyIdentifier
(
key_set_id
);
ie_ng
_ksi
.
SetNasKeyIdentifier
(
key_set_id
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -53,7 +53,7 @@ void AuthenticationResult::SetAbba(uint8_t length, uint8_t* value) {
...
@@ -53,7 +53,7 @@ void AuthenticationResult::SetAbba(uint8_t length, uint8_t* value) {
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
AuthenticationResult
::
SetEapMessage
(
bstring
eap
)
{
void
AuthenticationResult
::
SetEapMessage
(
const
bstring
&
eap
)
{
ie_eap_message
.
SetValue
(
eap
);
ie_eap_message
.
SetValue
(
eap
);
}
}
...
@@ -72,7 +72,7 @@ int AuthenticationResult::Encode(uint8_t* buf, int len) {
...
@@ -72,7 +72,7 @@ int AuthenticationResult::Encode(uint8_t* buf, int len) {
encoded_size
+=
encoded_ie_size
;
encoded_size
+=
encoded_ie_size
;
// ngKSI
// ngKSI
int
size
=
ie_ng
KSI
.
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
int
size
=
ie_ng
_ksi
.
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
size
!=
KEncodeDecodeError
)
{
if
(
size
!=
KEncodeDecodeError
)
{
encoded_size
+=
size
;
encoded_size
+=
size
;
}
else
{
}
else
{
...
@@ -81,7 +81,7 @@ int AuthenticationResult::Encode(uint8_t* buf, int len) {
...
@@ -81,7 +81,7 @@ int AuthenticationResult::Encode(uint8_t* buf, int len) {
return
KEncodeDecodeError
;
return
KEncodeDecodeError
;
}
}
// Spare half octet
// Spare half octet
encoded_size
++
;
// 1/2 octet + 1/2 octet from ie_ng
KSI
encoded_size
++
;
// 1/2 octet + 1/2 octet from ie_ng
_ksi
// EAP message
// EAP message
size
=
ie_eap_message
.
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
size
=
ie_eap_message
.
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
...
@@ -126,7 +126,7 @@ int AuthenticationResult::Decode(uint8_t* buf, int len) {
...
@@ -126,7 +126,7 @@ int AuthenticationResult::Decode(uint8_t* buf, int len) {
// NAS key set identifier
// NAS key set identifier
decoded_result
=
decoded_result
=
ie_ng
KSI
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
,
false
);
ie_ng
_ksi
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
,
false
);
if
(
decoded_result
==
KEncodeDecodeError
)
{
if
(
decoded_result
==
KEncodeDecodeError
)
{
Logger
::
nas_mm
().
error
(
Logger
::
nas_mm
().
error
(
"Decoding %s error"
,
NasKeySetIdentifier
::
GetIeName
().
c_str
());
"Decoding %s error"
,
NasKeySetIdentifier
::
GetIeName
().
c_str
());
...
@@ -154,7 +154,7 @@ int AuthenticationResult::Decode(uint8_t* buf, int len) {
...
@@ -154,7 +154,7 @@ int AuthenticationResult::Decode(uint8_t* buf, int len) {
while
((
octet
!=
0x0
))
{
while
((
octet
!=
0x0
))
{
switch
(
octet
)
{
switch
(
octet
)
{
case
kIeiAbba
:
{
case
kIeiAbba
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI
(0x38)"
);
Logger
::
nas_mm
().
debug
(
"Decoding IEI
0x%x"
,
kIeiAbba
);
ABBA
ie_abba_tmp
=
{};
ABBA
ie_abba_tmp
=
{};
if
((
decoded_result
=
ie_abba_tmp
.
Decode
(
if
((
decoded_result
=
ie_abba_tmp
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
))
==
buf
+
decoded_size
,
len
-
decoded_size
,
true
))
==
...
...
src/nas/msgs/AuthenticationResult.hpp
View file @
7ae3dee0
...
@@ -39,7 +39,7 @@ class AuthenticationResult : public NasMmPlainHeader {
...
@@ -39,7 +39,7 @@ class AuthenticationResult : public NasMmPlainHeader {
void
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
);
void
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
);
// TODO: Get
// TODO: Get
void
SetEapMessage
(
bstring
eap
);
void
SetEapMessage
(
const
bstring
&
eap
);
// TODO: Get
// TODO: Get
void
SetAbba
(
uint8_t
length
,
uint8_t
*
value
);
void
SetAbba
(
uint8_t
length
,
uint8_t
*
value
);
...
...
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