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
2f184c9d
Commit
2f184c9d
authored
Jan 13, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Security Mode Command and its IEs
parent
3e503cfb
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
497 additions
and
207 deletions
+497
-207
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+8
-8
src/nas/common/NasIeHeader.hpp
src/nas/common/NasIeHeader.hpp
+2
-2
src/nas/ies/5GMMCapability.hpp
src/nas/ies/5GMMCapability.hpp
+0
-3
src/nas/ies/Additional5gSecurityInformation.cpp
src/nas/ies/Additional5gSecurityInformation.cpp
+126
-0
src/nas/ies/Additional5gSecurityInformation.hpp
src/nas/ies/Additional5gSecurityInformation.hpp
+20
-25
src/nas/ies/Additional_5G_Security_Information.cpp
src/nas/ies/Additional_5G_Security_Information.cpp
+0
-125
src/nas/ies/S1UeSecurityCapability.cpp
src/nas/ies/S1UeSecurityCapability.cpp
+228
-0
src/nas/ies/S1UeSecurityCapability.hpp
src/nas/ies/S1UeSecurityCapability.hpp
+68
-0
src/nas/msgs/AuthenticationRequest.cpp
src/nas/msgs/AuthenticationRequest.cpp
+2
-2
src/nas/msgs/AuthenticationRequest.hpp
src/nas/msgs/AuthenticationRequest.hpp
+2
-2
src/nas/msgs/AuthenticationResult.cpp
src/nas/msgs/AuthenticationResult.cpp
+2
-2
src/nas/msgs/AuthenticationResult.hpp
src/nas/msgs/AuthenticationResult.hpp
+2
-2
src/nas/msgs/DeregistrationRequest.cpp
src/nas/msgs/DeregistrationRequest.cpp
+1
-1
src/nas/msgs/DeregistrationRequest.hpp
src/nas/msgs/DeregistrationRequest.hpp
+1
-1
src/nas/msgs/RegistrationRequest.cpp
src/nas/msgs/RegistrationRequest.cpp
+1
-1
src/nas/msgs/RegistrationRequest.hpp
src/nas/msgs/RegistrationRequest.hpp
+1
-1
src/nas/msgs/SecurityModeCommand.cpp
src/nas/msgs/SecurityModeCommand.cpp
+20
-19
src/nas/msgs/SecurityModeCommand.hpp
src/nas/msgs/SecurityModeCommand.hpp
+11
-11
src/nas/msgs/ServiceRequest.cpp
src/nas/msgs/ServiceRequest.cpp
+1
-1
src/nas/msgs/ServiceRequest.hpp
src/nas/msgs/ServiceRequest.hpp
+1
-1
No files found.
src/amf-app/amf_n1.cpp
View file @
2f184c9d
...
...
@@ -2111,11 +2111,11 @@ bool amf_n1::start_authentication_procedure(
std
::
unique_ptr
<
AuthenticationRequest
>
auth_request
=
std
::
make_unique
<
AuthenticationRequest
>
();
auth_request
->
setHeader
(
PLAIN_5GS_MSG
);
auth_request
->
setngKSI
(
NAS_KEY_SET_IDENTIFIER_NATIVE
,
ngksi
);
auth_request
->
SetNgKsi
(
NAS_KEY_SET_IDENTIFIER_NATIVE
,
ngksi
);
uint8_t
abba
[
2
];
abba
[
0
]
=
0x00
;
abba
[
1
]
=
0x00
;
auth_request
->
setABBA
(
2
,
abba
);
auth_request
->
SetAbba
(
2
,
abba
);
// uint8_t* rand = nc->_5g_av[vindex].rand;
auth_request
->
setAuthentication_Parameter_RAND
(
nc
->
_5g_av
[
vindex
].
rand
);
Logger
::
amf_n1
().
debug
(
"Sending Authentication Request with RAND"
);
...
...
@@ -2394,22 +2394,22 @@ bool amf_n1::start_security_mode_control_procedure(
std
::
unique_ptr
<
SecurityModeCommand
>
smc
=
std
::
make_unique
<
SecurityModeCommand
>
();
smc
->
setHeader
(
PLAIN_5GS_MSG
);
smc
->
setNAS_Security_
Algorithms
(
amf_nea
,
amf_nia
);
smc
->
SetNasSecurity
Algorithms
(
amf_nea
,
amf_nia
);
Logger
::
amf_n1
().
debug
(
"Encoded ngKSI 0x%x"
,
nc
->
ngKsi
);
smc
->
setngKSI
(
NAS_KEY_SET_IDENTIFIER_NATIVE
,
nc
->
ngKsi
&
0x07
);
smc
->
SetNgKsi
(
NAS_KEY_SET_IDENTIFIER_NATIVE
,
nc
->
ngKsi
&
0x07
);
if
(
nc
->
ueSecurityCaplen
>=
4
)
{
smc
->
setUE_Security_
Capability
(
smc
->
SetUeSecurity
Capability
(
nc
->
ueSecurityCapEnc
,
nc
->
ueSecurityCapInt
,
nc
->
ueSecurityCapEEA
,
nc
->
ueSecurityCapEIA
);
}
else
{
smc
->
setUE_Security_
Capability
(
nc
->
ueSecurityCapEnc
,
nc
->
ueSecurityCapInt
);
smc
->
SetUeSecurity
Capability
(
nc
->
ueSecurityCapEnc
,
nc
->
ueSecurityCapInt
);
}
// TODO: remove
// smc->ie_ue_security_capability->SetLengthIndicator(nc->ueSecurityCaplen);
smc
->
setIMEISV_
Request
(
0xe1
);
// TODO: remove hardcoded value
smc
->
setAdditional_5G_Security_
Information
(
true
,
false
);
smc
->
SetImeisv
Request
(
0xe1
);
// TODO: remove hardcoded value
smc
->
SetAdditional5gSecurity
Information
(
true
,
false
);
uint8_t
buffer
[
BUFFER_SIZE_1024
];
int
encoded_size
=
smc
->
Encode
(
buffer
,
BUFFER_SIZE_1024
);
comUt
::
print_buffer
(
...
...
src/nas/common/NasIeHeader.hpp
View file @
2f184c9d
...
...
@@ -28,7 +28,7 @@
#include "5GMMCapability.hpp"
#include "5GSRegistrationType.hpp"
#include "ABBA.hpp"
#include "Additional
_5G_Security_
Information.hpp"
#include "Additional
5gSecurity
Information.hpp"
#include "Additional_Information.hpp"
#include "AllowedPDUSessionStatus.hpp"
#include "Authentication_Failure_Parameter.hpp"
...
...
@@ -61,7 +61,7 @@
#include "Rejected_NSSAI.hpp"
#include "Release_Assistance_Indication.hpp"
#include "Request_Type.hpp"
#include "S1
_UE_Security_
Capability.hpp"
#include "S1
UeSecurity
Capability.hpp"
#include "SOR_Transparent_Container.hpp"
#include "S_NSSAI.hpp"
#include "ServiceType.hpp"
...
...
src/nas/ies/5GMMCapability.hpp
View file @
2f184c9d
...
...
@@ -24,9 +24,6 @@
#include "Type4NasIe.hpp"
#include <optional>
#include <stdint.h>
constexpr
uint8_t
k5gmmCapabilityMinimumLength
=
3
;
constexpr
uint8_t
k5gmmCapabilityMaximumLength
=
15
;
constexpr
auto
k5gmmCapabilityIeName
=
"5GMM Capability"
;
...
...
src/nas/ies/
S1_UE_Security_Capability
.cpp
→
src/nas/ies/
Additional5gSecurityInformation
.cpp
View file @
2f184c9d
...
...
@@ -19,115 +19,108 @@
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "S1_UE_Security_Capability.hpp"
#include "Additional5gSecurityInformation.hpp"
#include <iostream>
#include "logger.hpp"
using
namespace
nas
;
using
namespace
std
;
//------------------------------------------------------------------------------
S1_UE_Security_Capability
::
S1_UE_Security_Capability
(
uint8_t
iei
)
{
_iei
=
iei
;
_5g_EEASel
=
0
;
_5g_EIASel
=
0
;
length
=
0
;
Additional5gSecurityInformation
::
Additional5gSecurityInformation
()
:
Type4NasIe
(
kIeiAdditional5gSecurityInformation
)
{
rinmr_
=
false
;
hdp_
=
false
;
SetLengthIndicator
(
1
);
SetIeName
(
kAdditional5gSecurityInformationIeName
);
}
//------------------------------------------------------------------------------
S1_UE_Security_Capability
::
S1_UE_Security_Capability
()
{
_iei
=
0
;
_5g_EEASel
=
0
;
_5g_EIASel
=
0
;
length
=
0
;
Additional5gSecurityInformation
::
Additional5gSecurityInformation
(
bool
rinmr
,
bool
hdp
)
:
Type4NasIe
(
kIeiAdditional5gSecurityInformation
)
{
rinmr_
=
rinmr
;
hdp_
=
hdp
;
SetLengthIndicator
(
1
);
SetIeName
(
kAdditional5gSecurityInformationIeName
);
}
//------------------------------------------------------------------------------
S1_UE_Security_Capability
::~
S1_UE_Security_Capability
()
{}
Additional5gSecurityInformation
::~
Additional5gSecurityInformation
()
{}
//------------------------------------------------------------------------------
S1_UE_Security_Capability
::
S1_UE_Security_Capability
(
const
uint8_t
iei
,
uint8_t
_5gg_EEASel
,
uint8_t
_5gg_EIASel
)
{
_iei
=
iei
;
_5g_EEASel
=
_5gg_EEASel
;
_5g_EIASel
=
_5gg_EIASel
;
length
=
4
;
Logger
::
nas_mm
().
debug
(
"decoded S1_UE_Security_Capability EA(0x%d),IA(0x%d)"
,
_5g_EEASel
,
_5g_EIASel
);
void
Additional5gSecurityInformation
::
SetRinmr
(
bool
value
)
{
rinmr_
=
value
;
}
//------------------------------------------------------------------------------
void
S1_UE_Security_Capability
::
SetEea
(
uint8_t
sel
)
{
_5g_EEASel
=
sel
;
void
Additional5gSecurityInformation
::
SetHdp
(
bool
value
)
{
hdp_
=
value
;
}
//------------------------------------------------------------------------------
void
S1_UE_Security_Capability
::
SetEia
(
uint8_t
sel
)
{
_5g_EIASel
=
sel
;
bool
Additional5gSecurityInformation
::
GetRinmr
()
const
{
return
rinmr_
;
}
//------------------------------------------------------------------------------
uint8_t
S1_UE_Security_Capability
::
GetEea
()
{
return
_5g_EEASel
;
bool
Additional5gSecurityInformation
::
GetHdp
()
const
{
return
hdp_
;
}
//------------------------------------------------------------------------------
uint8_t
S1_UE_Security_Capability
::
GetEia
(
)
{
return
_5g_EIASel
;
}
int
Additional5gSecurityInformation
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Encoding %s"
,
GetIeName
().
c_str
())
;
int
ie_len
=
GetIeLength
();
//------------------------------------------------------------------------------
int
S1_UE_Security_Capability
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"encoding S1_UE_Security_Capability iei(0x%x)"
,
_iei
);
if
(
len
<
length
)
{
Logger
::
nas_mm
().
error
(
"len is less than %d"
,
length
);
return
0
;
if
(
len
<
ie_len
)
{
Logger
::
nas_mm
().
error
(
"Len is less than %d"
,
ie_len
);
return
KEncodeDecodeError
;
}
int
encoded_size
=
0
;
if
(
_iei
)
{
*
(
buf
+
encoded_size
)
=
_iei
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
length
-
2
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
_5g_EEASel
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
_5g_EIASel
;
encoded_size
++
;
}
else
{
//*(buf + encoded_size) = length - 1; encoded_size++;
//*(buf + encoded_size) = _value; encoded_size++; encoded_size++;
}
// IEI and Length
int
encoded_header_size
=
Type4NasIe
::
Encode
(
buf
+
encoded_size
,
len
);
if
(
encoded_header_size
==
KEncodeDecodeError
)
return
KEncodeDecodeError
;
encoded_size
+=
encoded_header_size
;
// Octet 3
uint8_t
octet
=
0
;
if
(
rinmr_
)
octet
|=
0x02
;
if
(
hdp_
)
octet
|=
0x01
;
ENCODE_U8
(
buf
+
encoded_size
,
octet
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"
encoded S1_UE_Security_Capability len(%d)"
,
encoded_size
);
"
Encoded %s, len (%d)"
,
GetIeName
().
c_str
()
,
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
S1_UE_Security_Capability
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
)
{
Logger
::
nas_mm
().
debug
(
"decoding S1_UE_Security_Capability iei(0x%x)"
,
*
buf
);
int
decoded_size
=
0
;
if
(
is_option
)
{
decoded_size
++
;
int
Additional5gSecurityInformation
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_iei
)
{
if
(
len
<
kAdditional5gSecurityInformationLength
)
{
Logger
::
nas_mm
().
error
(
"Buffer length is less than the minimum length of this IE (%d octet)"
,
kAdditional5gSecurityInformationLength
);
return
KEncodeDecodeError
;
}
length
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
_5g_EEASel
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
_5g_EIASel
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
uint8_t
decoded_size
=
0
;
Logger
::
nas_mm
().
debug
(
"Decoding %s"
,
GetIeName
().
c_str
());
// IEI and Length
int
decoded_header_size
=
Type4NasIe
::
Decode
(
buf
+
decoded_size
,
len
,
is_iei
);
if
(
decoded_header_size
==
KEncodeDecodeError
)
return
KEncodeDecodeError
;
decoded_size
+=
decoded_header_size
;
// Octet 3
uint8_t
octet
=
0
;
DECODE_U8
(
buf
+
decoded_size
,
octet
,
decoded_size
);
rinmr_
=
octet
&
0x02
;
hdp_
=
octet
&
0x01
;
Logger
::
nas_mm
().
debug
(
"
decoded S1_UE_Security_Capability EA(0x%d),IA(0x%d)"
,
_5g_EEASel
,
_5g_EIASel
);
"
Decoded %s, RINMR 0x%x, HDP 0x%x"
,
GetIeName
().
c_str
(),
rinmr_
,
hdp_
);
Logger
::
nas_mm
().
debug
(
"
decoded S1_UE_Security_Capability len(%d)"
,
decoded_size
);
"
Decoded %s, len (%d)"
,
GetIeName
().
c_str
()
,
decoded_size
);
return
decoded_size
;
}
src/nas/ies/
S1_UE_Security_Capability
.hpp
→
src/nas/ies/
Additional5gSecurityInformation
.hpp
View file @
2f184c9d
...
...
@@ -19,41 +19,36 @@
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _ADDITIONAL_5G_SECURITY_INFORMATION_H_
#define _ADDITIONAL_5G_SECURITY_INFORMATION_H_
#ifndef _S1_UE_Security_Capability_H
#define _S1_UE_Security_Capability_H
#include "Type4NasIe.hpp"
#include <stdint.h>
constexpr
uint8_t
kAdditional5gSecurityInformationLength
=
3
;
constexpr
auto
kAdditional5gSecurityInformationIeName
=
"Additional 5G Security Information"
;
namespace
nas
{
class
S1_UE_Security_Capability
{
class
Additional5gSecurityInformation
:
public
Type4NasIe
{
public:
S1_UE_Security_Capability
();
S1_UE_Security_Capability
(
uint8_t
iei
);
~
S1_UE_Security_Capability
();
S1_UE_Security_Capability
(
const
uint8_t
iei
,
uint8_t
_5gg_EEASel
,
uint8_t
_5gg_EIASel
);
void
SetEea
(
uint8_t
sel
);
void
SetEia
(
uint8_t
sel
);
uint8_t
GetEea
();
uint8_t
GetEia
();
Additional5gSecurityInformation
();
Additional5gSecurityInformation
(
bool
RINMR
,
bool
HDP
);
~
Additional5gSecurityInformation
();
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
);
int
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_iei
);
void
SetRinmr
(
bool
value
);
bool
GetRinmr
()
const
;
void
SetHdp
(
bool
value
);
bool
GetHdp
()
const
;
private:
uint8_t
_iei
;
uint8_t
length
;
uint8_t
_5g_EEASel
;
uint8_t
_5g_EIASel
;
bool
rinmr_
;
bool
hdp_
;
};
}
// namespace nas
#endif
src/nas/ies/Additional_5G_Security_Information.cpp
deleted
100644 → 0
View file @
3e503cfb
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file Additional_5G_Security_Information.hpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "Additional_5G_Security_Information.hpp"
#include "logger.hpp"
using
namespace
nas
;
//------------------------------------------------------------------------------
Additional_5G_Security_Information
::
Additional_5G_Security_Information
(
uint8_t
iei
)
{
_iei
=
iei
;
RINMR
=
false
;
HDP
=
false
;
}
//------------------------------------------------------------------------------
Additional_5G_Security_Information
::
Additional_5G_Security_Information
(
const
uint8_t
iei
,
bool
rinmr
,
bool
hdp
)
{
_iei
=
iei
;
RINMR
=
rinmr
;
HDP
=
hdp
;
}
//------------------------------------------------------------------------------
Additional_5G_Security_Information
::
Additional_5G_Security_Information
()
:
_iei
()
{
RINMR
=
false
;
HDP
=
false
;
}
//------------------------------------------------------------------------------
Additional_5G_Security_Information
::~
Additional_5G_Security_Information
()
{}
//------------------------------------------------------------------------------
void
Additional_5G_Security_Information
::
setRINMR
(
bool
value
)
{
RINMR
=
value
;
}
//------------------------------------------------------------------------------
void
Additional_5G_Security_Information
::
setHDP
(
bool
value
)
{
HDP
=
value
;
}
//------------------------------------------------------------------------------
bool
Additional_5G_Security_Information
::
getRINMR
()
{
return
RINMR
;
}
//------------------------------------------------------------------------------
bool
Additional_5G_Security_Information
::
getHDP
()
{
return
HDP
;
}
//------------------------------------------------------------------------------
int
Additional_5G_Security_Information
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"encoding Additional_5G_Security_Information iei(0x%x)"
,
_iei
);
if
(
len
<
3
)
{
Logger
::
nas_mm
().
error
(
"len is less than 3"
);
return
0
;
}
uint8_t
octet
=
0
;
int
encoded_size
=
0
;
if
(
RINMR
)
octet
|=
0x02
;
if
(
HDP
)
octet
|=
0x01
;
*
(
buf
+
encoded_size
)
=
_iei
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
1
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
octet
;
encoded_size
++
;
Logger
::
nas_mm
().
debug
(
"encoded Additional_5G_Security_Information IE(len(1 octet))"
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
Additional_5G_Security_Information
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
)
{
if
(
len
<
3
)
{
Logger
::
nas_mm
().
error
(
"len is less than 3"
);
return
0
;
}
else
{
int
decoded_size
=
0
;
if
(
is_option
)
{
decoded_size
++
;
}
// length = *(buf + decoded_size);
decoded_size
++
;
uint8_t
octet
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
RINMR
=
octet
&
0x02
;
HDP
=
octet
&
0x01
;
Logger
::
nas_mm
().
debug
(
"decoded Additional_5G_Security_Information RINMR(0x%x) HDP(0x%x)"
,
RINMR
,
HDP
);
return
decoded_size
;
}
}
src/nas/ies/S1UeSecurityCapability.cpp
0 → 100644
View file @
2f184c9d
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "S1UeSecurityCapability.hpp"
#include <iostream>
#include "logger.hpp"
using
namespace
nas
;
using
namespace
std
;
//------------------------------------------------------------------------------
S1UeSecurityCapability
::
S1UeSecurityCapability
()
:
Type4NasIe
()
{
eea_
=
0
;
eia_
=
0
;
uea_
=
std
::
nullopt
;
uia_
=
std
::
nullopt
;
gea_
=
std
::
nullopt
;
SetLengthIndicator
(
2
);
SetIeName
(
kS1UeSecurityCapabilityIeName
);
}
//------------------------------------------------------------------------------
S1UeSecurityCapability
::
S1UeSecurityCapability
(
uint8_t
iei
)
:
Type4NasIe
(
iei
)
{
eea_
=
0
;
eia_
=
0
;
uea_
=
std
::
nullopt
;
uia_
=
std
::
nullopt
;
gea_
=
std
::
nullopt
;
SetLengthIndicator
(
2
);
SetIeName
(
kS1UeSecurityCapabilityIeName
);
}
//------------------------------------------------------------------------------
S1UeSecurityCapability
::
S1UeSecurityCapability
(
const
uint8_t
iei
,
uint8_t
eea
,
uint8_t
eia
)
{
eea_
=
eea
;
eia_
=
eia
;
SetLengthIndicator
(
2
);
SetIeName
(
kS1UeSecurityCapabilityIeName
);
}
//------------------------------------------------------------------------------
S1UeSecurityCapability
::
S1UeSecurityCapability
(
const
uint8_t
iei
,
uint8_t
eea
,
uint8_t
eia
,
uint8_t
uea
,
uint8_t
uia
)
{
eea_
=
eea
;
eia_
=
eia
;
uea_
=
std
::
optional
<
uint8_t
>
(
uea
);
uia_
=
std
::
optional
<
uint8_t
>
(
uia
);
SetLengthIndicator
(
4
);
SetIeName
(
kS1UeSecurityCapabilityIeName
);
}
//------------------------------------------------------------------------------
S1UeSecurityCapability
::~
S1UeSecurityCapability
()
{}
//------------------------------------------------------------------------------
void
S1UeSecurityCapability
::
SetEea
(
uint8_t
sel
)
{
eea_
=
sel
;
}
//------------------------------------------------------------------------------
void
S1UeSecurityCapability
::
SetEia
(
uint8_t
sel
)
{
eia_
=
sel
;
}
//------------------------------------------------------------------------------
uint8_t
S1UeSecurityCapability
::
GetEea
()
const
{
return
eea_
;
}
//------------------------------------------------------------------------------
uint8_t
S1UeSecurityCapability
::
GetEia
()
const
{
return
eia_
;
}
//------------------------------------------------------------------------------
void
S1UeSecurityCapability
::
Set
(
uint8_t
eea
,
uint8_t
eia
)
{
eea_
=
eea
;
eia_
=
eia
;
SetLengthIndicator
(
2
);
}
//------------------------------------------------------------------------------
void
S1UeSecurityCapability
::
Get
(
uint8_t
&
eea
,
uint8_t
&
eia
)
const
{
eea
=
eea_
;
eia
=
eia_
;
}
//------------------------------------------------------------------------------
void
S1UeSecurityCapability
::
Set
(
uint8_t
eea
,
uint8_t
eia
,
uint8_t
uea
,
uint8_t
uia
)
{
eea_
=
eea
;
eia_
=
eia
;
uea_
=
std
::
optional
<
uint8_t
>
(
uea
);
uia_
=
std
::
optional
<
uint8_t
>
(
uia
);
SetLengthIndicator
(
4
);
}
//------------------------------------------------------------------------------
void
S1UeSecurityCapability
::
Get
(
uint8_t
&
eea
,
uint8_t
&
eia
,
uint8_t
&
uea
,
uint8_t
&
uia
)
const
{
eea
=
eea_
;
eia
=
eia_
;
if
(
uea_
.
has_value
())
uea
=
uea_
.
value
();
if
(
uia_
.
has_value
())
uia
=
uia_
.
value
();
}
//------------------------------------------------------------------------------
int
S1UeSecurityCapability
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Encoding %s"
,
GetIeName
().
c_str
());
int
ie_len
=
GetIeLength
();
if
(
len
<
ie_len
)
{
// Length of the content + IEI/Len
Logger
::
nas_mm
().
error
(
"Size of the buffer is not enough to store this IE (IE len %d)"
,
ie_len
);
return
KEncodeDecodeError
;
}
int
encoded_size
=
0
;
// IEI and Length
int
encoded_header_size
=
Type4NasIe
::
Encode
(
buf
+
encoded_size
,
len
);
if
(
encoded_header_size
==
KEncodeDecodeError
)
return
KEncodeDecodeError
;
encoded_size
+=
encoded_header_size
;
// EEA
ENCODE_U8
(
buf
+
encoded_size
,
eea_
,
encoded_size
);
// EIA
ENCODE_U8
(
buf
+
encoded_size
,
eia_
,
encoded_size
);
// UEA
if
(
uea_
.
has_value
())
{
ENCODE_U8
(
buf
+
encoded_size
,
uea_
.
value
(),
encoded_size
);
}
// UIA
if
(
uia_
.
has_value
())
{
ENCODE_U8
(
buf
+
encoded_size
,
uia_
.
value
(),
encoded_size
);
}
// GEA
if
(
gea_
.
has_value
())
{
ENCODE_U8
(
buf
+
encoded_size
,
gea_
.
value
(),
encoded_size
);
}
Logger
::
nas_mm
().
debug
(
"Encoded %s, len (%d)"
,
GetIeName
().
c_str
(),
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
S1UeSecurityCapability
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_iei
)
{
Logger
::
nas_mm
().
debug
(
"Decoding %s"
,
GetIeName
().
c_str
());
if
(
len
<
kS1UeSecurityCapabilityMinimumLength
)
{
Logger
::
nas_mm
().
error
(
"Buffer length is less than the minimum length of this IE (%d octet)"
,
kS1UeSecurityCapabilityMinimumLength
);
return
KEncodeDecodeError
;
}
int
decoded_size
=
0
;
uint8_t
octet
=
0
;
// IEI and Length
int
decoded_header_size
=
Type4NasIe
::
Decode
(
buf
+
decoded_size
,
len
,
is_iei
);
if
(
decoded_header_size
==
KEncodeDecodeError
)
return
KEncodeDecodeError
;
decoded_size
+=
decoded_header_size
;
// EEA
DECODE_U8
(
buf
+
decoded_size
,
eea_
,
decoded_size
);
// EIA
DECODE_U8
(
buf
+
decoded_size
,
eia_
,
decoded_size
);
int
ie_len
=
GetIeLength
();
// UEA
if
(
ie_len
>
decoded_size
)
{
DECODE_U8
(
buf
+
decoded_size
,
octet
,
decoded_size
);
uea_
=
std
::
make_optional
<
uint8_t
>
(
octet
);
}
// UIA
if
(
ie_len
>
decoded_size
)
{
DECODE_U8
(
buf
+
decoded_size
,
octet
,
decoded_size
);
uia_
=
std
::
make_optional
<
uint8_t
>
(
octet
&
0x7f
);
}
// GEA
if
(
ie_len
>
decoded_size
)
{
DECODE_U8
(
buf
+
decoded_size
,
octet
,
decoded_size
);
gea_
=
std
::
make_optional
<
uint8_t
>
(
octet
&
0x7f
);
}
Logger
::
nas_mm
().
debug
(
"Decoded %s, len (%d)"
,
GetIeName
().
c_str
(),
decoded_size
);
Logger
::
nas_mm
().
debug
(
"EEA 0x%x, EIA 0x%x"
,
eea_
,
eia_
);
if
(
uea_
.
has_value
())
{
Logger
::
nas_mm
().
debug
(
"UEA 0x%x"
,
uea_
.
value
());
}
if
(
uia_
.
has_value
())
{
Logger
::
nas_mm
().
debug
(
"UIA 0x%x"
,
uia_
.
value
());
}
if
(
gea_
.
has_value
())
{
Logger
::
nas_mm
().
debug
(
"GEA 0x%x"
,
gea_
.
value
());
}
return
decoded_size
;
}
src/nas/ies/
Additional_5G_Security_Information
.hpp
→
src/nas/ies/
S1UeSecurityCapability
.hpp
View file @
2f184c9d
...
...
@@ -19,38 +19,50 @@
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _S1_UE_SECURITY_CAPABILITY_H
#define _S1_UE_SECURITY_CAPABILITY_H
#ifndef __Additional_5G_Security_Information_H_
#define __Additional_5G_Security_Information_H_
#include "Type4NasIe.hpp"
#include <stdint.h>
constexpr
uint8_t
kS1UeSecurityCapabilityMinimumLength
=
4
;
constexpr
uint8_t
kS1UeSecurityCapabilityMaximumLength
=
7
;
constexpr
auto
kS1UeSecurityCapabilityIeName
=
"S1 UE Security Capability"
;
namespace
nas
{
class
Additional_5G_Security_Information
{
class
S1UeSecurityCapability
:
public
Type4NasIe
{
public:
Additional_5G_Security_Information
();
Additional_5G_Security_Information
(
uint8_t
iei
);
Additional_5G_Security_Information
(
const
uint8_t
iei
,
bool
RINMR
,
bool
HDP
);
~
Additional_5G_Security_Information
();
S1UeSecurityCapability
();
S1UeSecurityCapability
(
uint8_t
iei
);
S1UeSecurityCapability
(
const
uint8_t
iei
,
uint8_t
eea
,
uint8_t
eia
);
S1UeSecurityCapability
(
const
uint8_t
iei
,
uint8_t
eea
,
uint8_t
eia
,
uint8_t
uea
,
uint8_t
uia
);
~
S1UeSecurityCapability
();
void
SetEea
(
uint8_t
sel
);
uint8_t
GetEea
()
const
;
void
SetEia
(
uint8_t
sel
);
uint8_t
GetEia
()
const
;
void
Set
(
uint8_t
eea
,
uint8_t
eia
);
void
Get
(
uint8_t
&
eea
,
uint8_t
&
eia
)
const
;
void
Set
(
uint8_t
eea
,
uint8_t
eia
,
uint8_t
uea
,
uint8_t
uia
);
void
Get
(
uint8_t
&
eea
,
uint8_t
&
eia
,
uint8_t
&
uea
,
uint8_t
&
uia
)
const
;
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
);
void
setRINMR
(
bool
value
);
void
setHDP
(
bool
value
);
bool
getRINMR
();
bool
getHDP
();
int
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_iei
);
private:
uint8_t
_iei
;
bool
RINMR
;
bool
HDP
;
uint8_t
eea_
;
uint8_t
eia_
;
std
::
optional
<
uint8_t
>
uea_
;
// 5th octet, Optional
std
::
optional
<
uint8_t
>
uia_
;
// 6th octet, Optional
std
::
optional
<
uint8_t
>
gea_
;
// 7th octet, Optional
};
}
// namespace nas
#endif
src/nas/msgs/AuthenticationRequest.cpp
View file @
2f184c9d
...
...
@@ -43,14 +43,14 @@ void AuthenticationRequest::setHeader(uint8_t security_header_type) {
}
//------------------------------------------------------------------------------
void
AuthenticationRequest
::
setngKSI
(
uint8_t
tsc
,
uint8_t
key_set_id
)
{
void
AuthenticationRequest
::
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
)
{
ie_ngKSI
.
Set
(
false
);
// 4 lower bits
ie_ngKSI
.
SetNasKeyIdentifier
(
key_set_id
);
ie_ngKSI
.
SetTypeOfSecurityContext
(
tsc
);
}
//------------------------------------------------------------------------------
void
AuthenticationRequest
::
setABBA
(
uint8_t
length
,
uint8_t
*
value
)
{
void
AuthenticationRequest
::
SetAbba
(
uint8_t
length
,
uint8_t
*
value
)
{
ie_abba
.
Set
(
length
,
value
);
}
...
...
src/nas/msgs/AuthenticationRequest.hpp
View file @
2f184c9d
...
...
@@ -36,9 +36,9 @@ class AuthenticationRequest : public NasMmPlainHeader {
void
setHeader
(
uint8_t
security_header_type
);
void
setngKSI
(
uint8_t
tsc
,
uint8_t
key_set_id
);
void
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
);
void
SetEapMessage
(
bstring
eap
);
void
setABBA
(
uint8_t
length
,
uint8_t
*
value
);
void
SetAbba
(
uint8_t
length
,
uint8_t
*
value
);
void
setAuthentication_Parameter_RAND
(
uint8_t
value
[
kAuthenticationParameterRandValueLength
]);
void
setAuthentication_Parameter_AUTN
(
...
...
src/nas/msgs/AuthenticationResult.cpp
View file @
2f184c9d
...
...
@@ -52,12 +52,12 @@ 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_ngKSI
=
new
NasKeySetIdentifier
(
tsc
,
key_set_id
);
}
//------------------------------------------------------------------------------
void
AuthenticationResult
::
setABBA
(
uint8_t
length
,
uint8_t
*
value
)
{
void
AuthenticationResult
::
SetAbba
(
uint8_t
length
,
uint8_t
*
value
)
{
ie_abba
=
new
ABBA
(
0x38
,
length
,
value
);
}
...
...
src/nas/msgs/AuthenticationResult.hpp
View file @
2f184c9d
...
...
@@ -40,9 +40,9 @@ class AuthenticationResult {
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
Decode
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
);
void
setHeader
(
uint8_t
security_header_type
);
void
setngKSI
(
uint8_t
tsc
,
uint8_t
key_set_id
);
void
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
);
void
SetEapMessage
(
bstring
eap
);
void
setABBA
(
uint8_t
length
,
uint8_t
*
value
);
void
SetAbba
(
uint8_t
length
,
uint8_t
*
value
);
public:
NasMmPlainHeader
*
plain_header
;
...
...
src/nas/msgs/DeregistrationRequest.cpp
View file @
2f184c9d
...
...
@@ -68,7 +68,7 @@ void DeregistrationRequest::setDeregistrationType(
}
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
setngKSI
(
uint8_t
tsc
,
uint8_t
key_set_id
)
{
void
DeregistrationRequest
::
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
)
{
ie_ngKSI
=
new
NasKeySetIdentifier
(
tsc
,
key_set_id
);
ie_ngKSI
->
Set
(
true
);
// high position
}
...
...
src/nas/msgs/DeregistrationRequest.hpp
View file @
2f184c9d
...
...
@@ -43,7 +43,7 @@ class DeregistrationRequest {
void
setHeader
(
uint8_t
security_header_type
);
void
setDeregistrationType
(
uint8_t
dereg_type
);
void
setDeregistrationType
(
_5gs_deregistration_type_t
type
);
void
setngKSI
(
uint8_t
tsc
,
uint8_t
key_set_id
);
void
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
);
void
setMobilityIdentityType
(
uint8_t
type
);
void
setSUCI_SUPI_format_IMSI
(
...
...
src/nas/msgs/RegistrationRequest.cpp
View file @
2f184c9d
...
...
@@ -76,7 +76,7 @@ bool RegistrationRequest::get5gsRegistrationType(
}
//------------------------------------------------------------------------------
void
RegistrationRequest
::
setngKSI
(
uint8_t
tsc
,
uint8_t
key_set_id
)
{
void
RegistrationRequest
::
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
)
{
ie_ngKSI
.
Set
(
true
);
// high pos
ie_ngKSI
.
SetNasKeyIdentifier
(
key_set_id
);
ie_ngKSI
.
SetTypeOfSecurityContext
(
tsc
);
...
...
src/nas/msgs/RegistrationRequest.hpp
View file @
2f184c9d
...
...
@@ -47,7 +47,7 @@ class RegistrationRequest : public NasMmPlainHeader {
void
set5gsRegistrationType
(
bool
is_for
,
uint8_t
type
);
bool
get5gsRegistrationType
(
bool
&
is_for
,
uint8_t
&
reg_type
/*3bits*/
);
void
setngKSI
(
uint8_t
tsc
,
uint8_t
key_set_id
);
void
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
);
bool
getngKSI
(
uint8_t
&
ng_ksi
);
uint8_t
getMobileIdentityType
();
...
...
src/nas/msgs/SecurityModeCommand.cpp
View file @
2f184c9d
...
...
@@ -46,46 +46,46 @@ void SecurityModeCommand::setHeader(uint8_t security_header_type) {
}
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
setNAS_Security_
Algorithms
(
void
SecurityModeCommand
::
SetNasSecurity
Algorithms
(
uint8_t
ciphering
,
uint8_t
integrity
)
{
ie_selected_nas_security_algorithms
.
Set
(
ciphering
,
integrity
);
}
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
setngKSI
(
uint8_t
tsc
,
uint8_t
key_set_id
)
{
void
SecurityModeCommand
::
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
)
{
ie_ngKSI
.
SetTypeOfSecurityContext
(
tsc
);
ie_ngKSI
.
SetNasKeyIdentifier
(
key_set_id
);
}
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
setUE_Security_
Capability
(
void
SecurityModeCommand
::
SetUeSecurity
Capability
(
uint8_t
g_EASel
,
uint8_t
g_IASel
)
{
ie_ue_security_capability
.
Set
(
g_EASel
,
g_IASel
);
}
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
setUE_Security_
Capability
(
void
SecurityModeCommand
::
SetUeSecurity
Capability
(
uint8_t
g_EASel
,
uint8_t
g_IASel
,
uint8_t
eea
,
uint8_t
eia
)
{
ie_ue_security_capability
.
Set
(
g_EASel
,
g_IASel
,
eea
,
eia
);
}
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
setIMEISV_
Request
(
uint8_t
value
)
{
void
SecurityModeCommand
::
SetImeisv
Request
(
uint8_t
value
)
{
ie_imeisv_request
=
std
::
make_optional
<
ImeisvRequest
>
(
value
);
}
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
setEPS_NAS_Security_
Algorithms
(
void
SecurityModeCommand
::
SetEpsNasSecurity
Algorithms
(
uint8_t
ciphering
,
uint8_t
integrity
)
{
ie_eps_nas_security_algorithms
=
std
::
make_optional
<
EpsNasSecurityAlgorithms
>
(
ciphering
,
integrity
);
}
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
setAdditional_5G_Security_
Information
(
void
SecurityModeCommand
::
SetAdditional5gSecurity
Information
(
bool
rinmr
,
bool
hdp
)
{
ie_additional_5G_security_information
=
std
::
make_optional
<
Additional
_5G_Security_Information
>
(
0x36
,
rinmr
,
hdp
);
std
::
make_optional
<
Additional
5gSecurityInformation
>
(
rinmr
,
hdp
);
}
//------------------------------------------------------------------------------
...
...
@@ -94,15 +94,15 @@ void SecurityModeCommand::SetEapMessage(bstring 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
);
}
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
setS1_UE_Security_
Capability
(
void
SecurityModeCommand
::
SetS1UeSecurity
Capability
(
uint8_t
g_EEASel
,
uint8_t
g_EIASel
)
{
ie_s1_ue_security_capability
=
std
::
make_optional
<
S1
_UE_Security_
Capability
>
(
0x19
,
g_EEASel
,
g_EIASel
);
std
::
make_optional
<
S1
UeSecurity
Capability
>
(
0x19
,
g_EEASel
,
g_EIASel
);
}
//------------------------------------------------------------------------------
...
...
@@ -295,9 +295,10 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
case
0x36
:
{
Logger
::
nas_mm
().
debug
(
"decoding IEI (0x36)"
);
Additional_5G_Security_Information
case
kIeiAdditional5gSecurityInformation
:
{
Logger
::
nas_mm
().
debug
(
"decoding IEI 0x%x"
,
kIeiAdditional5gSecurityInformation
);
Additional5gSecurityInformation
ie_additional_5G_security_information_tmp
=
{};
if
((
decoded_result
=
ie_additional_5G_security_information_tmp
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
))
==
...
...
@@ -305,12 +306,12 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
return
decoded_result
;
decoded_size
+=
decoded_result
;
ie_additional_5G_security_information
=
std
::
optional
<
Additional
_5G_Security_
Information
>
(
std
::
optional
<
Additional
5gSecurity
Information
>
(
ie_additional_5G_security_information_tmp
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
case
0x78
:
{
case
kIeiEapMessage
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI 0x%x"
,
kIeiEapMessage
);
EapMessage
ie_eap_message_tmp
=
{};
if
((
decoded_result
=
ie_eap_message_tmp
.
Decode
(
...
...
@@ -322,7 +323,7 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
case
0x38
:
{
case
kIeiAbba
:
{
Logger
::
nas_mm
().
debug
(
"decoding IEI (0x38)"
);
ABBA
ie_abba_tmp
=
{};
if
((
decoded_result
=
ie_abba_tmp
.
Decode
(
...
...
@@ -336,13 +337,13 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
}
break
;
case
0x19
:
{
Logger
::
nas_mm
().
debug
(
"decoding IEI (0x19)"
);
S1
_UE_Security_
Capability
ie_s1_ue_security_capability_tmp
=
{};
S1
UeSecurity
Capability
ie_s1_ue_security_capability_tmp
=
{};
if
((
decoded_result
=
ie_s1_ue_security_capability_tmp
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
))
==
KEncodeDecodeError
)
return
decoded_result
;
decoded_size
+=
decoded_result
;
ie_s1_ue_security_capability
=
std
::
optional
<
S1
_UE_Security_
Capability
>
(
ie_s1_ue_security_capability
=
std
::
optional
<
S1
UeSecurity
Capability
>
(
ie_s1_ue_security_capability_tmp
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
...
...
src/nas/msgs/SecurityModeCommand.hpp
View file @
2f184c9d
...
...
@@ -36,34 +36,34 @@ class SecurityModeCommand : public NasMmPlainHeader {
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
Decode
(
uint8_t
*
buf
,
int
len
);
void
setNAS_Security_
Algorithms
(
uint8_t
ciphering
,
uint8_t
integrity
);
void
SetNasSecurity
Algorithms
(
uint8_t
ciphering
,
uint8_t
integrity
);
// TODO: Get
void
setngKSI
(
uint8_t
tsc
,
uint8_t
key_set_id
);
void
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
);
// TODO: Get
void
setUE_Security_
Capability
(
uint8_t
g_EASel
,
uint8_t
g_IASel
);
void
SetUeSecurity
Capability
(
uint8_t
g_EASel
,
uint8_t
g_IASel
);
// TODO: Get
void
setUE_Security_
Capability
(
void
SetUeSecurity
Capability
(
uint8_t
g_EASel
,
uint8_t
g_IASel
,
uint8_t
eea
,
uint8_t
eia
);
// TODO: Get
void
setIMEISV_
Request
(
uint8_t
value
);
void
SetImeisv
Request
(
uint8_t
value
);
// TODO: Get
void
setEPS_NAS_Security_
Algorithms
(
uint8_t
ciphering
,
uint8_t
integrity
);
void
SetEpsNasSecurity
Algorithms
(
uint8_t
ciphering
,
uint8_t
integrity
);
// TODO: Get
void
setAdditional_5G_Security_
Information
(
bool
rinmr
,
bool
hdp
);
void
SetAdditional5gSecurity
Information
(
bool
rinmr
,
bool
hdp
);
// TODO: Get
void
SetEapMessage
(
bstring
eap
);
// TODO: Get
void
setABBA
(
uint8_t
length
,
uint8_t
*
value
);
void
SetAbba
(
uint8_t
length
,
uint8_t
*
value
);
// TODO: Get
void
setS1_UE_Security_
Capability
(
uint8_t
g_EEASel
,
uint8_t
g_EIASel
);
void
SetS1UeSecurity
Capability
(
uint8_t
g_EEASel
,
uint8_t
g_EIASel
);
// TODO: Get
public:
...
...
@@ -74,11 +74,11 @@ class SecurityModeCommand : public NasMmPlainHeader {
std
::
optional
<
ImeisvRequest
>
ie_imeisv_request
;
// Optional
std
::
optional
<
EpsNasSecurityAlgorithms
>
ie_eps_nas_security_algorithms
;
// Optional
std
::
optional
<
Additional
_5G_Security_
Information
>
std
::
optional
<
Additional
5gSecurity
Information
>
ie_additional_5G_security_information
;
// Optional
std
::
optional
<
EapMessage
>
ie_eap_message
;
// Optional
std
::
optional
<
ABBA
>
ie_abba
;
// Optional
std
::
optional
<
S1
_UE_Security_
Capability
>
std
::
optional
<
S1
UeSecurity
Capability
>
ie_s1_ue_security_capability
;
// Optional
};
...
...
src/nas/msgs/ServiceRequest.cpp
View file @
2f184c9d
...
...
@@ -56,7 +56,7 @@ void ServiceRequest::setHeader(uint8_t security_header_type) {
}
//------------------------------------------------------------------------------
void
ServiceRequest
::
setngKSI
(
uint8_t
tsc
,
uint8_t
key_set_id
)
{
void
ServiceRequest
::
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
)
{
ie_ngKSI
=
new
NasKeySetIdentifier
(
tsc
,
key_set_id
);
}
...
...
src/nas/msgs/ServiceRequest.hpp
View file @
2f184c9d
...
...
@@ -45,7 +45,7 @@ class ServiceRequest {
public:
void
setHeader
(
uint8_t
security_header_type
);
void
setngKSI
(
uint8_t
tsc
,
uint8_t
key_set_id
);
void
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
);
void
setServiceType
(
uint8_t
stp
);
void
Set5gSTmsi
(
uint16_t
amfSetId
,
uint8_t
amfPointer
,
string
tmsi
);
void
setUplink_data_status
(
uint16_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