Commit eca3b993 authored by aligungr's avatar aligungr

UE authentication procedure improvements

parent 611a2ea4
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
namespace nr::ue namespace nr::ue
{ {
SqnManager::SqnManager(uint64_t indBitLen, uint64_t wrappingDelta, uint64_t limit) SqnManager::SqnManager(uint64_t indBitLen, uint64_t wrappingDelta)
: m_indBitLen{indBitLen}, m_wrappingDelta{wrappingDelta}, m_limit{limit}, m_sqnArr(1ull << m_indBitLen) : m_indBitLen{indBitLen}, m_wrappingDelta{wrappingDelta}, m_sqnArr(1ull << m_indBitLen)
{ {
if (m_indBitLen < 2 || m_indBitLen > 16) if (m_indBitLen < 2 || m_indBitLen > 16)
throw std::runtime_error("bad indBitLen"); throw std::runtime_error("bad indBitLen");
...@@ -50,8 +50,6 @@ bool SqnManager::checkSqn(uint64_t sqn) ...@@ -50,8 +50,6 @@ bool SqnManager::checkSqn(uint64_t sqn)
if (seq - getSeqMs() > m_wrappingDelta) if (seq - getSeqMs() > m_wrappingDelta)
return false; return false;
if (getSeqMs() - seq >= m_limit)
return false;
if (seq <= getSeqFromSqn(m_sqnArr[ind])) if (seq <= getSeqFromSqn(m_sqnArr[ind]))
return false; return false;
......
...@@ -22,12 +22,11 @@ class SqnManager ...@@ -22,12 +22,11 @@ class SqnManager
private: private:
uint64_t m_indBitLen; uint64_t m_indBitLen;
uint64_t m_wrappingDelta; uint64_t m_wrappingDelta;
uint64_t m_limit;
std::vector<uint64_t> m_sqnArr; std::vector<uint64_t> m_sqnArr;
public: public:
SqnManager(uint64_t indBitLen, uint64_t wrappingDelta, uint64_t limit); SqnManager(uint64_t indBitLen, uint64_t wrappingDelta);
private: private:
[[nodiscard]] uint64_t getSeqFromSqn(uint64_t sqn) const; [[nodiscard]] uint64_t getSeqFromSqn(uint64_t sqn) const;
......
...@@ -20,7 +20,7 @@ void ue::Usim::initialize(bool hasSupi, const UeConfig::Initials &initials) ...@@ -20,7 +20,7 @@ void ue::Usim::initialize(bool hasSupi, const UeConfig::Initials &initials)
m_defConfiguredNssai = initials.defaultConfiguredNssai; m_defConfiguredNssai = initials.defaultConfiguredNssai;
m_configuredNssai = initials.configuredNssai; m_configuredNssai = initials.configuredNssai;
m_sqnMng = std::make_unique<SqnManager>(5ull, 1ull << 28ull, ~0ull); m_sqnMng = std::make_unique<SqnManager>(5ull, 1ull << 28ull);
} }
bool Usim::isValid() bool Usim::isValid()
......
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