Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
UERANSIM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
Libraries
UERANSIM
Commits
a7e067b8
Commit
a7e067b8
authored
Apr 26, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UE Authentication refactor
parent
76c64f41
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
22 deletions
+12
-22
src/ue/nas/mm/auth.cpp
src/ue/nas/mm/auth.cpp
+12
-22
No files found.
src/ue/nas/mm/auth.cpp
View file @
a7e067b8
...
...
@@ -9,7 +9,6 @@
#include "mm.hpp"
#include <ue/nas/keys.hpp>
static
const
bool
IGNORE_CONTROLS_FAILURES
=
false
;
static
const
bool
USE_SQN_HACK
=
true
;
// TODO
namespace
nr
::
ue
...
...
@@ -62,9 +61,6 @@ void NasMm::receiveAuthenticationRequestEap(const nas::AuthenticationRequest &ms
// Log.warning(Tag.CONFIG, "USE_SQN_HACK: %s", USE_SQN_HACK);
}
if
(
IGNORE_CONTROLS_FAILURES
)
m_logger
->
warn
(
"IGNORE_CONTROLS_FAILURES enabled"
);
if
(
USE_SQN_HACK
)
{
auto
ak
=
calculateMilenage
(
OctetString
::
FromSpare
(
6
),
receivedRand
).
ak
;
...
...
@@ -106,7 +102,7 @@ void NasMm::receiveAuthenticationRequestEap(const nas::AuthenticationRequest &ms
// m_logger->debug("calculated kaut: %s", kaut.toHexString().c_str());
// Control received KDF
if
(
!
IGNORE_CONTROLS_FAILURES
&&
receivedKdf
!=
1
)
if
(
receivedKdf
!=
1
)
{
ueRejectionTimers
();
...
...
@@ -148,7 +144,7 @@ void NasMm::receiveAuthenticationRequestEap(const nas::AuthenticationRequest &ms
eapResponse
->
attributes
.
putClientErrorCode
(
0
);
}
if
(
!
IGNORE_CONTROLS_FAILURES
&&
eapResponse
!=
nullptr
)
if
(
eapResponse
!=
nullptr
)
{
ueRejectionTimers
();
...
...
@@ -168,21 +164,18 @@ void NasMm::receiveAuthenticationRequestEap(const nas::AuthenticationRequest &ms
m_logger
->
err
(
"AT_MAC failure in EAP AKA'. expected: %s received: %s"
,
expectedMac
.
toHexString
().
c_str
(),
receivedMac
.
toHexString
().
c_str
());
if
(
!
IGNORE_CONTROLS_FAILURES
)
{
ueRejectionTimers
();
ueRejectionTimers
();
auto
eapResponse
=
std
::
make_unique
<
eap
::
EapAkaPrime
>
(
eap
::
ECode
::
RESPONSE
,
receivedEap
.
id
,
eap
::
ESubType
::
AKA_CLIENT_ERROR
);
eapResponse
->
attributes
.
putClientErrorCode
(
0
);
auto
eapResponse
=
std
::
make_unique
<
eap
::
EapAkaPrime
>
(
eap
::
ECode
::
RESPONSE
,
receivedEap
.
id
,
eap
::
ESubType
::
AKA_CLIENT_ERROR
);
eapResponse
->
attributes
.
putClientErrorCode
(
0
);
nas
::
AuthenticationReject
response
;
response
.
eapMessage
=
nas
::
IEEapMessage
{};
response
.
eapMessage
->
eap
=
std
::
move
(
eapResponse
);
nas
::
AuthenticationReject
response
;
response
.
eapMessage
=
nas
::
IEEapMessage
{};
response
.
eapMessage
->
eap
=
std
::
move
(
eapResponse
);
sendNasMessage
(
response
);
return
;
}
sendNasMessage
(
response
);
return
;
}
// Create new partial native NAS security context and continue key derivation
...
...
@@ -238,9 +231,6 @@ void NasMm::receiveAuthenticationRequest5gAka(const nas::AuthenticationRequest &
// Log.warning(Tag.CONFIG, "USE_SQN_HACK: %s", USE_SQN_HACK);
}
if
(
IGNORE_CONTROLS_FAILURES
)
m_logger
->
warn
(
"IGNORE_CONTROLS_FAILURES enabled"
);
if
(
!
msg
.
authParamRAND
.
has_value
()
||
!
msg
.
authParamAUTN
.
has_value
())
{
sendFailure
(
nas
::
EMmCause
::
SEMANTICALLY_INCORRECT_MESSAGE
);
...
...
@@ -275,7 +265,7 @@ void NasMm::receiveAuthenticationRequest5gAka(const nas::AuthenticationRequest &
auto
autnCheck
=
validateAutn
(
milenageAk
,
milenageMac
,
autn
);
if
(
IGNORE_CONTROLS_FAILURES
||
autnCheck
==
EAutnValidationRes
::
OK
)
if
(
autnCheck
==
EAutnValidationRes
::
OK
)
{
// Create new partial native NAS security context and continue with key derivation
m_usim
->
m_nonCurrentNsCtx
=
std
::
make_unique
<
NasSecurityContext
>
();
...
...
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