Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
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
lizhongxiao
OpenXG-RAN
Commits
aa2cebd2
Commit
aa2cebd2
authored
Apr 04, 2023
by
Anatolii Pankevych
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugz 124092: [NAS][nrUE] enable security
parent
43fed655
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
362 additions
and
185 deletions
+362
-185
openair3/NAS/COMMON/API/NETWORK/nas_message.c
openair3/NAS/COMMON/API/NETWORK/nas_message.c
+2
-2
openair3/NAS/NR_UE/nr_nas_msg_sim.c
openair3/NAS/NR_UE/nr_nas_msg_sim.c
+334
-174
openair3/NAS/NR_UE/nr_nas_msg_sim.h
openair3/NAS/NR_UE/nr_nas_msg_sim.h
+26
-9
No files found.
openair3/NAS/COMMON/API/NETWORK/nas_message.c
View file @
aa2cebd2
...
@@ -1052,7 +1052,7 @@ static int _nas_message_decrypt(
...
@@ -1052,7 +1052,7 @@ static int _nas_message_decrypt(
stream_cipher
.
message
=
(
unsigned
char
*
)
src
;
stream_cipher
.
message
=
(
unsigned
char
*
)
src
;
/* length in bits */
/* length in bits */
stream_cipher
.
blength
=
length
<<
3
;
stream_cipher
.
blength
=
length
<<
3
;
nas_stream_encrypt_eea
1
(
&
stream_cipher
,
(
unsigned
char
*
)
dest
);
nas_stream_encrypt_eea
2
(
&
stream_cipher
,
(
unsigned
char
*
)
dest
);
/* Decode the first octet (security header type or EPS bearer identity,
/* Decode the first octet (security header type or EPS bearer identity,
* and protocol discriminator) */
* and protocol discriminator) */
DECODE_U8
(
dest
,
*
(
uint8_t
*
)(
&
header
),
size
);
DECODE_U8
(
dest
,
*
(
uint8_t
*
)(
&
header
),
size
);
...
@@ -1097,7 +1097,7 @@ static int _nas_message_decrypt(
...
@@ -1097,7 +1097,7 @@ static int _nas_message_decrypt(
LOG_FUNC_RETURN
(
0
);
LOG_FUNC_RETURN
(
0
);
};
};
LOG_FUNC_RETURN
(
0
);
LOG_FUNC_RETURN
(
0
);
}
}
/****************************************************************************
/****************************************************************************
...
...
openair3/NAS/NR_UE/nr_nas_msg_sim.c
View file @
aa2cebd2
This diff is collapsed.
Click to expand it.
openair3/NAS/NR_UE/nr_nas_msg_sim.h
View file @
aa2cebd2
...
@@ -85,18 +85,34 @@
...
@@ -85,18 +85,34 @@
#define PAYLOAD_CONTAINER_LENGTH_MIN 3
#define PAYLOAD_CONTAINER_LENGTH_MIN 3
#define PAYLOAD_CONTAINER_LENGTH_MAX 65537
#define PAYLOAD_CONTAINER_LENGTH_MAX 65537
#define NR_NAS_CIP_INT_KEY_LEN_BYTES (16)
#define NIA0_ALG_ID EIA0_ALG_ID
// 3GPP TS 33.501: D.3.1.2 128-NIA1 128-NIA1 is identical to 128-EIA1 as specified in Annex B of TS 33.401
#define NIA1_128_ALG_ID EIA1_128_ALG_ID
// 3GPP TS 33.501: D.3.1.3 128-NIA2 128-NIA2 is identical to 128-EIA2 as specified in Annex B of TS 33.401
#define NIA2_128_ALG_ID EIA2_128_ALG_ID
#define NEA0_ALG_ID EEA0_ALG_ID
// 3GPP TS 33.501: D.2.1.2 128-NEA1 128-NEA1 is identical to 128-EEA1 as specified in Annex B of TS 33.401
#define NEA1_128_ALG_ID EEA1_128_ALG_ID
// 3GPP TS 33.501: D.2.1.3 128-NEA2 128-NEA2 is identical to 128-EEA2 as specified in Annex B of TS 33.401
#define NEA2_128_ALG_ID EEA2_128_ALG_ID
/* Security Key for SA UE */
/* Security Key for SA UE */
typedef
struct
{
typedef
struct
{
uint8_t
kausf
[
32
];
uint8_t
kausf
[
32
];
uint8_t
kseaf
[
32
];
uint8_t
kseaf
[
32
];
uint8_t
kamf
[
32
];
uint8_t
kamf
[
32
];
uint8_t
knas_int
[
16
];
uint8_t
knas_int
[
NR_NAS_CIP_INT_KEY_LEN_BYTES
];
uint8_t
knas_enc
[
NR_NAS_CIP_INT_KEY_LEN_BYTES
];
uint8_t
res
[
16
];
uint8_t
res
[
16
];
uint8_t
rand
[
16
];
uint8_t
rand
[
16
];
uint8_t
kgnb
[
32
];
uint8_t
kgnb
[
32
];
}
ue_sa_security_key_t
;
}
ue_sa_security_key_t
;
typedef
enum
fgs_protocol_discriminator_e
{
typedef
enum
fgs_protocol_discriminator_e
{
/* Protocol discriminator identifier for 5GS Mobility Management */
/* Protocol discriminator identifier for 5GS Mobility Management */
FGS_MOBILITY_MANAGEMENT_MESSAGE
=
0x7E
,
FGS_MOBILITY_MANAGEMENT_MESSAGE
=
0x7E
,
...
@@ -105,7 +121,6 @@ typedef enum fgs_protocol_discriminator_e {
...
@@ -105,7 +121,6 @@ typedef enum fgs_protocol_discriminator_e {
FGS_SESSION_MANAGEMENT_MESSAGE
=
0x2E
,
FGS_SESSION_MANAGEMENT_MESSAGE
=
0x2E
,
}
fgs_protocol_discriminator_t
;
}
fgs_protocol_discriminator_t
;
typedef
struct
{
typedef
struct
{
uint8_t
ex_protocol_discriminator
;
uint8_t
ex_protocol_discriminator
;
uint8_t
security_header_type
;
uint8_t
security_header_type
;
...
@@ -135,8 +150,6 @@ typedef union {
...
@@ -135,8 +150,6 @@ typedef union {
fgs_service_request_msg
fgs_service_request
;
fgs_service_request_msg
fgs_service_request
;
}
MM_msg
;
}
MM_msg
;
typedef
struct
{
typedef
struct
{
MM_msg
mm_msg
;
/* 5GS Mobility Management messages */
MM_msg
mm_msg
;
/* 5GS Mobility Management messages */
}
fgs_nas_message_plain_t
;
}
fgs_nas_message_plain_t
;
...
@@ -146,7 +159,6 @@ typedef struct {
...
@@ -146,7 +159,6 @@ typedef struct {
fgs_nas_message_plain_t
plain
;
fgs_nas_message_plain_t
plain
;
}
fgs_nas_message_security_protected_t
;
}
fgs_nas_message_security_protected_t
;
typedef
union
{
typedef
union
{
fgs_nas_message_security_header_t
header
;
fgs_nas_message_security_header_t
header
;
fgs_nas_message_security_protected_t
security_protected
;
fgs_nas_message_security_protected_t
security_protected
;
...
@@ -184,7 +196,12 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg, int Mod_id);
...
@@ -184,7 +196,12 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg, int Mod_id);
void
generateServiceRequest
(
as_nas_info_t
*
initialNasMsg
,
int
Mod_id
);
void
generateServiceRequest
(
as_nas_info_t
*
initialNasMsg
,
int
Mod_id
);
void
*
nas_nrue_task
(
void
*
args_p
);
void
*
nas_nrue_task
(
void
*
args_p
);
#endif
/* __NR_NAS_MSG_SIM_H__*/
/**
* The helper function to recalculate the kgnb, where kgnb=f(kamf, ulNasCount).
* With current implementation, NAS calulates and reports the kgnb value to RRC
* once, but UE need this key refreshed after the RRC Release for subsequent
* calculations of AS Security keys. Note, the NAS keeps track of UlNASCount.
*/
void
updateKgNB
(
int
Mod_id
,
uint8_t
*
kgnb
);
#endif
/* __NR_NAS_MSG_SIM_H__*/
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