modifications in UE NAS to allow OAI UE to connect to. Note this is hard-coded in NAS, it will no longer work with openairCN. To be fixed before merging into develop branch
.
This commit is contained in:
@@ -21,9 +21,21 @@
|
||||
/*--------- Operator Variant Algorithm Configuration Field --------*/
|
||||
/*------- Insert your value of OP here -------*/
|
||||
/* PFT OP used currently in HSS (OPENAIRHSS/auc/kdf.c) */
|
||||
#define OAI_LTEBOX
|
||||
|
||||
#ifdef OAI_LTEBOX
|
||||
//1006020f0a478bf6b699f15c062e42b3
|
||||
/*u8 OP[16] = {0xb3, 0x42, 0x2e, 0x06, 0x5c, 0xf1, 0x99, 0xb6,
|
||||
0xf6, 0x8b, 0x47, 0x0a, 0x0f, 0x02, 0x06, 0x10
|
||||
};*/
|
||||
u8 OP[16] = {0x10, 0x06, 0x02, 0x0f, 0x0a, 0x47, 0x8b, 0xf6,
|
||||
0xb6, 0x99, 0xf1, 0x5c, 0x06, 0x2e, 0x42, 0xb3
|
||||
};
|
||||
#else
|
||||
u8 OP[16] = {0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11
|
||||
};
|
||||
#endif
|
||||
/*------- Insert your value of OP here -------*/
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
|
||||
@@ -77,7 +77,7 @@ Description Implements the API used by the NAS layer to read/write
|
||||
* Subscriber authentication security key
|
||||
*/
|
||||
#define USIM_API_K_SIZE 16
|
||||
#define USIM_API_K_VALUE "8BAF473F2F8FD09487CCCBD7097C6862"
|
||||
#define USIM_API_K_VALUE "fec86ba6eb707ed08905757b1bb44b8f"
|
||||
|
||||
static uint8_t _usim_api_k[USIM_API_K_SIZE];
|
||||
|
||||
@@ -85,9 +85,13 @@ static uint8_t _usim_api_k[USIM_API_K_SIZE];
|
||||
/*
|
||||
* List of last used Sequence Numbers SQN
|
||||
*/
|
||||
#define USIM_API_AK_SIZE 6
|
||||
#define USIM_API_SQN_SIZE USIM_API_AK_SIZE
|
||||
#define USIM_API_SQNMS_SIZE USIM_API_SQN_SIZE
|
||||
|
||||
static struct _usim_api_data_s {
|
||||
/* Highest sequence number the USIM has ever accepted */
|
||||
uint32_t sqn_ms;
|
||||
uint8_t sqn_ms[USIM_API_SQNMS_SIZE];
|
||||
/* List of the last used sequence numbers */
|
||||
#define USIM_API_SQN_LIST_SIZE 32
|
||||
uint8_t n_sqns;
|
||||
@@ -230,25 +234,25 @@ int usim_api_authenticate(const OctetString* rand_pP, const OctetString* autn_pP
|
||||
/* Compute the cipher key CK = f3K (RAND) */
|
||||
/* Compute the integrity key IK = f4K (RAND) */
|
||||
/* Compute the anonymity key AK = f5K (RAND) */
|
||||
#define USIM_API_AK_SIZE 6
|
||||
|
||||
u8 ak[USIM_API_AK_SIZE];
|
||||
f2345(_usim_api_k, rand_pP->value,
|
||||
res_pP->value, ck_pP->value, ik_pP->value, ak);
|
||||
LOG_TRACE(DEBUG, "USIM-API - res(f2) :%s",dump_octet_string(res_pP));
|
||||
LOG_TRACE(DEBUG, "USIM-API - ck(f3) :%s",dump_octet_string(ck_pP));
|
||||
LOG_TRACE(DEBUG, "USIM-API - ik(f4) :%s",dump_octet_string(ik_pP));
|
||||
LOG_TRACE(DEBUG, "USIM-API - ak(f5) : %02X%02X%02X%02X%02X%02X",
|
||||
LOG_TRACE(INFO, "USIM-API - res(f2) :%s",dump_octet_string(res_pP));
|
||||
LOG_TRACE(INFO, "USIM-API - ck(f3) :%s",dump_octet_string(ck_pP));
|
||||
LOG_TRACE(INFO, "USIM-API - ik(f4) :%s",dump_octet_string(ik_pP));
|
||||
LOG_TRACE(INFO, "USIM-API - ak(f5) : %02X%02X%02X%02X%02X%02X",
|
||||
ak[0],ak[1],ak[2],ak[3],ak[4],ak[5]);
|
||||
|
||||
/* Retrieve the sequence number SQN = (SQN ⊕ AK) ⊕ AK */
|
||||
#define USIM_API_SQN_SIZE USIM_API_AK_SIZE
|
||||
|
||||
u8 sqn[USIM_API_SQN_SIZE];
|
||||
|
||||
for (i = 0; i < USIM_API_SQN_SIZE; i++) {
|
||||
sqn[i] = autn_pP->value[i] ^ ak[i];
|
||||
}
|
||||
|
||||
LOG_TRACE(DEBUG, "USIM-API - Retrieved SQN %02X%02X%02X%02X%02X%02X",
|
||||
LOG_TRACE(INFO, "USIM-API - Retrieved SQN %02X%02X%02X%02X%02X%02X",
|
||||
sqn[0],sqn[1],sqn[2],sqn[3],sqn[4],sqn[5]);
|
||||
|
||||
/* Compute XMAC = f1K (SQN || RAND || AMF) */
|
||||
@@ -267,14 +271,15 @@ int usim_api_authenticate(const OctetString* rand_pP, const OctetString* autn_pP
|
||||
USIM_API_XMAC_SIZE) != 0 ) {
|
||||
LOG_TRACE(INFO,
|
||||
"USIM-API - Comparing the XMAC with the MAC included in AUTN Failed");
|
||||
rc = RETURNerror;
|
||||
//LOG_FUNC_RETURN (RETURNerror);
|
||||
} else {
|
||||
LOG_TRACE(INFO,
|
||||
"USIM-API - Comparing the XMAC with the MAC included in AUTN Succeeded");
|
||||
/* Verify that the received sequence number SQN is in the correct range */
|
||||
rc = _usim_api_check_sqn(*(uint32_t*)(sqn), sqn[USIM_API_SQN_SIZE - 1]);
|
||||
}
|
||||
|
||||
/* Verify that the received sequence number SQN is in the correct range */
|
||||
rc = _usim_api_check_sqn(*(uint32_t*)(sqn), sqn[USIM_API_SQN_SIZE - 1]);
|
||||
|
||||
if (rc != RETURNok) {
|
||||
/* Synchronisation failure; compute the AUTS parameter */
|
||||
@@ -283,15 +288,16 @@ int usim_api_authenticate(const OctetString* rand_pP, const OctetString* autn_pP
|
||||
* Conc(SQNMS) = SQNMS ⊕ f5*K(RAND) */
|
||||
f5star(_usim_api_k, rand_pP->value, ak);
|
||||
|
||||
#define USIM_API_SQNMS_SIZE USIM_API_SQN_SIZE
|
||||
|
||||
u8 sqn_ms[USIM_API_SQNMS_SIZE];
|
||||
memset(sqn_ms, 0, USIM_API_SQNMS_SIZE);
|
||||
#define USIM_API_SQN_MS_SIZE 3
|
||||
|
||||
for (i = 0; i < USIM_API_SQN_MS_SIZE; i++) {
|
||||
//#define USIM_API_SQN_MS_SIZE 3
|
||||
printf("_usim_api_data.sqn_ms %p\n",_usim_api_data.sqn_ms);
|
||||
for (i = 0; i < USIM_API_SQNMS_SIZE; i++) {
|
||||
#warning "LG:BUG HERE TODO"
|
||||
printf("i %d: ((uint8_t*)(_usim_api_data.sqn_ms))[USIM_API_SQNMS_SIZE - i] %d\n",i, ((uint8_t*)(_usim_api_data.sqn_ms))[USIM_API_SQNMS_SIZE - i]);
|
||||
sqn_ms[USIM_API_SQNMS_SIZE - i] =
|
||||
((uint8_t*)(_usim_api_data.sqn_ms))[USIM_API_SQN_MS_SIZE - i];
|
||||
((uint8_t*)(_usim_api_data.sqn_ms))[USIM_API_SQNMS_SIZE - i];
|
||||
}
|
||||
|
||||
u8 sqnms[USIM_API_SQNMS_SIZE];
|
||||
@@ -317,6 +323,8 @@ int usim_api_authenticate(const OctetString* rand_pP, const OctetString* autn_pP
|
||||
* AUTS = Conc(SQNMS) || MACS */
|
||||
memcpy(&auts_pP->value[0], sqnms, USIM_API_SQNMS_SIZE);
|
||||
memcpy(&auts_pP->value[USIM_API_SQNMS_SIZE], macs, USIM_API_MACS_SIZE);
|
||||
auts_pP->length = USIM_API_SQNMS_SIZE + USIM_API_MACS_SIZE;
|
||||
LOG_FUNC_RETURN (RETURNerror);
|
||||
}
|
||||
|
||||
LOG_FUNC_RETURN (RETURNok);
|
||||
|
||||
Reference in New Issue
Block a user