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
200a2763
Commit
200a2763
authored
Apr 26, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UE authentication procedure improvements
parent
78937f5e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
19 deletions
+13
-19
src/ue/nas/mm/auth.cpp
src/ue/nas/mm/auth.cpp
+1
-17
src/ue/nas/mm/mm.hpp
src/ue/nas/mm/mm.hpp
+0
-1
src/ue/nas/usim.cpp
src/ue/nas/usim.cpp
+6
-0
src/ue/nas/usim.hpp
src/ue/nas/usim.hpp
+6
-1
No files found.
src/ue/nas/mm/auth.cpp
View file @
200a2763
...
@@ -289,12 +289,6 @@ void NasMm::receiveAuthenticationRequest5gAka(const nas::AuthenticationRequest &
...
@@ -289,12 +289,6 @@ void NasMm::receiveAuthenticationRequest5gAka(const nas::AuthenticationRequest &
auto
&
rand
=
msg
.
authParamRAND
->
value
;
auto
&
rand
=
msg
.
authParamRAND
->
value
;
auto
&
autn
=
msg
.
authParamAUTN
->
value
;
auto
&
autn
=
msg
.
authParamAUTN
->
value
;
if
(
USE_SQN_HACK
)
{
auto
ak
=
calculateMilenage
(
OctetString
::
FromSpare
(
6
),
rand
,
false
).
ak
;
m_usim
->
m_sqn
=
OctetString
::
Xor
(
autn
.
subCopy
(
0
,
6
),
ak
);
}
auto
milenage
=
calculateMilenage
(
m_usim
->
m_sqn
,
rand
,
false
);
auto
milenage
=
calculateMilenage
(
m_usim
->
m_sqn
,
rand
,
false
);
auto
&
res
=
milenage
.
res
;
auto
&
res
=
milenage
.
res
;
auto
&
ck
=
milenage
.
ck
;
auto
&
ck
=
milenage
.
ck
;
...
@@ -441,10 +435,8 @@ EAutnValidationRes NasMm::validateAutn(const OctetString &ak, const OctetString
...
@@ -441,10 +435,8 @@ EAutnValidationRes NasMm::validateAutn(const OctetString &ak, const OctetString
}
}
// Verify that the received sequence number SQN is in the correct range
// Verify that the received sequence number SQN is in the correct range
if
(
!
checkSqn
(
receivedSQN
))
if
(
!
m_usim
->
checkSqn
(
receivedSQN
))
{
return
EAutnValidationRes
::
SYNCHRONISATION_FAILURE
;
return
EAutnValidationRes
::
SYNCHRONISATION_FAILURE
;
}
// Check MAC
// Check MAC
if
(
receivedMAC
!=
mac
)
if
(
receivedMAC
!=
mac
)
...
@@ -457,14 +449,6 @@ EAutnValidationRes NasMm::validateAutn(const OctetString &ak, const OctetString
...
@@ -457,14 +449,6 @@ EAutnValidationRes NasMm::validateAutn(const OctetString &ak, const OctetString
return
EAutnValidationRes
::
OK
;
return
EAutnValidationRes
::
OK
;
}
}
bool
NasMm
::
checkSqn
(
const
OctetString
&
sqn
)
{
// TODO:
// Verify the freshness of sequence numbers to determine whether the specified sequence number is
// in the correct range and acceptable by the USIM. See 3GPP TS 33.102, Annex C.2.
return
true
;
}
crypto
::
milenage
::
Milenage
NasMm
::
calculateMilenage
(
const
OctetString
&
sqn
,
const
OctetString
&
rand
,
bool
dummyAmf
)
crypto
::
milenage
::
Milenage
NasMm
::
calculateMilenage
(
const
OctetString
&
sqn
,
const
OctetString
&
rand
,
bool
dummyAmf
)
{
{
OctetString
amf
=
dummyAmf
?
OctetString
::
FromSpare
(
2
)
:
m_base
->
config
->
amf
.
copy
();
OctetString
amf
=
dummyAmf
?
OctetString
::
FromSpare
(
2
)
:
m_base
->
config
->
amf
.
copy
();
...
...
src/ue/nas/mm/mm.hpp
View file @
200a2763
...
@@ -115,7 +115,6 @@ class NasMm
...
@@ -115,7 +115,6 @@ class NasMm
void
receiveEapFailureMessage
(
const
eap
::
Eap
&
eap
);
void
receiveEapFailureMessage
(
const
eap
::
Eap
&
eap
);
void
receiveEapResponseMessage
(
const
eap
::
Eap
&
eap
);
void
receiveEapResponseMessage
(
const
eap
::
Eap
&
eap
);
EAutnValidationRes
validateAutn
(
const
OctetString
&
ak
,
const
OctetString
&
mac
,
const
OctetString
&
autn
);
EAutnValidationRes
validateAutn
(
const
OctetString
&
ak
,
const
OctetString
&
mac
,
const
OctetString
&
autn
);
bool
checkSqn
(
const
OctetString
&
sqn
);
crypto
::
milenage
::
Milenage
calculateMilenage
(
const
OctetString
&
sqn
,
const
OctetString
&
rand
,
bool
dummyAmf
);
crypto
::
milenage
::
Milenage
calculateMilenage
(
const
OctetString
&
sqn
,
const
OctetString
&
rand
,
bool
dummyAmf
);
private:
/* Security */
private:
/* Security */
...
...
src/ue/nas/usim.cpp
View file @
200a2763
...
@@ -33,4 +33,10 @@ void Usim::invalidate()
...
@@ -33,4 +33,10 @@ void Usim::invalidate()
m_isValid
=
false
;
m_isValid
=
false
;
}
}
bool
Usim
::
checkSqn
(
const
OctetString
&
sqn
)
{
// TODO
return
false
;
}
}
// namespace nr::ue
}
// namespace nr::ue
src/ue/nas/usim.hpp
View file @
200a2763
...
@@ -46,7 +46,6 @@ class Usim
...
@@ -46,7 +46,6 @@ class Usim
// Security related
// Security related
std
::
unique_ptr
<
NasSecurityContext
>
m_currentNsCtx
{};
std
::
unique_ptr
<
NasSecurityContext
>
m_currentNsCtx
{};
std
::
unique_ptr
<
NasSecurityContext
>
m_nonCurrentNsCtx
{};
std
::
unique_ptr
<
NasSecurityContext
>
m_nonCurrentNsCtx
{};
OctetString
m_sqn
{};
OctetString
m_rand
{};
OctetString
m_rand
{};
OctetString
m_res
{};
OctetString
m_res
{};
OctetString
m_resStar
{};
OctetString
m_resStar
{};
...
@@ -68,10 +67,16 @@ class Usim
...
@@ -68,10 +67,16 @@ class Usim
// eCall related
// eCall related
bool
m_isECallOnly
{};
bool
m_isECallOnly
{};
// SQN management
OctetString
m_sqn
{};
public:
public:
void
initialize
(
bool
hasSupi
,
const
UeConfig
::
Initials
&
initials
);
void
initialize
(
bool
hasSupi
,
const
UeConfig
::
Initials
&
initials
);
bool
isValid
();
bool
isValid
();
void
invalidate
();
void
invalidate
();
bool
checkSqn
(
const
OctetString
&
sqn
);
};
};
}
// namespace nr::ue
}
// namespace nr::ue
\ No newline at end of file
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