Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
OpenXG
OpenXG-AMF
Commits
6649664a
Commit
6649664a
authored
Jan 11, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Authentication Request
parent
2921bc4d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
86 additions
and
82 deletions
+86
-82
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+4
-3
src/nas/ies/Authentication_Parameter_AUTN.cpp
src/nas/ies/Authentication_Parameter_AUTN.cpp
+48
-53
src/nas/ies/Authentication_Parameter_AUTN.hpp
src/nas/ies/Authentication_Parameter_AUTN.hpp
+15
-15
src/nas/ies/Authentication_Parameter_RAND.cpp
src/nas/ies/Authentication_Parameter_RAND.cpp
+6
-5
src/nas/ies/Authentication_Parameter_RAND.hpp
src/nas/ies/Authentication_Parameter_RAND.hpp
+5
-2
src/nas/msgs/AuthenticationRequest.cpp
src/nas/msgs/AuthenticationRequest.cpp
+4
-2
src/nas/msgs/AuthenticationRequest.hpp
src/nas/msgs/AuthenticationRequest.hpp
+4
-2
No files found.
src/amf-app/amf_n1.cpp
View file @
6649664a
...
...
@@ -2116,11 +2116,12 @@ bool amf_n1::start_authentication_procedure(
abba
[
0
]
=
0x00
;
abba
[
1
]
=
0x00
;
auth_request
->
setABBA
(
2
,
abba
);
uint8_t
*
rand
=
nc
->
_5g_av
[
vindex
].
rand
;
if
(
rand
)
auth_request
->
setAuthentication_Parameter_RAND
(
rand
);
//
uint8_t* rand = nc->_5g_av[vindex].rand;
auth_request
->
setAuthentication_Parameter_RAND
(
nc
->
_5g_av
[
vindex
].
rand
);
Logger
::
amf_n1
().
debug
(
"Sending Authentication Request with RAND"
);
printf
(
"0x"
);
for
(
int
i
=
0
;
i
<
16
;
i
++
)
printf
(
"%x"
,
rand
[
i
]);
for
(
int
i
=
0
;
i
<
kAuthenticationParameterRandValueLength
;
i
++
)
printf
(
"%x"
,
nc
->
_5g_av
[
vindex
].
rand
[
i
]);
printf
(
"
\n
"
);
uint8_t
*
autn
=
nc
->
_5g_av
[
vindex
].
autn
;
...
...
src/nas/ies/Authentication_Parameter_AUTN.cpp
View file @
6649664a
...
...
@@ -19,92 +19,87 @@
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "Authentication_Parameter_AUTN.hpp"
#include "3gpp_24.501.hpp"
#include "common_defs.h"
#include "logger.hpp"
using
namespace
nas
;
//------------------------------------------------------------------------------
Authentication_Parameter_AUTN
::
Authentication_Parameter_AUTN
(
uint8_t
iei
)
:
_value
()
{
_iei
=
iei
;
:
Type4NasIe
(
iei
),
_value
()
{
SetLengthIndicator
(
0
);
SetIeName
(
kAuthenticationParameterAutnIeName
);
}
//------------------------------------------------------------------------------
Authentication_Parameter_AUTN
::
Authentication_Parameter_AUTN
(
const
uint8_t
iei
,
uint8_t
*
value
)
{
_iei
=
iei
;
for
(
int
i
=
0
;
i
<
16
;
i
++
)
{
const
uint8_t
iei
,
uint8_t
value
[
kAuthenticationParameterAutnValueLength
])
:
Type4NasIe
(
iei
)
{
for
(
int
i
=
0
;
i
<
kAuthenticationParameterAutnValueLength
;
i
++
)
{
this
->
_value
[
i
]
=
value
[
i
];
}
SetLengthIndicator
(
kAuthenticationParameterAutnValueLength
);
SetIeName
(
kAuthenticationParameterAutnIeName
);
}
//------------------------------------------------------------------------------
Authentication_Parameter_AUTN
::
Authentication_Parameter_AUTN
()
:
_iei
(),
_value
()
{}
:
Type4NasIe
(),
_value
()
{
SetLengthIndicator
(
0
);
SetIeName
(
kAuthenticationParameterAutnIeName
);
}
//------------------------------------------------------------------------------
Authentication_Parameter_AUTN
::~
Authentication_Parameter_AUTN
()
{}
//------------------------------------------------------------------------------
uint8_t
*
Authentication_Parameter_AUTN
::
getValue
()
{
// for (int j = 0; j < 16; j++) {
// Logger::nas_mm().debug("decoded Authentication_Response_Parameter
// value(0x%2x)", _value[j]);
//}
return
_value
;
}
//------------------------------------------------------------------------------
int
Authentication_Parameter_AUTN
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Encoding Authentication_Parameter_AUTN IEI (0x%x)"
,
_iei
);
if
(
len
<
18
)
{
Logger
::
nas_mm
().
error
(
"len is less than 18"
);
return
0
;
Logger
::
nas_mm
().
debug
(
"Encoding %s"
,
GetIeName
().
c_str
());
int
ie_len
=
GetIeLength
();
if
(
len
<
ie_len
)
{
Logger
::
nas_mm
().
error
(
"Len is less than %d"
,
ie_len
);
return
KEncodeDecodeError
;
}
int
encoded_size
=
0
;
if
(
_iei
)
{
*
(
buf
+
encoded_size
)
=
_iei
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
16
;
encoded_size
++
;
for
(
int
i
=
0
;
i
<
16
;
i
++
)
{
*
(
buf
+
encoded_size
)
=
_value
[
i
];
encoded_size
++
;
}
return
encoded_size
;
}
else
{
// *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
// IEI and Length
int
encoded_header_size
=
Type4NasIe
::
Encode
(
buf
+
encoded_size
,
len
);
if
(
encoded_header_size
==
KEncodeDecodeError
)
return
KEncodeDecodeError
;
encoded_size
+=
encoded_header_size
;
if
(
GetLengthIndicator
()
!=
kAuthenticationParameterAutnValueLength
)
return
KEncodeDecodeError
;
for
(
int
i
=
0
;
i
<
kAuthenticationParameterAutnValueLength
;
i
++
)
{
ENCODE_U8
(
buf
+
encoded_size
,
_value
[
i
],
encoded_size
);
}
Logger
::
nas_mm
().
debug
(
"Encoded Authentication_Parameter_AUTN len (%d)"
,
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
Authentication_Parameter_AUTN
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
)
{
Logger
::
nas_mm
().
debug
(
"Decoding Authentication_Parameter_AUTN IEI (0x%x)"
,
*
buf
);
int
decoded_size
=
0
;
if
(
is_option
)
{
decoded_size
++
;
}
decoded_size
++
;
for
(
int
i
=
0
;
i
<
16
;
i
++
)
{
_value
[
i
]
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
int
Authentication_Parameter_AUTN
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_iei
)
{
uint8_t
decoded_size
=
0
;
uint8_t
octet
=
0
;
Logger
::
nas_mm
().
debug
(
"Decoding %s"
,
GetIeName
().
c_str
());
// IEI and Length
int
decoded_header_size
=
Type4NasIe
::
Decode
(
buf
+
decoded_size
,
len
,
is_iei
);
if
(
decoded_header_size
==
KEncodeDecodeError
)
return
KEncodeDecodeError
;
decoded_size
+=
decoded_header_size
;
if
(
GetLengthIndicator
()
!=
kAuthenticationParameterAutnValueLength
)
return
KEncodeDecodeError
;
for
(
int
i
=
0
;
i
<
kAuthenticationParameterAutnValueLength
;
i
++
)
{
DECODE_U8
(
buf
+
decoded_size
,
_value
[
i
],
decoded_size
);
}
for
(
int
j
=
0
;
j
<
16
;
j
++
)
{
for
(
int
j
=
0
;
j
<
kAuthenticationParameterAutnValueLength
;
j
++
)
{
Logger
::
nas_mm
().
debug
(
"Decoded Authentication_Parameter_AUTN value (0x%2x)"
,
_value
[
j
]);
}
...
...
src/nas/ies/Authentication_Parameter_AUTN.hpp
View file @
6649664a
...
...
@@ -18,35 +18,35 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef _AUTHENTICATION_PARAMETER_AUTN_H_
#define _AUTHENTICATION_PARAMETER_AUTN_H_
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __Authentication_Parameter_AUTN_H_
#define __Authentication_Parameter_AUTN_H_
#include "Type4NasIe.hpp"
#include <stdint.h>
constexpr
uint8_t
kAuthenticationParameterAutnLength
=
18
;
constexpr
uint8_t
kAuthenticationParameterAutnValueLength
=
kAuthenticationParameterAutnLength
-
2
;
constexpr
auto
kAuthenticationParameterAutnIeName
=
"Authentication Parameter AUTN"
;
namespace
nas
{
class
Authentication_Parameter_AUTN
{
class
Authentication_Parameter_AUTN
:
public
Type4NasIe
{
public:
Authentication_Parameter_AUTN
();
Authentication_Parameter_AUTN
(
uint8_t
iei
);
Authentication_Parameter_AUTN
(
const
uint8_t
iei
,
uint8_t
*
value
);
Authentication_Parameter_AUTN
(
const
uint8_t
iei
,
uint8_t
value
[
kAuthenticationParameterAutnValueLength
]);
~
Authentication_Parameter_AUTN
();
// void setValue(uint8_t iei, uint8_t value);
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
);
uint8_t
*
getValue
();
private:
uint8_t
_iei
;
uint8_t
_value
[
16
];
uint8_t
_value
[
kAuthenticationParameterAutnValueLength
];
};
}
// namespace nas
...
...
src/nas/ies/Authentication_Parameter_RAND.cpp
View file @
6649664a
...
...
@@ -39,9 +39,9 @@ Authentication_Parameter_RAND::Authentication_Parameter_RAND(uint8_t iei)
//------------------------------------------------------------------------------
Authentication_Parameter_RAND
::
Authentication_Parameter_RAND
(
uint8_t
iei
,
uint8_t
*
value
)
uint8_t
iei
,
uint8_t
value
[
kAuthenticationParameterRandValueLength
]
)
:
Type3NasIe
(
iei
)
{
for
(
int
i
=
0
;
i
<
16
;
i
++
)
{
for
(
int
i
=
0
;
i
<
kAuthenticationParameterRandValueLength
;
i
++
)
{
this
->
_value
[
i
]
=
value
[
i
];
}
SetIeName
(
kAuthenticationParameterRandIeName
);
...
...
@@ -71,7 +71,8 @@ int Authentication_Parameter_RAND::Encode(uint8_t* buf, int len) {
// IEI
encoded_size
+=
Type3NasIe
::
Encode
(
buf
+
encoded_size
,
len
);
for
(
int
i
=
0
;
i
<
kAuthenticationParameterRandLength
-
1
;
i
++
)
{
for
(
int
i
=
0
;
i
<
kAuthenticationParameterRandValueLength
;
i
++
)
{
ENCODE_U8
(
buf
+
encoded_size
,
_value
[
i
],
encoded_size
);
}
...
...
@@ -96,11 +97,11 @@ int Authentication_Parameter_RAND::Decode(uint8_t* buf, int len, bool is_iei) {
// IEI and Length
decoded_size
+=
Type3NasIe
::
Decode
(
buf
+
decoded_size
,
len
,
is_iei
);
for
(
int
i
=
0
;
i
<
kAuthenticationParameterRand
Length
-
1
;
i
++
)
{
for
(
int
i
=
0
;
i
<
kAuthenticationParameterRand
ValueLength
;
i
++
)
{
DECODE_U8
(
buf
+
decoded_size
,
_value
[
i
],
decoded_size
);
}
for
(
int
j
=
0
;
j
<
kAuthenticationParameterRand
Length
-
1
;
j
++
)
{
for
(
int
j
=
0
;
j
<
kAuthenticationParameterRand
ValueLength
;
j
++
)
{
Logger
::
nas_mm
().
debug
(
"Decoded Authentication_Parameter_RAND value (0x%2x)"
,
_value
[
j
]);
}
...
...
src/nas/ies/Authentication_Parameter_RAND.hpp
View file @
6649664a
...
...
@@ -27,6 +27,8 @@
#include <stdint.h>
constexpr
uint8_t
kAuthenticationParameterRandLength
=
17
;
constexpr
uint8_t
kAuthenticationParameterRandValueLength
=
kAuthenticationParameterRandLength
-
1
;
constexpr
auto
kAuthenticationParameterRandIeName
=
"Authentication Parameter RAND"
;
...
...
@@ -36,7 +38,8 @@ class Authentication_Parameter_RAND : public Type3NasIe {
public:
Authentication_Parameter_RAND
();
Authentication_Parameter_RAND
(
uint8_t
iei
);
Authentication_Parameter_RAND
(
uint8_t
iei
,
uint8_t
*
value
);
Authentication_Parameter_RAND
(
uint8_t
iei
,
uint8_t
value
[
kAuthenticationParameterRandValueLength
]);
~
Authentication_Parameter_RAND
();
int
Encode
(
uint8_t
*
buf
,
int
len
);
...
...
@@ -45,7 +48,7 @@ class Authentication_Parameter_RAND : public Type3NasIe {
// uint8_t* getValue();
private:
uint8_t
_value
[
kAuthenticationParameterRand
Length
-
1
];
uint8_t
_value
[
kAuthenticationParameterRand
ValueLength
];
};
}
// namespace nas
...
...
src/nas/msgs/AuthenticationRequest.cpp
View file @
6649664a
...
...
@@ -55,14 +55,16 @@ void AuthenticationRequest::setABBA(uint8_t length, uint8_t* value) {
}
//------------------------------------------------------------------------------
void
AuthenticationRequest
::
setAuthentication_Parameter_RAND
(
uint8_t
*
value
)
{
void
AuthenticationRequest
::
setAuthentication_Parameter_RAND
(
uint8_t
value
[
kAuthenticationParameterRandValueLength
])
{
ie_authentication_parameter_rand
=
std
::
make_optional
<
Authentication_Parameter_RAND
>
(
kIeiAuthenticationParameterRand
,
value
);
}
//------------------------------------------------------------------------------
void
AuthenticationRequest
::
setAuthentication_Parameter_AUTN
(
uint8_t
*
value
)
{
void
AuthenticationRequest
::
setAuthentication_Parameter_AUTN
(
uint8_t
value
[
kAuthenticationParameterAutnValueLength
])
{
ie_authentication_parameter_autn
=
std
::
make_optional
<
Authentication_Parameter_AUTN
>
(
kIeiAuthenticationParameterAutn
,
value
);
...
...
src/nas/msgs/AuthenticationRequest.hpp
View file @
6649664a
...
...
@@ -39,8 +39,10 @@ class AuthenticationRequest : public NasMmPlainHeader {
void
setngKSI
(
uint8_t
tsc
,
uint8_t
key_set_id
);
void
setEAP_Message
(
bstring
eap
);
void
setABBA
(
uint8_t
length
,
uint8_t
*
value
);
void
setAuthentication_Parameter_RAND
(
uint8_t
*
value
);
void
setAuthentication_Parameter_AUTN
(
uint8_t
*
value
);
void
setAuthentication_Parameter_RAND
(
uint8_t
value
[
kAuthenticationParameterRandValueLength
]);
void
setAuthentication_Parameter_AUTN
(
uint8_t
value
[
kAuthenticationParameterAutnValueLength
]);
public:
NasKeySetIdentifier
ie_ngKSI
;
// Mandatory
...
...
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