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
4e693945
Commit
4e693945
authored
May 01, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EAP AKA' bug fix
parent
dd3e06bc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
16 deletions
+44
-16
src/lib/nas/eap.cpp
src/lib/nas/eap.cpp
+43
-14
src/lib/nas/eap.hpp
src/lib/nas/eap.hpp
+1
-2
No files found.
src/lib/nas/eap.cpp
View file @
4e693945
...
...
@@ -13,32 +13,60 @@
OctetString
eap
::
EapAttributes
::
getRand
()
const
{
return
attributes
[(
int
)
EAttributeType
::
AT_RAND
].
value
().
subCopy
(
2
);
auto
&
val
=
attributes
[(
int
)
EAttributeType
::
AT_RAND
];
if
(
!
val
.
has_value
()
||
val
->
length
()
<
2
)
return
{};
int
len
=
val
->
get2I
(
0
);
if
(
len
!=
val
->
length
()
-
2
)
return
{};
return
val
->
subCopy
(
2
);
}
OctetString
eap
::
EapAttributes
::
getMac
()
const
{
return
attributes
[(
int
)
EAttributeType
::
AT_MAC
].
value
().
subCopy
(
2
);
auto
&
val
=
attributes
[(
int
)
EAttributeType
::
AT_MAC
];
if
(
!
val
.
has_value
()
||
val
->
length
()
<
2
)
return
{};
int
len
=
val
->
get2I
(
0
);
if
(
len
!=
val
->
length
()
-
2
)
return
{};
return
val
->
subCopy
(
2
);
}
OctetString
eap
::
EapAttributes
::
getAutn
()
const
{
return
attributes
[(
int
)
EAttributeType
::
AT_AUTN
].
value
().
subCopy
(
2
);
auto
&
val
=
attributes
[(
int
)
EAttributeType
::
AT_AUTN
];
if
(
!
val
.
has_value
()
||
val
->
length
()
<
2
)
return
{};
int
len
=
val
->
get2I
(
0
);
if
(
len
!=
val
->
length
()
-
2
)
return
{};
return
val
->
subCopy
(
2
);
}
int
eap
::
EapAttributes
::
getClientErrorCode
()
const
{
return
attributes
[(
int
)
EAttributeType
::
AT_CLIENT_ERROR_CODE
].
value
().
get2I
(
0
);
auto
&
val
=
attributes
[(
int
)
EAttributeType
::
AT_CLIENT_ERROR_CODE
];
if
(
!
val
.
has_value
()
||
val
->
length
()
!=
2
)
return
0
;
return
val
->
get2I
(
0
);
}
int
eap
::
EapAttributes
::
getKdf
()
const
{
return
attributes
[(
int
)
EAttributeType
::
AT_KDF
].
value
().
get2I
(
0
);
}
auto
&
val
=
attributes
[(
int
)
EAttributeType
::
AT_KDF
];
const
OctetString
&
eap
::
EapAttributes
::
getAuts
()
const
{
return
attributes
[(
int
)
EAttributeType
::
AT_AUTS
].
value
();
if
(
!
val
.
has_value
())
return
0
;
if
(
val
->
length
()
!=
2
)
return
0
;
return
val
->
get2I
(
0
);
}
void
eap
::
EapAttributes
::
putRes
(
const
OctetString
&
value
)
...
...
@@ -51,11 +79,6 @@ void eap::EapAttributes::putMac(const OctetString &value)
attributes
[(
int
)
EAttributeType
::
AT_MAC
]
=
OctetString
::
Concat
(
OctetString
::
FromOctet2
(
0
),
value
);
}
void
eap
::
EapAttributes
::
putAutn
(
const
OctetString
&
value
)
{
attributes
[(
int
)
EAttributeType
::
AT_AUTN
]
=
OctetString
::
Concat
(
OctetString
::
FromOctet2
(
0
),
value
);
}
void
eap
::
EapAttributes
::
putKdf
(
int
value
)
{
attributes
[(
int
)
EAttributeType
::
AT_KDF
]
=
OctetString
::
FromOctet2
(
value
);
...
...
@@ -83,6 +106,12 @@ void eap::EapAttributes::putRawAttribute(eap::EAttributeType key, OctetString &&
attributes
[(
int
)
key
]
=
std
::
move
(
value
);
}
OctetString
eap
::
EapAttributes
::
getKdfInput
()
const
{
// TODO
return
OctetString
();
}
eap
::
Eap
::
Eap
(
eap
::
ECode
code
,
octet
id
,
eap
::
EEapType
eapType
)
:
code
(
code
),
id
(
id
),
eapType
(
eapType
)
{
}
...
...
src/lib/nas/eap.hpp
View file @
4e693945
...
...
@@ -142,12 +142,11 @@ class EapAttributes
[[
nodiscard
]]
OctetString
getAutn
()
const
;
[[
nodiscard
]]
int
getClientErrorCode
()
const
;
[[
nodiscard
]]
int
getKdf
()
const
;
[[
nodiscard
]]
const
OctetString
&
getAuts
()
const
;
[[
nodiscard
]]
OctetString
getKdfInput
()
const
;
public:
void
putRes
(
const
OctetString
&
value
);
void
putMac
(
const
OctetString
&
value
);
void
putAutn
(
const
OctetString
&
value
);
void
putKdf
(
int
value
);
void
putClientErrorCode
(
int
code
);
void
putAuts
(
OctetString
&&
auts
);
...
...
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