Commit 88b7be9c authored by gauthier's avatar gauthier

Ok for MNC 2 and 3 digits, tested wit 208.10 and 310.028

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5846 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent a4e71114
......@@ -64,7 +64,10 @@ int mme_app_request_authentication_info(const mme_app_imsi_t imsi,
message_p = itti_alloc_new_message(TASK_MME_APP, S6A_AUTH_INFO_REQ);
auth_info_req = &message_p->ittiMsg.s6a_auth_info_req;
MME_APP_IMSI_TO_STRING(imsi, auth_info_req->imsi);
memset(auth_info_req, 0, sizeof(*auth_info_req));
auth_info_req->imsi_length = MME_APP_IMSI_TO_STRING(imsi, auth_info_req->imsi);
memcpy(&auth_info_req->visited_plmn, plmn, sizeof(plmn_t));
MME_APP_DEBUG("%s visited_plmn MCC %X%X%X MNC %X%X%X\n",
__FUNCTION__,
......@@ -75,11 +78,11 @@ int mme_app_request_authentication_info(const mme_app_imsi_t imsi,
auth_info_req->visited_plmn.MNCdigit2,
auth_info_req->visited_plmn.MNCdigit3);
uint8_t *ptr = (uint8_t *)&auth_info_req->visited_plmn;
MME_APP_DEBUG("%s visited_plmn %X%X%X%X%X%X\n",
__FUNCTION__,
ptr[0],
ptr[1],
ptr[2]);
MME_APP_DEBUG("%s visited_plmn %02X%02X%02X\n",
__FUNCTION__,
ptr[0],
ptr[1],
ptr[2]);
auth_info_req->nb_of_vectors = nb_of_vectors;
if (auts != NULL) {
......@@ -273,6 +276,7 @@ request_auth: {
/* We have no vector for this UE, send an authentication request
* to the HSS.
*/
AssertFatal(0, "Hardcoded MCC/MNC");
plmn_t plmn = {
.MCCdigit2 = 0,
.MCCdigit1 = 8,
......@@ -357,9 +361,9 @@ mme_app_handle_nas_auth_param_req(
//visited_plmn = &visited_plmn_dongle;
visited_plmn = &visited_plmn_from_req;
visited_plmn_from_req.MCCdigit3 = nas_auth_param_req_pP->imsi[0];
visited_plmn_from_req.MCCdigit1 = nas_auth_param_req_pP->imsi[0];
visited_plmn_from_req.MCCdigit2 = nas_auth_param_req_pP->imsi[1];
visited_plmn_from_req.MCCdigit1 = nas_auth_param_req_pP->imsi[2];
visited_plmn_from_req.MCCdigit3 = nas_auth_param_req_pP->imsi[2];
mnc_length = find_mnc_length(nas_auth_param_req_pP->imsi[0],
nas_auth_param_req_pP->imsi[1],
......@@ -369,9 +373,9 @@ mme_app_handle_nas_auth_param_req(
nas_auth_param_req_pP->imsi[5]
);
if (mnc_length == 2) {
visited_plmn_from_req.MNCdigit1 = 0;
visited_plmn_from_req.MNCdigit2 = nas_auth_param_req_pP->imsi[3];
visited_plmn_from_req.MNCdigit3 = nas_auth_param_req_pP->imsi[4];
visited_plmn_from_req.MNCdigit1 = nas_auth_param_req_pP->imsi[3];
visited_plmn_from_req.MNCdigit2 = nas_auth_param_req_pP->imsi[4];
visited_plmn_from_req.MNCdigit3 = "F";
} else if (mnc_length == 3) {
visited_plmn_from_req.MNCdigit1 = nas_auth_param_req_pP->imsi[3];
visited_plmn_from_req.MNCdigit2 = nas_auth_param_req_pP->imsi[4];
......@@ -383,7 +387,10 @@ mme_app_handle_nas_auth_param_req(
MME_APP_STRING_TO_IMSI(nas_auth_param_req_pP->imsi, &imsi);
MME_APP_DEBUG("%s Handling imsi %"IMSI_FORMAT"\n", __FUNCTION__, imsi);
MME_APP_DEBUG("%s Handling imsi from req %s\n", __FUNCTION__, nas_auth_param_req_pP->imsi);
MME_APP_DEBUG("%s Handling imsi from req %s (mnc length %d)\n",
__FUNCTION__,
nas_auth_param_req_pP->imsi,
mnc_length);
/* Fetch the context associated with this IMSI */
ue_context = mme_ue_context_exists_imsi(&mme_app_desc.mme_ue_contexts, imsi);
......
......@@ -48,6 +48,7 @@ Description Implements the API used by the NAS layer running in the MME
#include "mme_api.h"
#include "nas_log.h"
#include "assertions.h"
#include <string.h> // memcpy
......@@ -261,15 +262,27 @@ int mme_api_get_emm_config(mme_api_emm_config_t *config)
int i;
#endif
LOG_FUNC_IN;
config->gummei.plmn.MCCdigit1 = 2;
config->gummei.plmn.MCCdigit2 = 0;
config->gummei.plmn.MCCdigit3 = 8;
config->gummei.plmn.MNCdigit1 = 1;
config->gummei.plmn.MNCdigit2 = 0;
config->gummei.plmn.MNCdigit3 = 0xf;
config->gummei.MMEgid = MME_API_MME_GID;
config->gummei.MMEcode = MME_API_MME_CODE;
AssertFatal(mme_config_p->gummei.nb_plmns >= 1, "No PLMN configured");
AssertFatal(mme_config_p->gummei.nb_mmec >= 1, "No MME Code configured");
AssertFatal(mme_config_p->gummei.nb_mme_gid >= 1, "No MME Group ID configured");
config->gummei.plmn.MCCdigit1 = (mme_config_p->gummei.plmn_mcc[0]/100)%10;
config->gummei.plmn.MCCdigit2 = (mme_config_p->gummei.plmn_mcc[0]/10)%10;
config->gummei.plmn.MCCdigit3 = mme_config_p->gummei.plmn_mcc[0]%10;
if (mme_config_p->gummei.plmn_mnc_len[0] == 2) {
config->gummei.plmn.MNCdigit1 = (mme_config_p->gummei.plmn_mnc[0]/10)%10;
config->gummei.plmn.MNCdigit2 = mme_config_p->gummei.plmn_mnc[0]%10;
config->gummei.plmn.MNCdigit3 = 0xf;
} else if (mme_config_p->gummei.plmn_mnc_len[0] == 3) {
config->gummei.plmn.MNCdigit1 = (mme_config_p->gummei.plmn_mnc[0]/100)%10;
config->gummei.plmn.MNCdigit2 = (mme_config_p->gummei.plmn_mnc[0]/10)%10;
config->gummei.plmn.MNCdigit3 = mme_config_p->gummei.plmn_mnc[0]%10;
} else {
AssertFatal((mme_config_p->gummei.plmn_mnc_len[0] >= 2) &&
(mme_config_p->gummei.plmn_mnc_len[0] <= 3), "BAD MNC length for GUMMEI");
}
config->gummei.MMEgid = mme_config_p->gummei.mme_gid[0];
config->gummei.MMEcode = mme_config_p->gummei.mmec[0];
#if defined(EPC_BUILD)
/* SR: this config param comes from MME global config */
if (mme_config_p->emergency_attach_supported != 0) {
......@@ -371,6 +384,7 @@ int mme_api_identify_imsi(const imsi_t *imsi, auth_vector_t *vector)
int rc = RETURNok;
LOG_FUNC_IN;
AssertFatal(0, "Hardcoded values");
memcpy(vector->rand, _mme_api_rand, AUTH_RAND_SIZE);
memcpy(vector->autn, _mme_api_autn, AUTH_AUTN_SIZE);
......@@ -435,6 +449,7 @@ int mme_api_new_guti(const imsi_t *imsi, GUTI_t *guti, tac_t *tac, int *n_tacs)
static unsigned int tmsi = 1;
LOG_FUNC_IN;
AssertFatal(0, "Hardcoded values");
guti->gummei.plmn = mme_api_plmn;
guti->gummei.MMEgid = MME_API_MME_GID;
......
......@@ -75,6 +75,7 @@ Description Defines the attach related EMM procedure executed by the
#ifdef NAS_MME
#include "mme_api.h"
#include "mme_config.h"
# if defined(EPC_BUILD)
# include "nas_itti_messaging.h"
# endif
......@@ -2507,6 +2508,7 @@ static int _emm_attach_update(emm_data_context_t *ctx, unsigned int ueid,
int umts_present, int gprs_present,
const OctetString *esm_msg)
{
int mnc_length;
LOG_FUNC_IN;
/* UE identifier */
ctx->ueid = ueid;
......@@ -2538,24 +2540,62 @@ static int _emm_attach_update(emm_data_context_t *ctx, unsigned int ueid,
}
} else {
if (ctx->guti == NULL) {
ctx->guti = (GUTI_t *)malloc(sizeof(GUTI_t));
ctx->guti = (GUTI_t *)calloc(1, sizeof(GUTI_t));
}
if (ctx->guti != NULL) {
/* TODO: FIXME */
LOG_TRACE(WARNING, "EMM-PROC - Assign GUTI hardcoded PLMN 208.92 and tac 15 to emm_data_context");
ctx->guti->gummei.plmn.MCCdigit1 = 2;
ctx->guti->gummei.plmn.MCCdigit2 = 0;
ctx->guti->gummei.plmn.MCCdigit3 = 8;
ctx->guti->gummei.plmn.MNCdigit1 = 9;
ctx->guti->gummei.plmn.MNCdigit2 = 2;
ctx->guti->gummei.plmn.MNCdigit3 = 15;
ctx->tac = 15;
ctx->guti->gummei.MMEcode = 29;
ctx->guti->gummei.MMEgid = 30;
#warning "LG: We should assign the GUTI accordingly to the visited plmn id"
if ((ctx->guti != NULL) && (imsi)) {
ctx->tac = mme_config.gummei.plmn_tac[0];
ctx->guti->gummei.MMEcode = mme_config.gummei.mmec[0];
ctx->guti->gummei.MMEgid = mme_config.gummei.mme_gid[0];
ctx->guti->m_tmsi = (uint32_t) ctx;
LOG_TRACE(WARNING, "EMM-PROC - Set ctx->guti_is_new to emm_data_context");
ctx->guti_is_new = TRUE;
mnc_length = mme_config_find_mnc_length(
imsi->u.num.digit1,
imsi->u.num.digit2,
imsi->u.num.digit3,
imsi->u.num.digit4,
imsi->u.num.digit5,
imsi->u.num.digit6);
if ((mnc_length == 2) || (mnc_length == 3)) {
ctx->guti->gummei.plmn.MCCdigit1 = imsi->u.num.digit1;
ctx->guti->gummei.plmn.MCCdigit2 = imsi->u.num.digit2;
ctx->guti->gummei.plmn.MCCdigit3 = imsi->u.num.digit3;
if (mnc_length == 2) {
ctx->guti->gummei.plmn.MNCdigit1 = imsi->u.num.digit5;
ctx->guti->gummei.plmn.MNCdigit2 = imsi->u.num.digit6;
ctx->guti->gummei.plmn.MNCdigit3 = 15;
LOG_TRACE(WARNING, "EMM-PROC - Assign GUTI from IMSI %01X%01X%01X.%01X%01X.%04X.%02X.%08X to emm_data_context",
ctx->guti->gummei.plmn.MCCdigit1,
ctx->guti->gummei.plmn.MCCdigit2,
ctx->guti->gummei.plmn.MCCdigit3,
ctx->guti->gummei.plmn.MNCdigit1,
ctx->guti->gummei.plmn.MNCdigit2,
ctx->guti->gummei.MMEgid,
ctx->guti->gummei.MMEcode,
ctx->guti->m_tmsi
);
} else {
ctx->guti->gummei.plmn.MNCdigit1 = imsi->u.num.digit5;
ctx->guti->gummei.plmn.MNCdigit2 = imsi->u.num.digit6;
ctx->guti->gummei.plmn.MNCdigit3 = imsi->u.num.digit4;
LOG_TRACE(WARNING, "EMM-PROC - Assign GUTI from IMSI %01X%01X%01X.%01X%01X%01X.%04X.%02X.%08X to emm_data_context",
ctx->guti->gummei.plmn.MCCdigit1,
ctx->guti->gummei.plmn.MCCdigit2,
ctx->guti->gummei.plmn.MCCdigit3,
ctx->guti->gummei.plmn.MNCdigit1,
ctx->guti->gummei.plmn.MNCdigit2,
ctx->guti->gummei.plmn.MNCdigit3,
ctx->guti->gummei.MMEgid,
ctx->guti->gummei.MMEcode,
ctx->guti->m_tmsi
);
}
LOG_TRACE(WARNING, "EMM-PROC - Set ctx->guti_is_new to emm_data_context");
ctx->guti_is_new = TRUE;
} else {
LOG_FUNC_RETURN (RETURNerror);
}
} else {
LOG_FUNC_RETURN (RETURNerror);
}
......
......@@ -52,6 +52,7 @@ int decode_voice_domain_preference_and_ue_usage_setting(VoiceDomainPreferenceAnd
voicedomainpreferenceandueusagesetting->ue_usage_setting = (*(buffer + decoded) >> 2) & 0x1;
voicedomainpreferenceandueusagesetting->voice_domain_for_eutran = *(buffer + decoded) & 0x3;
decoded++;
#if defined (NAS_DEBUG)
dump_voice_domain_preference_and_ue_usage_setting_xml(voicedomainpreferenceandueusagesetting, iei);
......
......@@ -52,8 +52,9 @@ TARGETS = $(USIM_TARGET) $(UE_TARGET)
all: $(TARGETS)
#-DIMSI_USA_MNC_3DIGITS
%.o: %.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(CC) $(CFLAGS) -c $< -o $@
$(USIM_TARGET): $(USIM_OBJ) $(LIBSUTIL)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SECUDIR)/*.o -lnettle -lcrypto -lm
......
......@@ -55,11 +55,13 @@ Description Defines a list of PLMN network operators
#define SFR_PLMN_1 {0,2,0x0f,8,0,1} // 20810
#define SFR_PLMN_2 {0,2,0x0f,8,1,1} // 20811
#define SFR_PLMN_3 {0,2,0x0f,8,3,1} // 20813
#define TM_PLMN_1 {1,3,0,0,8,2} // 310280
#define FCT_PLMN_1 {1,3,8,0,2,0} // 310028
#define VDF_PLMN_1 {2,2,0x0f,2,0,1} // 22210
#define VDF_PLMN_2 {1,2,0x0f,4,0x0f,1} // 2141
#define VDF_PLMN_3 {1,2,0x0f,4,0x0f,6} // 2146
#define VDF_PLMN_4 {6,2,0x0f,2,0x0f,2} // 2622
#define VDF_PLMN_5 {6,2,0x0f,2,0x0f,4} // 2624
#define VDF_PLMN_5 {6,2,0x0f,2,0x0f,4} // 2624
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
......@@ -72,11 +74,13 @@ enum {
SFR1=0,
SFR2,
SFR3,
TM1,
FCT1,
VDF1,
VDF2,
VDF3,
VDF4,
VDF5
VDF5,
};
/*
......@@ -100,14 +104,16 @@ typedef struct {
* The list of PLMN network operator records
*/
network_record_t network_records[] = {
{20810, SFR_PLMN_1, "SFR France", "SFR", 0x0000, 0xfffe},
{20811, SFR_PLMN_2, "SFR France", "SFR", 0x0000, 0xfffe},
{20813, SFR_PLMN_3, "SFR France", "SFR", 0x0000, 0xfffe},
{22210, VDF_PLMN_1, "Vodafone Italia", "VODAFONE", 0x0000, 0xfffe},
{2141, VDF_PLMN_2, "Vodafone Spain", "VODAFONE", 0x0000, 0xfffe},
{2146, VDF_PLMN_3, "Vodafone Spain", "VODAFONE", 0x0000, 0xfffe},
{2622, VDF_PLMN_4, "Vodafone Germ", "VODAFONE", 0x0000, 0xfffe},
{2624, VDF_PLMN_5, "Vodafone Germ", "VODAFONE", 0x0000, 0xfffe},
{20810, SFR_PLMN_1, "SFR France", "SFR", 0x0001, 0xfffd},
{20811, SFR_PLMN_2, "SFR France", "SFR", 0x0001, 0xfffd},
{20813, SFR_PLMN_3, "SFR France", "SFR", 0x0001, 0xfffd},
{310280,TM_PLMN_1, "T-Mobile USA", "T-Mobile", 0x0001, 0xfffd},
{310028,FCT_PLMN_1, "FICTITIOUS USA", "FICTITIO", 0x0001, 0xfffd},
{22210, VDF_PLMN_1, "Vodafone Italia", "VODAFONE", 0x0001, 0xfffd},
{2141, VDF_PLMN_2, "Vodafone Spain", "VODAFONE", 0x0001, 0xfffd},
{2146, VDF_PLMN_3, "Vodafone Spain", "VODAFONE", 0x0001, 0xfffd},
{2622, VDF_PLMN_4, "Vodafone Germ", "VODAFONE", 0x0001, 0xfffd},
{2624, VDF_PLMN_5, "Vodafone Germ", "VODAFONE", 0x0001, 0xfffd},
};
/****************************************************************************/
......
......@@ -53,6 +53,9 @@ Description Implements the utility used to generate data stored in the
#include <stdlib.h> // exit, free
#include <string.h> // memset, strncpy
//#define SELECTED_PLMN SFR1
#define SELECTED_PLMN FCT1
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
/****************************************************************************/
......@@ -286,19 +289,70 @@ static void _gen_user_data(user_nvdata_t* data)
*/
static void _gen_emm_data(emm_nvdata_t* data)
{
//#if (SELECTED_PLMN == FCT1)
#if 1
/*
* International Mobile Subscriber Identity
* IMSI = MCC + MNC + MSIN = 208 (France) + 10 (SFR) + 00001234
* IMSI = MCC + MNC + MSIN = 310 (USA) + 028 (UNKNOWN) + 90832150
*/
#warning "IMSI 310.028.90832150"
data->imsi.length = 8;
data->imsi.u.num.parity = 0x0; // Type of identity = IMSI, even
data->imsi.u.num.digit1 = 3; // MCC digit 1
data->imsi.u.num.digit2 = 1; // MCC digit 2
data->imsi.u.num.digit3 = 0; // MCC digit 3
data->imsi.u.num.digit4 = 0; // MNC digit 1
data->imsi.u.num.digit5 = 2; // MNC digit 2
data->imsi.u.num.digit6 = 8; // MNC digit 3
data->imsi.u.num.digit7 = 9;
data->imsi.u.num.digit8 = 0;
data->imsi.u.num.digit9 = 8;
data->imsi.u.num.digit10 = 3;
data->imsi.u.num.digit11 = 2;
data->imsi.u.num.digit12 = 1;
data->imsi.u.num.digit13 = 5;
data->imsi.u.num.digit14 = 0;
data->imsi.u.num.digit15 = 0xF;
/*
* Last registered home PLMN
*/
data->rplmn.MCCdigit1 = 3;
data->rplmn.MCCdigit2 = 1;
data->rplmn.MCCdigit3 = 0;
data->rplmn.MNCdigit1 = 0;
data->rplmn.MNCdigit2 = 2;
data->rplmn.MNCdigit3 = 8;
#else
/*
* International Mobile Subscriber Identity
* IMSI = MCC + MNC + MSIN = 208 (France) + 10 (SFR) + 00001234
*/
#warning "IMSI 208.10.000001234"
/* data->imsi.length = 8;
data->imsi.u.num.parity = 0x0; // Type of identity = IMSI, even
data->imsi.u.num.digit1 = 2; // MCC digit 1
data->imsi.u.num.digit2 = 0; // MCC digit 2
data->imsi.u.num.digit3 = 8; // MCC digit 3
data->imsi.u.num.digit4 = 1; // MNC digit 1
data->imsi.u.num.digit5 = 0; // MNC digit 2
data->imsi.u.num.digit6 = 0; // MNC digit 3
//LG data->imsi.u.num.digit6 = 0xF; // MNC digit 3
data->imsi.u.num.digit6 = 0xF; // MNC digit 3
data->imsi.u.num.digit7 = 0;
data->imsi.u.num.digit8 = 0;
data->imsi.u.num.digit9 = 0;
data->imsi.u.num.digit10 = 0;
data->imsi.u.num.digit11 = 1;
data->imsi.u.num.digit12 = 2;
data->imsi.u.num.digit13 = 3;
data->imsi.u.num.digit14 = 4;
data->imsi.u.num.digit15 = 0xF;*/
data->imsi.length = 8;
data->imsi.u.num.parity = 0x0; // Type of identity = IMSI, even
data->imsi.u.num.digit1 = 2; // MCC digit 1
data->imsi.u.num.digit2 = 0; // MCC digit 2
data->imsi.u.num.digit3 = 8; // MCC digit 3
data->imsi.u.num.digit4 = 1; // MNC digit 1
data->imsi.u.num.digit5 = 0; // MNC digit 2
data->imsi.u.num.digit6 = 0;
data->imsi.u.num.digit7 = 0;
data->imsi.u.num.digit8 = 0;
data->imsi.u.num.digit9 = 0;
......@@ -308,6 +362,7 @@ static void _gen_emm_data(emm_nvdata_t* data)
data->imsi.u.num.digit13 = 3;
data->imsi.u.num.digit14 = 4;
data->imsi.u.num.digit15 = 0xF;
/*
* Last registered home PLMN
*/
......@@ -317,6 +372,7 @@ static void _gen_emm_data(emm_nvdata_t* data)
data->rplmn.MNCdigit1 = 1;
data->rplmn.MNCdigit2 = 0;
data->rplmn.MNCdigit3 = 0xf;
#endif
/*
* List of Equivalent PLMNs
*/
......@@ -356,20 +412,79 @@ static void _display_ue_data(const user_nvdata_t* data)
static void _display_emm_data(const emm_nvdata_t* data)
{
printf("IMSI\t\t= ");
printf("%u%u%u%u%u%u%u%u%u%u%u%u%u\n",
data->imsi.u.num.digit1,
data->imsi.u.num.digit2,
data->imsi.u.num.digit3,
data->imsi.u.num.digit4,
data->imsi.u.num.digit5,
data->imsi.u.num.digit7,
data->imsi.u.num.digit8,
data->imsi.u.num.digit9,
data->imsi.u.num.digit10,
data->imsi.u.num.digit11,
data->imsi.u.num.digit12,
data->imsi.u.num.digit13,
data->imsi.u.num.digit14);
if (data->imsi.u.num.digit6 == 0b1111) {
if (data->imsi.u.num.digit15 == 0b1111) {
printf("%u%u%u.%u%u.%u%u%u%u%u%u%u%u\n",
data->imsi.u.num.digit1,
data->imsi.u.num.digit2,
data->imsi.u.num.digit3,
data->imsi.u.num.digit4,
data->imsi.u.num.digit5,
data->imsi.u.num.digit7,
data->imsi.u.num.digit8,
data->imsi.u.num.digit9,
data->imsi.u.num.digit10,
data->imsi.u.num.digit11,
data->imsi.u.num.digit12,
data->imsi.u.num.digit13,
data->imsi.u.num.digit14);
} else {
printf("%u%u%u.%u%u.%u%u%u%u%u%u%u%u%u\n",
data->imsi.u.num.digit1,
data->imsi.u.num.digit2,
data->imsi.u.num.digit3,
data->imsi.u.num.digit4,
data->imsi.u.num.digit5,
data->imsi.u.num.digit7,
data->imsi.u.num.digit8,
data->imsi.u.num.digit9,
data->imsi.u.num.digit10,
data->imsi.u.num.digit11,
data->imsi.u.num.digit12,
data->imsi.u.num.digit13,
data->imsi.u.num.digit14,
data->imsi.u.num.digit15);
}
} else {
if (data->imsi.u.num.digit15 == 0b1111) {
printf("%u%u%u.%u%u%u.%u%u%u%u%u%u%u%u\n",
data->imsi.u.num.digit1,
data->imsi.u.num.digit2,
data->imsi.u.num.digit3,
data->imsi.u.num.digit4,
data->imsi.u.num.digit5,
data->imsi.u.num.digit6,
data->imsi.u.num.digit7,
data->imsi.u.num.digit8,
data->imsi.u.num.digit9,
data->imsi.u.num.digit10,
data->imsi.u.num.digit11,
data->imsi.u.num.digit12,
data->imsi.u.num.digit13,
data->imsi.u.num.digit14);
} else {
printf("%u%u%u.%u%u%u.%u%u%u%u%u%u%u%u\n",
data->imsi.u.num.digit1,
data->imsi.u.num.digit2,
data->imsi.u.num.digit3,
data->imsi.u.num.digit4,
data->imsi.u.num.digit5,
data->imsi.u.num.digit6,
data->imsi.u.num.digit7,
data->imsi.u.num.digit8,
data->imsi.u.num.digit9,
data->imsi.u.num.digit10,
data->imsi.u.num.digit11,
data->imsi.u.num.digit12,
data->imsi.u.num.digit13,
data->imsi.u.num.digit14,
data->imsi.u.num.digit15);
}
}
printf("RPLMN\t\t= "); PRINT_PLMN(data->rplmn);
printf("\n");
......
......@@ -53,6 +53,9 @@ Description Implements the utility used to generate data stored in the
#include <stdlib.h> // exit
#include <string.h> // memset, memcpy, strncpy
//#define SELECTED_PLMN SFR1
#define SELECTED_PLMN FCT1
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
/****************************************************************************/
......@@ -60,7 +63,7 @@ Description Implements the utility used to generate data stored in the
#define KSI USIM_KSI_NOT_AVAILABLE
#define KSI_ASME USIM_KSI_NOT_AVAILABLE
#define INT_ALGO USIM_INT_EIA1
#define ENC_ALGO USIM_ENC_EEA1
#define ENC_ALGO USIM_ENC_EEA0
#define SECURITY_ALGORITHMS (ENC_ALGO | INT_ALGO)
#define MIN_TAC 0x0000
......@@ -135,19 +138,45 @@ int main (int argc, const char* argv[])
* Initialize USIM data
*/
memset(&usim_data, 0, sizeof(usim_data_t));
//#if (SELECTED_PLMN == FCT1)
#if 1
/*
* International Mobile Subscriber Identity
* IMSI = MCC + MNC + MSIN = 310 (USA) + 028 (UNKNOWN) + 90832150
*/
#warning "IMSI 310.028.90832150"
usim_data.imsi.length = 8;
usim_data.imsi.u.num.parity = EVEN_PARITY; // Parity: even
usim_data.imsi.u.num.digit1 = 3; // MCC digit 1
usim_data.imsi.u.num.digit2 = 1; // MCC digit 2
usim_data.imsi.u.num.digit3 = 0; // MCC digit 3
usim_data.imsi.u.num.digit4 = 0; // MNC digit 1
usim_data.imsi.u.num.digit5 = 2; // MNC digit 2
usim_data.imsi.u.num.digit6 = 8; // MNC digit 3
usim_data.imsi.u.num.digit7 = 9;
usim_data.imsi.u.num.digit8 = 0;
usim_data.imsi.u.num.digit9 = 8;
usim_data.imsi.u.num.digit10 = 3;
usim_data.imsi.u.num.digit11 = 2;
usim_data.imsi.u.num.digit12 = 1;
usim_data.imsi.u.num.digit13 = 5;
usim_data.imsi.u.num.digit14 = 0;
usim_data.imsi.u.num.digit15 = 0b1111;
#else
/*
* International Mobile Subscriber Identity
* IMSI = MCC + MNC + MSIN = 208 (France) + 10 (SFR) + 00001234
*/
usim_data.imsi.length = 8;
usim_data.imsi.u.num.parity = EVEN_PARITY; // Parity: even
#warning "IMSI 208.10.00001234"
/* usim_data.imsi.length = 8;
usim_data.imsi.u.num.parity = EVEN_PARITY; // Parity: even
usim_data.imsi.u.num.digit1 = 2; // MCC digit 1
usim_data.imsi.u.num.digit2 = 0; // MCC digit 2
usim_data.imsi.u.num.digit3 = 8; // MCC digit 3
usim_data.imsi.u.num.digit4 = 1; // MNC digit 1
usim_data.imsi.u.num.digit5 = 0; // MNC digit 2
// LG usim_data.imsi.u.num.digit6 = 0b1111; // MNC digit 3
usim_data.imsi.u.num.digit6 = 0; // MNC digit 3
usim_data.imsi.u.num.digit6 = 0b1111; // MNC digit 3
usim_data.imsi.u.num.digit7 = 0;
usim_data.imsi.u.num.digit8 = 0;
usim_data.imsi.u.num.digit9 = 0;
......@@ -156,7 +185,25 @@ int main (int argc, const char* argv[])
usim_data.imsi.u.num.digit12 = 2;
usim_data.imsi.u.num.digit13 = 3;
usim_data.imsi.u.num.digit14 = 4;
usim_data.imsi.u.num.digit15 = 0b1111;
usim_data.imsi.u.num.digit15 = 0b1111;*/
usim_data.imsi.length = 8;
usim_data.imsi.u.num.parity = 0x0; // Type of identity = IMSI, even
usim_data.imsi.u.num.digit1 = 2; // MCC digit 1
usim_data.imsi.u.num.digit2 = 0; // MCC digit 2
usim_data.imsi.u.num.digit3 = 8; // MCC digit 3
usim_data.imsi.u.num.digit4 = 1; // MNC digit 1
usim_data.imsi.u.num.digit5 = 0; // MNC digit 2
usim_data.imsi.u.num.digit6 = 0;
usim_data.imsi.u.num.digit7 = 0;
usim_data.imsi.u.num.digit8 = 0;
usim_data.imsi.u.num.digit9 = 0;
usim_data.imsi.u.num.digit10 = 0;
usim_data.imsi.u.num.digit11 = 1;
usim_data.imsi.u.num.digit12 = 2;
usim_data.imsi.u.num.digit13 = 3;
usim_data.imsi.u.num.digit14 = 4;
usim_data.imsi.u.num.digit15 = 0xF;
#endif
/*
* Ciphering and Integrity Keys
*/
......@@ -178,7 +225,7 @@ int main (int argc, const char* argv[])
* Location Information
*/
usim_data.loci.tmsi = DEFAULT_TMSI;
usim_data.loci.lai.plmn = network_records[SFR1].plmn;
usim_data.loci.lai.plmn = network_records[SELECTED_PLMN].plmn;
usim_data.loci.lai.lac = DEFAULT_LAC;
usim_data.loci.status = USIM_LOCI_NOT_UPDATED;
/*
......@@ -188,7 +235,7 @@ int main (int argc, const char* argv[])
usim_data.psloci.signature[0] = 0x01;
usim_data.psloci.signature[1] = 0x02;
usim_data.psloci.signature[2] = 0x03;
usim_data.psloci.rai.plmn = network_records[SFR1].plmn;
usim_data.psloci.rai.plmn = network_records[SELECTED_PLMN].plmn;
usim_data.psloci.rai.lac = DEFAULT_LAC;
usim_data.psloci.rai.rac = DEFAULT_RAC;
usim_data.psloci.status = USIM_PSLOCI_NOT_UPDATED;
......@@ -279,7 +326,7 @@ int main (int argc, const char* argv[])
/*
* Home PLMN Selector with Access Technology