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
979f3404
Commit
979f3404
authored
Feb 08, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup for SecurityModeCommand
parent
66bee1a7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
72 deletions
+92
-72
src/nas/common/Ie_Const.hpp
src/nas/common/Ie_Const.hpp
+1
-0
src/nas/msgs/SecurityModeCommand.cpp
src/nas/msgs/SecurityModeCommand.cpp
+86
-67
src/nas/msgs/SecurityModeCommand.hpp
src/nas/msgs/SecurityModeCommand.hpp
+5
-5
No files found.
src/nas/common/Ie_Const.hpp
View file @
979f3404
...
@@ -98,6 +98,7 @@ constexpr uint8_t kIeiReleaseAssistanceIndication = 0x0F; // F-(4 higher bits)
...
@@ -98,6 +98,7 @@ constexpr uint8_t kIeiReleaseAssistanceIndication = 0x0F; // F-(4 higher bits)
constexpr
uint8_t
kIei5gmmCapability
=
0x10
;
constexpr
uint8_t
kIei5gmmCapability
=
0x10
;
constexpr
uint8_t
kIeiUeUsageSetting
=
0x18
;
constexpr
uint8_t
kIeiUeUsageSetting
=
0x18
;
constexpr
uint8_t
kIeiS1UeSecurityCapability
=
0x19
;
constexpr
uint8_t
kIeiAuthenticationParameterAutn
=
0x20
;
constexpr
uint8_t
kIeiAuthenticationParameterAutn
=
0x20
;
constexpr
uint8_t
kIeiAuthenticationParameterRand
=
0x21
;
constexpr
uint8_t
kIeiAuthenticationParameterRand
=
0x21
;
constexpr
uint8_t
kIei5gsNetworkFeatureSupport
=
0x21
;
constexpr
uint8_t
kIei5gsNetworkFeatureSupport
=
0x21
;
...
...
src/nas/msgs/SecurityModeCommand.cpp
View file @
979f3404
...
@@ -31,7 +31,7 @@ SecurityModeCommand::SecurityModeCommand()
...
@@ -31,7 +31,7 @@ SecurityModeCommand::SecurityModeCommand()
:
NasMmPlainHeader
(
EPD_5GS_MM_MSG
,
SECURITY_MODE_COMMAND
)
{
:
NasMmPlainHeader
(
EPD_5GS_MM_MSG
,
SECURITY_MODE_COMMAND
)
{
ie_imeisv_request
=
std
::
nullopt
;
ie_imeisv_request
=
std
::
nullopt
;
ie_eps_nas_security_algorithms
=
std
::
nullopt
;
ie_eps_nas_security_algorithms
=
std
::
nullopt
;
ie_additional_5
G
_security_information
=
std
::
nullopt
;
ie_additional_5
g
_security_information
=
std
::
nullopt
;
ie_eap_message
=
std
::
nullopt
;
ie_eap_message
=
std
::
nullopt
;
ie_abba
=
std
::
nullopt
;
ie_abba
=
std
::
nullopt
;
ie_s1_ue_security_capability
=
std
::
nullopt
;
ie_s1_ue_security_capability
=
std
::
nullopt
;
...
@@ -53,20 +53,19 @@ void SecurityModeCommand::SetNasSecurityAlgorithms(
...
@@ -53,20 +53,19 @@ void SecurityModeCommand::SetNasSecurityAlgorithms(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
)
{
void
SecurityModeCommand
::
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
)
{
ie_ng
KSI
.
SetTypeOfSecurityContext
(
tsc
);
ie_ng
_ksi
.
SetTypeOfSecurityContext
(
tsc
);
ie_ng
KSI
.
SetNasKeyIdentifier
(
key_set_id
);
ie_ng
_ksi
.
SetNasKeyIdentifier
(
key_set_id
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
SetUeSecurityCapability
(
void
SecurityModeCommand
::
SetUeSecurityCapability
(
uint8_t
ea
,
uint8_t
ia
)
{
uint8_t
g_EASel
,
uint8_t
g_IASel
)
{
ie_ue_security_capability
.
Set
(
ea
,
ia
);
ie_ue_security_capability
.
Set
(
g_EASel
,
g_IASel
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
SetUeSecurityCapability
(
void
SecurityModeCommand
::
SetUeSecurityCapability
(
uint8_t
g_EASel
,
uint8_t
g_IASel
,
uint8_t
eea
,
uint8_t
eia
)
{
uint8_t
ea
,
uint8_t
ia
,
uint8_t
eea
,
uint8_t
eia
)
{
ie_ue_security_capability
.
Set
(
g_EASel
,
g_IASel
,
eea
,
eia
);
ie_ue_security_capability
.
Set
(
ea
,
ia
,
eea
,
eia
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -84,25 +83,24 @@ void SecurityModeCommand::SetEpsNasSecurityAlgorithms(
...
@@ -84,25 +83,24 @@ void SecurityModeCommand::SetEpsNasSecurityAlgorithms(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
SetAdditional5gSecurityInformation
(
void
SecurityModeCommand
::
SetAdditional5gSecurityInformation
(
bool
rinmr
,
bool
hdp
)
{
bool
rinmr
,
bool
hdp
)
{
ie_additional_5
G
_security_information
=
ie_additional_5
g
_security_information
=
std
::
make_optional
<
Additional5gSecurityInformation
>
(
rinmr
,
hdp
);
std
::
make_optional
<
Additional5gSecurityInformation
>
(
rinmr
,
hdp
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
SetEapMessage
(
bstring
eap
)
{
void
SecurityModeCommand
::
SetEapMessage
(
bstring
eap
)
{
ie_eap_message
=
std
::
make_optional
<
EapMessage
>
(
0x78
,
eap
);
ie_eap_message
=
std
::
make_optional
<
EapMessage
>
(
kIeiEapMessage
,
eap
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
SetAbba
(
uint8_t
length
,
uint8_t
*
value
)
{
void
SecurityModeCommand
::
SetAbba
(
uint8_t
length
,
uint8_t
*
value
)
{
ie_abba
=
std
::
make_optional
<
ABBA
>
(
0x38
,
length
,
value
);
ie_abba
=
std
::
make_optional
<
ABBA
>
(
kIeiAbba
,
length
,
value
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
SetS1UeSecurityCapability
(
void
SecurityModeCommand
::
SetS1UeSecurityCapability
(
uint8_t
eea
,
uint8_t
eia
)
{
uint8_t
g_EEASel
,
uint8_t
g_EIASel
)
{
ie_s1_ue_security_capability
=
std
::
make_optional
<
S1UeSecurityCapability
>
(
ie_s1_ue_security_capability
=
kIeiS1UeSecurityCapability
,
eea
,
eia
);
std
::
make_optional
<
S1UeSecurityCapability
>
(
0x19
,
g_EEASel
,
g_EIASel
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -126,102 +124,119 @@ int SecurityModeCommand::Encode(uint8_t* buf, int len) {
...
@@ -126,102 +124,119 @@ int SecurityModeCommand::Encode(uint8_t* buf, int len) {
encoded_size
+=
size
;
encoded_size
+=
size
;
}
else
{
}
else
{
Logger
::
nas_mm
().
error
(
Logger
::
nas_mm
().
error
(
"Encoding
ie_selected_nas_security_algorithms error"
);
"Encoding
%s error"
,
NasSecurityAlgorithms
::
GetIeName
().
c_str
()
);
return
KEncodeDecodeError
;
return
KEncodeDecodeError
;
}
}
// NAS key set identifier
// NAS key set identifier
size
=
ie_ng
KSI
.
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
size
=
ie_ng
_ksi
.
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
size
!=
KEncodeDecodeError
)
{
if
(
size
!=
KEncodeDecodeError
)
{
encoded_size
++
;
// 1/2 octet for ngKSI, 1/2 for Spare half octet
encoded_size
++
;
// 1/2 octet for ngKSI, 1/2 for Spare half octet
}
else
{
}
else
{
Logger
::
nas_mm
().
error
(
"Encoding ie_ngKSI error"
);
Logger
::
nas_mm
().
error
(
"Encoding %s error"
,
NasKeySetIdentifier
::
GetIeName
().
c_str
());
return
KEncodeDecodeError
;
return
KEncodeDecodeError
;
}
}
// UE security capability
// UE security capability
size
=
size
=
ie_ue_security_capability
.
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
ie_ue_security_capability
.
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
size
!=
KEncodeDecodeError
)
{
if
(
size
!=
KEncodeDecodeError
)
{
encoded_size
+=
size
;
encoded_size
+=
size
;
}
else
{
}
else
{
Logger
::
nas_mm
().
error
(
"Encoding ie_ue_security_capability error"
);
Logger
::
nas_mm
().
error
(
"Encoding %s error"
,
UESecurityCapability
::
GetIeName
().
c_str
());
return
KEncodeDecodeError
;
return
KEncodeDecodeError
;
}
}
// Optional IEs
// Optional IEs
if
(
!
ie_imeisv_request
.
has_value
())
{
if
(
!
ie_imeisv_request
.
has_value
())
{
Logger
::
nas_mm
().
warn
(
"IE ie_imeisv_request is not available"
);
Logger
::
nas_mm
().
debug
(
"IE %s is not available"
,
ImeisvRequest
::
GetIeName
().
c_str
());
}
else
{
}
else
{
if
(
int
size
=
ie_imeisv_request
.
value
().
Encode
(
size
=
ie_imeisv_request
.
value
().
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
size
!=
KEncodeDecodeError
)
{
encoded_size
+=
size
;
encoded_size
+=
size
;
}
else
{
}
else
{
Logger
::
nas_mm
().
error
(
"Encoding ie_imeisv_request error"
);
Logger
::
nas_mm
().
error
(
return
0
;
"Encoding %s error"
,
ImeisvRequest
::
GetIeName
().
c_str
());
return
KEncodeDecodeError
;
}
}
}
}
if
(
!
ie_eps_nas_security_algorithms
.
has_value
())
{
if
(
!
ie_eps_nas_security_algorithms
.
has_value
())
{
Logger
::
nas_mm
().
warn
(
"IE ie_eps_nas_security_algorithms is not available"
);
Logger
::
nas_mm
().
debug
(
"IE %s is not available"
,
EpsNasSecurityAlgorithms
::
GetIeName
().
c_str
());
}
else
{
}
else
{
if
(
int
size
=
ie_eps_nas_security_algorithms
.
value
().
Encode
(
size
=
ie_eps_nas_security_algorithms
.
value
().
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
size
!=
KEncodeDecodeError
)
{
encoded_size
+=
size
;
encoded_size
+=
size
;
}
else
{
}
else
{
Logger
::
nas_mm
().
error
(
"Encoding ie_eps_nas_security_algorithms error"
);
Logger
::
nas_mm
().
error
(
return
0
;
"Encoding %s error"
,
EpsNasSecurityAlgorithms
::
GetIeName
().
c_str
());
return
KEncodeDecodeError
;
}
}
}
}
if
(
!
ie_additional_5G_security_information
.
has_value
())
{
if
(
!
ie_additional_5g_security_information
.
has_value
())
{
Logger
::
nas_mm
().
warn
(
Logger
::
nas_mm
().
debug
(
"IE ie_additional_5G_security_information is not available"
);
"IE %s is not available"
,
Additional5gSecurityInformation
::
GetIeName
().
c_str
());
}
else
{
}
else
{
if
(
int
size
=
ie_additional_5G_security_information
.
value
().
Encode
(
size
=
ie_additional_5g_security_information
.
value
().
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
size
!=
KEncodeDecodeError
)
{
encoded_size
+=
size
;
encoded_size
+=
size
;
}
else
{
}
else
{
Logger
::
nas_mm
().
error
(
Logger
::
nas_mm
().
error
(
"Encoding ie_additional_5G_security_information error"
);
"Encoding %s error"
,
return
0
;
Additional5gSecurityInformation
::
GetIeName
().
c_str
());
return
KEncodeDecodeError
;
}
}
}
}
if
(
!
ie_eap_message
.
has_value
())
{
if
(
!
ie_eap_message
.
has_value
())
{
Logger
::
nas_mm
().
warn
(
"IE ie_eap_message is not available"
);
Logger
::
nas_mm
().
debug
(
"IE %s is not available"
,
EapMessage
::
GetIeName
().
c_str
());
}
else
{
}
else
{
if
(
int
size
=
ie_eap_message
.
value
().
Encode
(
size
=
buf
+
encoded_size
,
len
-
encoded_size
))
{
ie_eap_message
.
value
().
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
size
!=
KEncodeDecodeError
)
{
encoded_size
+=
size
;
encoded_size
+=
size
;
}
else
{
}
else
{
Logger
::
nas_mm
().
error
(
"encoding ie_eap_message error"
);
Logger
::
nas_mm
().
error
(
return
0
;
"Encoding %s error"
,
EapMessage
::
GetIeName
().
c_str
());
return
KEncodeDecodeError
;
}
}
}
}
if
(
!
ie_abba
.
has_value
())
{
if
(
!
ie_abba
.
has_value
())
{
Logger
::
nas_mm
().
warn
(
"IE ie_abba is not available"
);
Logger
::
nas_mm
().
debug
(
"IE %s is not available"
,
ABBA
::
GetIeName
().
c_str
()
);
}
else
{
}
else
{
if
(
int
size
=
size
=
ie_abba
.
value
().
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
ie_abba
.
value
().
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
)
)
{
if
(
size
!=
KEncodeDecodeError
)
{
encoded_size
+=
size
;
encoded_size
+=
size
;
}
else
{
}
else
{
Logger
::
nas_mm
().
error
(
"Encoding
ie_abba error"
);
Logger
::
nas_mm
().
error
(
"Encoding
%s error"
,
ABBA
::
GetIeName
().
c_str
()
);
return
0
;
return
KEncodeDecodeError
;
}
}
}
}
if
(
!
ie_s1_ue_security_capability
.
has_value
())
{
if
(
!
ie_s1_ue_security_capability
.
has_value
())
{
Logger
::
nas_mm
().
warn
(
"IE ie_s1_ue_security_capability is not available"
);
Logger
::
nas_mm
().
debug
(
"IE %s is not available"
,
S1UeSecurityCapability
::
GetIeName
().
c_str
());
}
else
{
}
else
{
if
(
int
size
=
ie_s1_ue_security_capability
.
value
().
Encode
(
size
=
ie_s1_ue_security_capability
.
value
().
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
size
!=
KEncodeDecodeError
)
{
encoded_size
+=
size
;
encoded_size
+=
size
;
}
else
{
}
else
{
Logger
::
nas_mm
().
error
(
"encoding ie_s1_ue_security_capability error"
);
Logger
::
nas_mm
().
error
(
return
0
;
"Encoding %s error"
,
S1UeSecurityCapability
::
GetIeName
().
c_str
());
return
KEncodeDecodeError
;
}
}
}
}
Logger
::
nas_mm
().
debug
(
Logger
::
nas_mm
().
debug
(
...
@@ -251,7 +266,7 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
...
@@ -251,7 +266,7 @@ int SecurityModeCommand::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
)
return
KEncodeDecodeError
;
if
(
decoded_result
==
KEncodeDecodeError
)
return
KEncodeDecodeError
;
decoded_size
++
;
// 1/2 octet for ngKSI, 1/2 for Spare half octet
decoded_size
++
;
// 1/2 octet for ngKSI, 1/2 for Spare half octet
...
@@ -262,10 +277,14 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
...
@@ -262,10 +277,14 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
decoded_size
+=
decoded_result
;
decoded_size
+=
decoded_result
;
Logger
::
nas_mm
().
debug
(
"Decoded_size (%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Decoded_size (%d)"
,
decoded_size
);
uint8_t
octet
=
*
(
buf
+
decoded_size
);
// Decode other IEs
uint8_t
octet
=
0x00
;
DECODE_U8_VALUE
(
buf
+
decoded_size
,
octet
);
Logger
::
nas_mm
().
debug
(
"First option IEI (0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"First option IEI (0x%x)"
,
octet
);
bool
flag
=
false
;
bool
flag
=
false
;
while
((
octet
!=
0x0
))
{
while
((
octet
!=
0x0
))
{
Logger
::
nas_mm
().
debug
(
"IEI 0x%x"
,
octet
);
switch
((
octet
&
0xf0
)
>>
4
)
{
switch
((
octet
&
0xf0
)
>>
4
)
{
case
kIeiImeisvRequest
:
{
case
kIeiImeisvRequest
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI 0x%x"
,
kIeiImeisvRequest
);
Logger
::
nas_mm
().
debug
(
"Decoding IEI 0x%x"
,
kIeiImeisvRequest
);
...
@@ -276,7 +295,7 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
...
@@ -276,7 +295,7 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
return
decoded_result
;
return
decoded_result
;
decoded_size
+=
decoded_result
;
decoded_size
+=
decoded_result
;
ie_imeisv_request
=
std
::
optional
<
ImeisvRequest
>
(
ie_imeisv_request_tmp
);
ie_imeisv_request
=
std
::
optional
<
ImeisvRequest
>
(
ie_imeisv_request_tmp
);
octet
=
*
(
buf
+
decoded_size
);
DECODE_U8_VALUE
(
buf
+
decoded_size
,
octet
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
}
break
;
default:
{
default:
{
...
@@ -297,7 +316,7 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
...
@@ -297,7 +316,7 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
ie_eps_nas_security_algorithms
=
ie_eps_nas_security_algorithms
=
std
::
optional
<
EpsNasSecurityAlgorithms
>
(
std
::
optional
<
EpsNasSecurityAlgorithms
>
(
ie_eps_nas_security_algorithms_tmp
);
ie_eps_nas_security_algorithms_tmp
);
octet
=
*
(
buf
+
decoded_size
);
DECODE_U8_VALUE
(
buf
+
decoded_size
,
octet
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
}
break
;
...
@@ -305,16 +324,16 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
...
@@ -305,16 +324,16 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
Logger
::
nas_mm
().
debug
(
Logger
::
nas_mm
().
debug
(
"decoding IEI 0x%x"
,
kIeiAdditional5gSecurityInformation
);
"decoding IEI 0x%x"
,
kIeiAdditional5gSecurityInformation
);
Additional5gSecurityInformation
Additional5gSecurityInformation
ie_additional_5
G
_security_information_tmp
=
{};
ie_additional_5
g
_security_information_tmp
=
{};
if
((
decoded_result
=
ie_additional_5
G
_security_information_tmp
.
Decode
(
if
((
decoded_result
=
ie_additional_5
g
_security_information_tmp
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
))
==
buf
+
decoded_size
,
len
-
decoded_size
,
true
))
==
KEncodeDecodeError
)
KEncodeDecodeError
)
return
decoded_result
;
return
decoded_result
;
decoded_size
+=
decoded_result
;
decoded_size
+=
decoded_result
;
ie_additional_5
G
_security_information
=
ie_additional_5
g
_security_information
=
std
::
optional
<
Additional5gSecurityInformation
>
(
std
::
optional
<
Additional5gSecurityInformation
>
(
ie_additional_5
G
_security_information_tmp
);
ie_additional_5
g
_security_information_tmp
);
octet
=
*
(
buf
+
decoded_size
);
DECODE_U8_VALUE
(
buf
+
decoded_size
,
octet
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
}
break
;
...
@@ -327,12 +346,12 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
...
@@ -327,12 +346,12 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
return
decoded_result
;
return
decoded_result
;
decoded_size
+=
decoded_result
;
decoded_size
+=
decoded_result
;
ie_eap_message
=
std
::
optional
<
EapMessage
>
(
ie_eap_message_tmp
);
ie_eap_message
=
std
::
optional
<
EapMessage
>
(
ie_eap_message_tmp
);
octet
=
*
(
buf
+
decoded_size
);
DECODE_U8_VALUE
(
buf
+
decoded_size
,
octet
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
}
break
;
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
))
==
...
@@ -340,12 +359,12 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
...
@@ -340,12 +359,12 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
return
decoded_result
;
return
decoded_result
;
decoded_size
+=
decoded_result
;
decoded_size
+=
decoded_result
;
ie_abba
=
std
::
optional
<
ABBA
>
(
ie_abba_tmp
);
ie_abba
=
std
::
optional
<
ABBA
>
(
ie_abba_tmp
);
octet
=
*
(
buf
+
decoded_size
);
DECODE_U8_VALUE
(
buf
+
decoded_size
,
octet
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
}
break
;
case
0x19
:
{
case
kIeiS1UeSecurityCapability
:
{
Logger
::
nas_mm
().
debug
(
"
decoding IEI (0x19)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI 0x%x"
,
kIeiS1UeSecurityCapability
);
S1UeSecurityCapability
ie_s1_ue_security_capability_tmp
=
{};
S1UeSecurityCapability
ie_s1_ue_security_capability_tmp
=
{};
if
((
decoded_result
=
ie_s1_ue_security_capability_tmp
.
Decode
(
if
((
decoded_result
=
ie_s1_ue_security_capability_tmp
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
))
==
buf
+
decoded_size
,
len
-
decoded_size
,
true
))
==
...
@@ -354,7 +373,7 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
...
@@ -354,7 +373,7 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
decoded_size
+=
decoded_result
;
decoded_size
+=
decoded_result
;
ie_s1_ue_security_capability
=
std
::
optional
<
S1UeSecurityCapability
>
(
ie_s1_ue_security_capability
=
std
::
optional
<
S1UeSecurityCapability
>
(
ie_s1_ue_security_capability_tmp
);
ie_s1_ue_security_capability_tmp
);
octet
=
*
(
buf
+
decoded_size
);
DECODE_U8_VALUE
(
buf
+
decoded_size
,
octet
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
}
break
;
...
...
src/nas/msgs/SecurityModeCommand.hpp
View file @
979f3404
...
@@ -42,10 +42,10 @@ class SecurityModeCommand : public NasMmPlainHeader {
...
@@ -42,10 +42,10 @@ class SecurityModeCommand : 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
SetUeSecurityCapability
(
uint8_t
g_EASel
,
uint8_t
g_IASel
);
void
SetUeSecurityCapability
(
uint8_t
ea
,
uint8_t
ia
);
// TODO: Get
// TODO: Get
void
SetUeSecurityCapability
(
void
SetUeSecurityCapability
(
uint8_t
g_EASel
,
uint8_t
g_IASel
,
uint8_t
eea
,
uint8_t
eia
);
uint8_t
ea
,
uint8_t
ia
,
uint8_t
eea
,
uint8_t
eia
);
// TODO: Get
// TODO: Get
void
SetImeisvRequest
(
uint8_t
value
);
void
SetImeisvRequest
(
uint8_t
value
);
...
@@ -63,19 +63,19 @@ class SecurityModeCommand : public NasMmPlainHeader {
...
@@ -63,19 +63,19 @@ class SecurityModeCommand : public NasMmPlainHeader {
void
SetAbba
(
uint8_t
length
,
uint8_t
*
value
);
void
SetAbba
(
uint8_t
length
,
uint8_t
*
value
);
// TODO: Get
// TODO: Get
void
SetS1UeSecurityCapability
(
uint8_t
g_EEASel
,
uint8_t
g_EIASel
);
void
SetS1UeSecurityCapability
(
uint8_t
eea
,
uint8_t
eia
);
// TODO: Get
// TODO: Get
public:
public:
NasSecurityAlgorithms
ie_selected_nas_security_algorithms
;
// Mandatory
NasSecurityAlgorithms
ie_selected_nas_security_algorithms
;
// Mandatory
NasKeySetIdentifier
ie_ng
KSI
;
// Mandatory
NasKeySetIdentifier
ie_ng
_ksi
;
// Mandatory
UESecurityCapability
ie_ue_security_capability
;
// Mandatory
UESecurityCapability
ie_ue_security_capability
;
// Mandatory
std
::
optional
<
ImeisvRequest
>
ie_imeisv_request
;
// Optional
std
::
optional
<
ImeisvRequest
>
ie_imeisv_request
;
// Optional
std
::
optional
<
EpsNasSecurityAlgorithms
>
std
::
optional
<
EpsNasSecurityAlgorithms
>
ie_eps_nas_security_algorithms
;
// Optional
ie_eps_nas_security_algorithms
;
// Optional
std
::
optional
<
Additional5gSecurityInformation
>
std
::
optional
<
Additional5gSecurityInformation
>
ie_additional_5
G
_security_information
;
// Optional
ie_additional_5
g
_security_information
;
// Optional
std
::
optional
<
EapMessage
>
ie_eap_message
;
// Optional
std
::
optional
<
EapMessage
>
ie_eap_message
;
// Optional
std
::
optional
<
ABBA
>
ie_abba
;
// Optional
std
::
optional
<
ABBA
>
ie_abba
;
// Optional
std
::
optional
<
S1UeSecurityCapability
>
std
::
optional
<
S1UeSecurityCapability
>
...
...
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