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
951db225
Commit
951db225
authored
Mar 31, 2021
by
yangjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix nea1 encrypt algorithm
parent
63c70695
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+6
-4
src/nas/msgs/ULNASTransport.cpp
src/nas/msgs/ULNASTransport.cpp
+1
-0
No files found.
src/amf-app/amf_n1.cpp
View file @
951db225
...
...
@@ -2320,7 +2320,6 @@ bool amf_n1::nas_message_integrity_protected(nas_secu_ctx *nsc,
count
=
0x00000000
|
((
nsc
->
dl_count
.
overflow
&
0x0000ffff
)
<<
8
)
|
((
nsc
->
dl_count
.
seq_num
&
0x000000ff
));
}
else
{
Logger
::
amf_n1
().
debug
(
"nsc->ul_count.overflow %x"
,
nsc
->
ul_count
.
overflow
);
count
=
0x00000000
|
((
nsc
->
ul_count
.
overflow
&
0x0000ffff
)
<<
8
)
|
((
nsc
->
ul_count
.
seq_num
&
0x000000ff
));
}
...
...
@@ -2331,7 +2330,6 @@ bool amf_n1::nas_message_integrity_protected(nas_secu_ctx *nsc,
AUTH_KNAS_INT_SIZE
);
stream_cipher
.
key_length
=
AUTH_KNAS_INT_SIZE
;
stream_cipher
.
count
=
*
(
input_nas
);
stream_cipher
.
bearer
=
0x01
;
// stream_cipher.count = count;
if
(
!
direction
)
{
nsc
->
ul_count
.
seq_num
=
stream_cipher
.
count
;
...
...
@@ -2379,17 +2377,22 @@ bool amf_n1::nas_message_cipher_protected(nas_secu_ctx *nsc, uint8_t direction,
int
buf_len
=
blength
(
input_nas
);
uint32_t
count
=
0x00000000
;
if
(
direction
)
{
count
=
0x00000000
|
((
nsc
->
dl_count
.
overflow
&
0x0000ffff
)
<<
8
)
|
((
nsc
->
dl_count
.
seq_num
&
0x000000ff
));
}
else
{
Logger
::
amf_n1
().
debug
(
"nsc->ul_count.overflow %x"
,
nsc
->
ul_count
.
overflow
);
count
=
0x00000000
|
((
nsc
->
ul_count
.
overflow
&
0x0000ffff
)
<<
8
)
|
((
nsc
->
ul_count
.
seq_num
&
0x000000ff
));
}
nas_stream_cipher_t
stream_cipher
=
{
0
};
uint8_t
mac
[
4
];
stream_cipher
.
key
=
nsc
->
knas_enc
;
stream_cipher
.
key_length
=
AUTH_KNAS_ENC_SIZE
;
stream_cipher
.
count
=
count
;
stream_cipher
.
bearer
=
0x0
0
;
// 33.501 section 8.1.1
stream_cipher
.
bearer
=
0x0
1
;
// 33.501 section 8.1.1
stream_cipher
.
direction
=
direction
;
// "1" for downlink
stream_cipher
.
message
=
(
uint8_t
*
)
bdata
(
input_nas
);
stream_cipher
.
blength
=
blength
(
input_nas
)
<<
3
;
...
...
@@ -2412,7 +2415,6 @@ bool amf_n1::nas_message_cipher_protected(nas_secu_ctx *nsc, uint8_t direction,
nas_algorithms
::
nas_stream_encrypt_nea1
(
&
stream_cipher
,
ciphered
);
output_nas
=
blk2bstr
(
ciphered
,
((
stream_cipher
.
blength
+
31
)
/
32
)
*
4
);
// output_nas = blk2bstr(ciphered, blength(input_nas));
free
(
ciphered
);
}
break
;
case
EA2_128_5G
:
{
...
...
src/nas/msgs/ULNASTransport.cpp
View file @
951db225
...
...
@@ -400,6 +400,7 @@ int ULNASTransport::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf,
if
(
flag
)
{
Logger
::
nas_mm
().
debug
(
"Unknown IEI (0x%x)"
,
octet
);
decoded_size
++
;
*
(
buf
+
decoded_size
)
=
0x00
;
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
...
...
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