5G SA authentication: authentication request, partial authentication response
This commit is contained in:
@@ -288,7 +288,10 @@ typedef struct {
|
||||
Extendedprotocoldiscriminator_t epd:8;
|
||||
Security_header_t sh:8;
|
||||
SGSmobilitymanagementmessages_t mt:8;
|
||||
} authenticationresponseHeader_t;
|
||||
uint8_t iei;
|
||||
uint8_t RESlen;
|
||||
uint8_t RES[16];
|
||||
} authenticationresponse_t;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@ typedef struct {
|
||||
uicc_t *uicc;
|
||||
} nr_user_nas_t;
|
||||
|
||||
#define STATIC_ASSERT(test_for_true) _Static_assert((test_for_true), "(" #test_for_true ") failed")
|
||||
#define myCalloc(var, type) type * var=(type*)calloc(sizeof(type),1);
|
||||
#define arrayCpy(tO, FroM) STATIC_ASSERT(sizeof(tO) == sizeof(FroM)) ; memcpy(tO, FroM, sizeof(tO))
|
||||
|
||||
int identityResponse(void **msg, nr_user_nas_t *UE);
|
||||
#endif
|
||||
|
||||
@@ -13,6 +13,13 @@ void nas_schedule(void) {
|
||||
*/
|
||||
|
||||
void SGSauthenticationReq(void *msg, nr_user_nas_t *UE) {
|
||||
authenticationrequestHeader_t *amsg=(authenticationrequestHeader_t *) msg;
|
||||
arrayCpy(UE->uicc->rand,amsg->RAND);
|
||||
arrayCpy(UE->uicc->autn,amsg->AUTN);
|
||||
nas_schedule();
|
||||
}
|
||||
|
||||
void SGSidentityReq(void *msg, nr_user_nas_t *UE) {
|
||||
Identityrequest_t *idmsg=(Identityrequest_t *) msg;
|
||||
|
||||
if (idmsg->it == SUCI ) {
|
||||
@@ -22,9 +29,6 @@ void SGSauthenticationReq(void *msg, nr_user_nas_t *UE) {
|
||||
LOG_E(NAS,"Not developped: identity request for %d\n", idmsg->it);
|
||||
}
|
||||
|
||||
void SGSidentityReq(void *msg, nr_user_nas_t *UE) {
|
||||
}
|
||||
|
||||
void SGSsecurityModeCommand(void *msg, nr_user_nas_t *UE) {
|
||||
}
|
||||
|
||||
@@ -109,7 +113,26 @@ int identityResponse(void **msg, nr_user_nas_t *UE) {
|
||||
}
|
||||
|
||||
int authenticationResponse(void **msg,nr_user_nas_t *UE) {
|
||||
return -1;
|
||||
if (UE->uicc == NULL)
|
||||
// config file section hardcoded as "uicc", nevertheless it opens to manage several UEs or a multi SIM UE
|
||||
UE->uicc=init_uicc("uicc");
|
||||
|
||||
myCalloc(resp, authenticationresponse_t);
|
||||
resp->epd=SGSmobilitymanagementmessages;
|
||||
resp->sh=0;
|
||||
resp->mt=Authenticationresponse;
|
||||
resp->iei=IEI_AuthenticationResponse;
|
||||
resp->RESlen=sizeof(resp->RES);
|
||||
// Verify the AUTN
|
||||
uint8_t ik[16], ck[16], res[8], AUTN[16];
|
||||
milenage_generate(UE->uicc->opc, UE->uicc->amf, UE->uicc->key,
|
||||
UE->uicc->sqn, UE->uicc->rand, AUTN, ik, ck, res);
|
||||
|
||||
if ( memcmp(UE-uicc->autn, AUTN ) {
|
||||
} else {
|
||||
}
|
||||
*msg=resp;
|
||||
return sizeof(authenticationresponse_t);
|
||||
}
|
||||
|
||||
int securityModeComplete(void **msg, nr_user_nas_t *UE) {
|
||||
|
||||
@@ -46,6 +46,8 @@ typedef struct {
|
||||
uint8_t amf[2];
|
||||
uint8_t sqn[6];
|
||||
int nmc_size;
|
||||
uint8_t rand[16];
|
||||
uint8_t autn[16];
|
||||
} uicc_t;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user