Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openairinterface5G
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mingxuan Li
openairinterface5G
Commits
f8f1723b
Commit
f8f1723b
authored
2 years ago
by
Luis Pereira
Browse files
Options
Downloads
Patches
Plain Diff
Derive K_NG-RAN* key for RRCReestablishment
parent
c3d01306
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
openair2/UTIL/OSA/osa_defs.h
+2
-0
2 additions, 0 deletions
openair2/UTIL/OSA/osa_defs.h
openair2/UTIL/OSA/osa_internal.h
+1
-0
1 addition, 0 deletions
openair2/UTIL/OSA/osa_internal.h
openair2/UTIL/OSA/osa_key_deriver.c
+25
-27
25 additions, 27 deletions
openair2/UTIL/OSA/osa_key_deriver.c
with
28 additions
and
27 deletions
openair2/UTIL/OSA/osa_defs.h
+
2
−
0
View file @
f8f1723b
...
...
@@ -61,6 +61,8 @@ int derive_key(algorithm_type_dist_t nas_alg_type, uint8_t nas_enc_alg_id,
int
nr_derive_key
(
algorithm_type_dist_t
alg_type
,
uint8_t
alg_id
,
const
uint8_t
key
[
32
],
uint8_t
**
out
);
int
nr_derive_key_ng_ran_star
(
uint16_t
pci
,
uint64_t
nr_arfcn_dl
,
const
uint8_t
key
[
32
],
uint8_t
*
key_ng_ran_star
);
//#define derive_key_nas_enc(aLGiD, kEY, kNAS) derive_key(NAS_ENC_ALG, aLGiD, kEY, kNAS)
//#define derive_key_nas_int(aLGiD, kEY, kNAS) derive_key(NAS_INT_ALG, aLGiD, kEY, kNAS)
...
...
This diff is collapsed.
Click to expand it.
openair2/UTIL/OSA/osa_internal.h
+
1
−
0
View file @
f8f1723b
...
...
@@ -37,6 +37,7 @@
#define FC_KASME_TO_CK (0x16)
#define NR_FC_ALG_KEY_DER (0x69)
#define NR_FC_ALG_KEY_NG_RAN_STAR_DER (0x70)
#ifndef hton_int32
# define hton_int32(x) \
...
...
This diff is collapsed.
Click to expand it.
openair2/UTIL/OSA/osa_key_deriver.c
+
25
−
27
View file @
f8f1723b
...
...
@@ -127,40 +127,38 @@ int nr_derive_key(algorithm_type_dist_t alg_type, uint8_t alg_id,
return
0
;
}
/*
int derive_keNB(const uint8_t key[32], const uint32_t nas_count, uint8_t **keNB)
int
nr_derive_key_ng_ran_star
(
uint16_t
pci
,
uint64_t
nr_arfcn_dl
,
const
uint8_t
key
[
32
],
uint8_t
*
key_ng_ran_star
)
{
uint8_t string[7];
uint8_t
*
out
;
uint8_t
s
[
10
];
// FC
string[0] = FC_KENB;
// P0 = Uplink NAS count
string[1] = (nas_count & 0xff000000) >> 24;
string[2] = (nas_count & 0x00ff0000) >> 16;
string[3] = (nas_count & 0x0000ff00) >> 8;
string[4] = (nas_count & 0x000000ff);
/* FC */
s
[
0
]
=
NR_FC_ALG_KEY_NG_RAN_STAR_DER
;
/
/ Length of NAS count
s
tring[5] = 0x00
;
s
tring[6] = 0x04
;
/
* P0 = PCI */
s
[
1
]
=
(
pci
&
0x0000ff00
)
>>
8
;
s
[
2
]
=
(
pci
&
0x000000ff
)
;
#if defined(SECU_DEBUG)
{
int i;
char payload[6 * sizeof(string) + 1];
int index = 0;
for (i = 0; i < sizeof(string); i++)
index += sprintf(&payload[index], "0x%02x ", string[i]);
LOG_D(OSA, "KeNB deriver input string: %s\n", payload);
}
#endif
/* L0 = length(P0) = 2 */
s
[
3
]
=
0x00
;
s
[
4
]
=
0x02
;
/* P1 = NR ARFCN */
s
[
5
]
=
(
nr_arfcn_dl
&
0x00ff0000
)
>>
16
;
s
[
6
]
=
(
nr_arfcn_dl
&
0x0000ff00
)
>>
8
;
s
[
7
]
=
(
nr_arfcn_dl
&
0x000000ff
);
/* L1 = length(P1) = 3 */
s
[
8
]
=
0x00
;
s
[
9
]
=
0x03
;
kdf(s
tring, 7
, key, 32,
keNB
, 32);
kdf
(
s
,
10
,
key
,
32
,
&
out
,
32
);
return 0;
memcpy
(
key_ng_ran_star
,
out
,
32
);
free
(
out
);
return
0
;
}
*/
int
derive_skgNB
(
const
uint8_t
*
keNB
,
const
uint16_t
sk_counter
,
uint8_t
*
skgNB
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment