Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
authentication_security
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
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
liuxu
authentication_security
Commits
b130341f
Commit
b130341f
authored
Sep 19, 2023
by
liuxu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add output parm kasme 230919
parent
65e9a14b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
20 deletions
+21
-20
Au_Sec/src/authen_sec.c
Au_Sec/src/authen_sec.c
+13
-10
Au_Sec/src/authen_sec.h
Au_Sec/src/authen_sec.h
+2
-2
Au_Sec/src/main.c
Au_Sec/src/main.c
+6
-8
No files found.
Au_Sec/src/authen_sec.c
View file @
b130341f
...
...
@@ -1402,14 +1402,15 @@ int nas_stream_encrypt_eia2(nas_stream_cipher_t *stream_cipher, uint8_t out[4])
char
*
KiStr
=
"00112233445566778899aabbccddeeff"
;
int
authenticate
(
u8
*
rand
,
u8
*
autn
,
u8
*
opc
,
u8
*
res
,
u8
*
knas_enc
,
u8
*
knas_int
)
char
*
opcStr
=
"000102030405060708090a0b0c0d0e0f"
;
int
authenticate
(
u8
*
rand
,
u8
*
autn
,
u8
*
res
,
u8
*
kasme
,
u8
*
knas_enc
,
u8
*
knas_int
)
{
LOG_FUNC_IN
;
int
rc
;
int
i
;
u8
ck
[
16
],
ik
[
16
],
Ki
[
16
],
kasme
[
32
];
u8
ck
[
16
],
ik
[
16
],
Ki
[
16
],
opc
[
16
];
plmn_t
*
plmn
=
(
plmn_t
*
)
malloc
(
sizeof
(
plmn_t
));
...
...
@@ -1431,6 +1432,7 @@ int authenticate(u8 *rand, u8 *autn, u8 *opc, u8 *res, u8 *knas_enc, u8 *knas_in
plmn
->
MNCdigit1
,
plmn
->
MNCdigit2
);
to_hex
(
KiStr
,
Ki
,
sizeof
(
Ki
)
);
to_hex
(
opcStr
,
opc
,
sizeof
(
opc
));
/* Compute the authentication response RES = f2K (RAND) */
/* Compute the cipher key CK = f3K (RAND) */
...
...
@@ -1545,6 +1547,7 @@ int authenticate(u8 *rand, u8 *autn, u8 *opc, u8 *res, u8 *knas_enc, u8 *knas_in
kasme
,
32
);
printf
(
"kasme:
\n
"
);
for
(
int
i
=
0
;
i
<
32
;
i
++
)
printf
(
"%02X "
,
kasme
[
i
]);
printf
(
"
\n
"
);
...
...
@@ -1647,16 +1650,16 @@ int authenticate(u8 *rand, u8 *autn, u8 *opc, u8 *res, u8 *knas_enc, u8 *knas_in
}
void
nr_authenciate
(
uint8_t
*
rand
,
uint8_t
*
sqn
,
uint8_t
*
opc
,
char
*
imsiStr
,
uint8_t
nmc_size
,
char
*
imsiStr
=
"466920000000001"
;
void
nr_authenciate
(
uint8_t
*
rand
,
uint8_t
*
sqn
,
uint8_t
nmc_size
,
uint8_t
*
xres
,
uint8_t
*
kgnb
,
uint8_t
*
knas_int
)
{
uint8_t
kausf
[
32
],
kseaf
[
32
],
kamf
[
32
],
Ki
[
16
];
uint8_t
kausf
[
32
],
kseaf
[
32
],
kamf
[
32
],
Ki
[
16
]
,
opc
[
16
]
;
uint8_t
resTemp
[
16
];
uint8_t
ck
[
16
],
ik
[
16
],
ak
[
6
];
to_hex
(
KiStr
,
Ki
,
sizeof
(
Ki
)
);
to_hex
(
opcStr
,
opc
,
sizeof
(
opc
));
f2345
(
Ki
,
rand
,
resTemp
,
ck
,
ik
,
ak
,
opc
);
...
...
@@ -1675,26 +1678,26 @@ void nr_authenciate(uint8_t *rand, uint8_t *sqn, uint8_t *opc, char *imsiStr, ui
printf
(
"kausf:"
);
for
(
int
i
=
0
;
i
<
32
;
i
++
){
printf
(
"%x "
,
kausf
[
i
]);
printf
(
"%
02
x "
,
kausf
[
i
]);
}
printf
(
"
\n
"
);
printf
(
"kseaf:"
);
for
(
int
i
=
0
;
i
<
32
;
i
++
){
printf
(
"%x "
,
kseaf
[
i
]);
printf
(
"%
02
x "
,
kseaf
[
i
]);
}
printf
(
"
\n
"
);
printf
(
"kamf:"
);
for
(
int
i
=
0
;
i
<
32
;
i
++
){
printf
(
"%x "
,
kamf
[
i
]);
printf
(
"%
02
x "
,
kamf
[
i
]);
}
printf
(
"
\n
"
);
printf
(
"knas_int:
\n
"
);
for
(
int
i
=
0
;
i
<
16
;
i
++
){
printf
(
"%x "
,
knas_int
[
i
]);
printf
(
"%
02
x "
,
knas_int
[
i
]);
}
printf
(
"
\n
"
);
}
Au_Sec/src/authen_sec.h
View file @
b130341f
...
...
@@ -58,9 +58,9 @@ int nas_stream_encrypt_eia1(nas_stream_cipher_t *stream_cipher, uint8_t out[4]);
int
nas_stream_encrypt_eia2
(
nas_stream_cipher_t
*
stream_cipher
,
uint8_t
out
[
4
]);
int
authenticate
(
u8
*
rand
,
u8
*
autn
,
u8
*
opc
,
u8
*
res
,
u8
*
knas_enc
,
u8
*
knas_int
);
int
authenticate
(
u8
*
rand
,
u8
*
autn
,
u8
*
res
,
u8
*
kasme
,
u8
*
knas_enc
,
u8
*
knas_int
);
void
nr_authenciate
(
uint8_t
*
rand
,
uint8_t
*
sqn
,
uint8_t
*
opc
,
char
*
imsiStr
,
uint8_t
nmc_size
,
void
nr_authenciate
(
uint8_t
*
rand
,
uint8_t
*
sqn
,
uint8_t
nmc_size
,
uint8_t
*
xres
,
uint8_t
*
kgnb
,
uint8_t
*
knas_int
);
#endif
\ No newline at end of file
Au_Sec/src/main.c
View file @
b130341f
...
...
@@ -4,13 +4,12 @@
int
main
(
void
){
char
*
randStr
,
*
opStr
,
*
autnStr
,
*
imsi
Str
,
*
sqnStr
;
u8
rand
[
16
],
op
[
16
],
autn
[
16
],
res
[
8
],
knas_enc
[
32
],
knas_int
[
32
],
nmc_size
;
char
*
randStr
,
*
autn
Str
,
*
sqnStr
;
u8
rand
[
16
],
autn
[
16
],
res
[
8
],
kasme
[
32
],
knas_enc
[
16
],
knas_int
[
16
],
nmc_size
;
u8
nrknas_int
[
16
],
kgnb
[
32
],
sqn
[
6
],
nr_res
[
8
];
imsiStr
=
"466920000000001"
;
randStr
=
"48d918eaf3c93e26d263063c67f5b82e"
;
opStr
=
"000102030405060708090a0b0c0d0e0f"
;
autnStr
=
"45b91d3dd4a590017f8725d4320e9fe8"
;
sqnStr
=
"000011132760"
;
nmc_size
=
2
;
...
...
@@ -37,7 +36,7 @@ int main(void){
return
-
1
;
}
void
(
*
nr_authenciate
)(
uint8_t
*
,
uint8_t
*
,
uint8_t
*
,
char
*
,
uint8_t
,
void
(
*
nr_authenciate
)(
uint8_t
*
,
uint8_t
*
,
uint8_t
,
uint8_t
*
,
uint8_t
*
,
uint8_t
*
);
nr_authenciate
=
dlsym
(
handle
,
"nr_authenciate"
);
if
(
!
nr_authenciate
){
...
...
@@ -50,14 +49,13 @@ int main(void){
to_hex
(
sqnStr
,
sqn
,
sizeof
(
sqn
));
to_hex
(
randStr
,
rand
,
sizeof
(
rand
));
to_hex
(
opStr
,
op
,
sizeof
(
op
));
to_hex
(
autnStr
,
autn
,
sizeof
(
autn
));
if
(
authenticate
(
rand
,
autn
,
op
,
res
,
knas_enc
,
knas_int
)
==
RETURNok
)
if
(
authenticate
(
rand
,
autn
,
res
,
kasme
,
knas_enc
,
knas_int
)
==
RETURNok
)
printf
(
"UE LTE authentication succeeded!
\n
"
);
else
printf
(
"UE LTE authentication failed!
\n
"
);
nr_authenciate
(
rand
,
sqn
,
op
,
imsiStr
,
nmc_size
,
nr_res
,
kgnb
,
nrknas_int
);
nr_authenciate
(
rand
,
sqn
,
nmc_size
,
nr_res
,
kgnb
,
nrknas_int
);
return
0
;
}
\ No newline at end of file
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