Commit 7286e628 authored by aligungr's avatar aligungr

Protection of initial NAS messages

parent bbd585c1
...@@ -13,9 +13,6 @@ ...@@ -13,9 +13,6 @@
#include <ue/nas/sm/sm.hpp> #include <ue/nas/sm/sm.hpp>
#include <ue/rrc/task.hpp> #include <ue/rrc/task.hpp>
// See https://github.com/aligungr/UERANSIM/issues/316 for details about this behaviour.
#define NAS_CONTAINER_NOT_CIPHERED 1
namespace nr::ue namespace nr::ue
{ {
...@@ -129,13 +126,7 @@ void NasMm::sendNasMessage(const nas::PlainMmMessage &msg) ...@@ -129,13 +126,7 @@ void NasMm::sendNasMessage(const nas::PlainMmMessage &msg)
if (HasNonCleartext(msg)) if (HasNonCleartext(msg))
{ {
OctetString originalPdu; OctetString originalPdu;
#if NAS_CONTAINER_NOT_CIPHERED
nas::EncodeNasMessage(msg, originalPdu); nas::EncodeNasMessage(msg, originalPdu);
#else
auto originalSecured = nas_enc::Encrypt(*m_usim->m_currentNsCtx, msg, false);
nas::EncodeNasMessage(*originalSecured, originalPdu);
#endif
auto copy = nas::utils::DeepCopyMsg(msg); auto copy = nas::utils::DeepCopyMsg(msg);
RemoveCleartextIEs((nas::PlainMmMessage &)*copy, std::move(originalPdu)); RemoveCleartextIEs((nas::PlainMmMessage &)*copy, std::move(originalPdu));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment