fix L2 tracing in wireshark, start security mode comman

This commit is contained in:
laurent
2020-09-24 11:55:43 +02:00
parent 3024f57805
commit ffd4c20e58
6 changed files with 145 additions and 112 deletions
+21 -1
View File
@@ -310,7 +310,7 @@ typedef struct __attribute__((packed)) {
}
authenticationrequestHeader_t;
typedef struct {
typedef struct __attribute__((packed){
Extendedprotocoldiscriminator_t epd:8;
Security_header_t sh:8;
SGSmobilitymanagementmessages_t mt:8;
@@ -321,6 +321,26 @@ typedef struct {
//AUTHENTICATION RESULT
typedef struct __attribute__((packed)) {
Extendedprotocoldiscriminator_t epd:8;
Security_header_t sh:8;
SGSmobilitymanagementmessages_t mt:8;
unsigned int selectedNASsecurityalgorithms;
unsigned int ngKSI:4; //ngKSI NAS key set identifier 9.11.3.32
unsigned int spare:4;
// LV 3-9 bytes Replayed UE security capabilities UE security capability 9.11.3.54
/* optional
TV (E-, 1 byte) Oprional IMEISV request IMEISV request 9.11.3.28
TV (57, 2 bytes ) Selected EPS NAS security algorithms EPS NAS security algorithms 9.11.3.25
TLV (36, 3 bytes) Additional 5G security information Additional 5G security information 9.11.3.12
TLV-E (78,, 7-1503 bytes) EAP message EAP message 9.11.2.2
TLV (38, 4-n)ABBA ABBA 9.11.3.10
TLV (19, 4-7) Replayed S1 UE security capabilities S1 UE security capability 9.11.3.48A
*/
} securityModeCommand_t;
typedef struct {
uicc_t *uicc;
+16
View File
@@ -59,6 +59,7 @@ void SGSauthenticationResp(void *msg, NRUEcontext_t *UE) {
}
void SGSsecurityModeComplete(void *msg, NRUEcontext_t *UE) {
}
void SGSregistrationComplete(void *msg, NRUEcontext_t *UE) {
@@ -171,5 +172,20 @@ int authenticationRequest(void **msg, NRUEcontext_t *UE) {
int securityModeCommand(void **msg, NRUEcontext_t *UE) {
*msg=NULL;
myCalloc(req, securityModeCommand_t);
req->epd=SGSmobilitymanagementmessages;
req->sh=0;
req->mt=Securitymodecommand;
// integrity algo from 5G-IA0 (null algo) to 5G-IA7 in first 4 bits
unsigned int ia=0;
// cyphering algo from 5G-EA0 (null algo) to 5G-IA7 in MSB 4 bits
unsigned int ea=0;
// trace from commercial: 5G-IA0 (0) 128-5G-IA2 (2)
req->selectedNASsecurityalgorithms= ea<<4 | ia;
// KSI: N-NAS-int-alg 0x02
req->ngKSI=2;
return 0;
}