| /***************************************************************************** |
| * Copyright Statement: |
| * -------------------- |
| * This software is protected by Copyright and the information contained |
| * herein is confidential. The software may not be copied and the information |
| * contained herein may not be used or disclosed except with the written |
| * permission of MediaTek Inc. (C) 2005 |
| * |
| * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| * |
| * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| * |
| * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| * |
| *****************************************************************************/ |
| /******************************************************************************* |
| * Copyright Statement: |
| * -------------------- |
| * This software is protected by Copyright and the information contained |
| * herein is confidential. The software may not be copied and the information |
| * contained herein may not be used or disclosed except with the written |
| * permission of MediaTek Inc. (C) 2001 |
| * |
| *******************************************************************************/ |
| |
| /******************************************************************************* |
| * Filename: |
| * --------- |
| * sml_public_def.h |
| * |
| * Project: |
| * -------- |
| * MAUI |
| * |
| * Description: |
| * ------------ |
| * Enum and Constant provided by SIM-ME Lock |
| * |
| * Author: |
| * ------- |
| * ------- |
| * |
| *============================================================================== |
| *******************************************************************************/ |
| #ifndef SML_PUBLIC_DEF_H |
| #define SML_PUBLIC_DEF_H |
| |
| #include "kal_public_defs.h" |
| #include "sml_nvram_ver.h" |
| |
| /*--- SML related Macro Defined ---*/ |
| |
| /* for MS_SECURITY */ |
| #define NVRAM_EDITOR_NUM_OF_BYTE_KEY 8 |
| #define NVRAM_EDITOR_NUM_OF_BYTE_NP 3 |
| #define NVRAM_EDITOR_NUM_OF_BYTE_NSP 5 |
| #define NVRAM_EDITOR_NUM_NSP 3 |
| #define NVRAM_EDITOR_NUM_GID 20 |
| #define NVRAM_EDITOR_NUM_OF_BYTE_IMSI 9 |
| #define NVRAM_EDITOR_NUM_PIN1 8 |
| #define NVRAM_EDITOR_NUM_OF_BYTE_ICCID 10 |
| #define NVRAM_SECRET_KEY_SIZE 8 |
| #define NVRAM_CUSTOM_KEY_SEED_SIZE 32 |
| |
| /* |
| * the basic unit of categories |
| */ |
| #define SML_SIZE_OF_CAT_N 3 /* MCC/MNC */ |
| #define SML_SIZE_OF_CAT_NS 4 /* MCC/MNC + HLR */ |
| #define SML_SIZE_OF_CAT_SP 4 /* MCC/MNC + GID1 */ |
| #define SML_SIZE_OF_CAT_C 5 /* MCC/MNC + GID1 + GID2 */ |
| #define SML_SIZE_OF_CAT_SIM 8 /* IMSI */ |
| /* Define the maximum suppot categories */ |
| #define SML_MAX_SUPPORT_CAT_N 10 |
| #define SML_MAX_SUPPORT_CAT_NS 2 |
| #define SML_MAX_SUPPORT_CAT_SP 2 |
| #define SML_MAX_SUPPORT_CAT_C 2 |
| #define SML_MAX_SUPPORT_CAT_SIM 2 |
| /* Define the total size of each category */ |
| #define SML_CFG_CAT_N_SIZE (SML_MAX_SUPPORT_CAT_N * SML_SIZE_OF_CAT_N) |
| #define SML_CFG_CAT_NS_SIZE (SML_MAX_SUPPORT_CAT_NS * SML_SIZE_OF_CAT_NS) |
| #define SML_CFG_CAT_SP_SIZE (SML_MAX_SUPPORT_CAT_SP * SML_SIZE_OF_CAT_SP) |
| #define SML_CFG_CAT_C_SIZE (SML_MAX_SUPPORT_CAT_C * SML_SIZE_OF_CAT_C) |
| #define SML_CFG_CAT_SIM_SIZE (SML_MAX_SUPPORT_CAT_SIM * SML_SIZE_OF_CAT_SIM) |
| /* Define the support category size */ |
| #define SML_SUPPORT_CAT_SIZE 7 /* SML_CAT_SIZE in sml_cat_enum */ |
| |
| #define NVRAM_SML_S_MAX_SUPPORT_SALT_LEN 32 |
| #define NVRAM_SML_S_MAX_SUPPORT_INTER_CNT_LEN 4 |
| #define NVRAM_SML_S_MAX_SUPPORT_HCK_LEN 64 |
| |
| #define SML_GBLOB_IMEI_SIZE 15 |
| #define SML_GBLOB_TOTAL_IMEI_SIZE SML_GBLOB_IMEI_SIZE * 4 //Support Max 4 SIM |
| #define SML_GBLOB_SUB_RULE_SIZE 2 |
| #define SML_GBLOB_TLV_DATA_SIZE 256 |
| #define SML_GBLOB_SIZE_OF_MRC 4 |
| #define SML_GBLOB_SIZE_OF_DEV_INTCNT 4 |
| #define SML_GBLOB_SIZE_OF_DEV_SALT 32 |
| #define SML_GBLOB_SIZE_OF_DEV_HCK 64 |
| #define SML_GBLOB_SIZE_OF_SIGNATURE 256 |
| #define SML_GBLOB_SIZE_OF_PACKAGE_KEY 1024 |
| |
| /* RJIL Subsidy Lock BLOB */ |
| #define SML_SL_BLOB_IMEI_SIZE 15 |
| #define SML_SL_BLOB_TIME_STAMP_SIZE 8 |
| #define SML_SL_BLOB_LENGTH_SIZE 2 |
| #define SML_SL_BLOB_CONFIG_SUPPORT_CAT_SIZE 3 |
| #define SML_SL_BLOB_ITERATION_COUNT_SIZE 4 |
| #define SML_SL_BLOB_SALT_SIZE 16 |
| #define SML_SL_BLOB_HCK_SIZE 32 |
| #define SML_SL_BLOB_SIZE_OF_SIGNATURE 256 |
| #define SML_SL_PUBLIC_KEY_MOD_SIZE 256 |
| #define SML_SL_PUBLIC_KEY_EXP_SIZE 3 |
| |
| /* Invalid SML context obj length */ |
| #define SML_SL_INVALID_CONTEXT_OBJ_LENGTH 0xFFFF |
| #define SML_SL_NVRAM_ACCESS_ID_NONE 0 |
| #define SML_SL_NVRAM_ACCESS_ID_UPDATE_SLB 0xFA |
| #define SML_SL_NVRAM_ACCESS_ID_UPDATE_LOCK_OP 0xFB |
| #define SML_SL_MAX_SUPPORT_KEY_LEN 16 |
| |
| /* |
| * the basic unit of categories |
| */ |
| #define SML_SL_BLOB_SIZE_OF_CAT_N 6 /* MCC/MNC */ |
| #define SML_SL_BLOB_SIZE_OF_CAT_NS 8 /* MCC/MNC + HLR */ |
| #define SML_SL_BLOB_SIZE_OF_CAT_SP 7 /* MCC/MNC + GID1 */ |
| |
| /* Define the maximum suppot categories */ |
| #define SML_SL_BLOB_MAX_SUPPORT_CAT_N 30 |
| #define SML_SL_BLOB_MAX_SUPPORT_CAT_NS 10 |
| #define SML_SL_BLOB_MAX_SUPPORT_CAT_SP 10 |
| |
| /* Define the total size of each category */ |
| #define SML_SL_BLOB_CAT_N_SIZE (SML_SL_BLOB_MAX_SUPPORT_CAT_N * SML_SL_BLOB_SIZE_OF_CAT_N) |
| #define SML_SL_BLOB_CAT_NS_SIZE (SML_SL_BLOB_MAX_SUPPORT_CAT_NS * SML_SL_BLOB_SIZE_OF_CAT_NS) |
| #define SML_SL_BLOB_CAT_SP_SIZE (SML_SL_BLOB_MAX_SUPPORT_CAT_SP * SML_SL_BLOB_SIZE_OF_CAT_SP) |
| |
| #define SML_SL_MAX_BLOB_SIZE NVRAM_EF_SUBSIDY_LOCK_SIZE |
| |
| #define DSML_MAX_BL_LEN 128 /* should larger then max category data */ |
| |
| /* |
| * Key management behavior |
| * |
| * the maximum control key length in bcd, i.e., double in digits |
| * this value shall not be smaller than MAX_SIM_PASSWD_LEN-1, which is the maximum length of PIN |
| */ |
| #ifdef __EXTEND_SML_KEY_LEN__ |
| #define SML_MAX_SUPPORT_KEY_LEN 16 |
| #else |
| #define SML_MAX_SUPPORT_KEY_LEN 8 /* in byte */ |
| #endif |
| |
| #define CAT_KEY_MAX_SUPPORT_LEN NVRAM_SML_S_MAX_SUPPORT_HCK_LEN |
| |
| /* NVRAM_SML_MAX_SUPPORT_KEY_LEN is the largest value of SML_MAX_SUPPORT_KEY_LEN |
| used by NVRAM LID NVRAM_EF_SML_LID to prevent from NVRAM content size change |
| when __EXTEND_SML_KEY_LEN__ is switched. |
| Pleaes remember to align this value to the maximal SML_MAX_SUPPORT_KEY_LEN |
| */ |
| #define NVRAM_SML_MAX_SUPPORT_KEY_LEN 16 |
| |
| /* |
| * Linked Category Support |
| */ |
| #define SML_SIZE_OF_LINK_NS_SP 5 /* MCC/MNC + HLR+ GID1 */ |
| #define SML_SIZE_OF_LINK_SIM_C 10 /* IMSI + GID1 + GID2 */ |
| /* Define the maximum support num of categories */ |
| #define SML_MAX_SUPPORT_LINK_NS_SP 2 |
| #define SML_MAX_SUPPORT_LINK_SIM_C 2 |
| /* define the total size of link category */ |
| #define SML_CFG_CAT_NS_SP_SIZE (SML_SIZE_OF_LINK_NS_SP * SML_MAX_SUPPORT_LINK_NS_SP) |
| #define SML_CFG_CAT_SIM_C_SIZE (SML_SIZE_OF_LINK_SIM_C * SML_MAX_SUPPORT_LINK_SIM_C) |
| |
| /* |
| * Range Support |
| */ |
| #define SML_CAT_NS_RANGE_SIZE 2 /* ex: 00FF 0~255 for HLR */ |
| |
| /* |
| * Automatically Lock |
| */ |
| #define SML_AUTOLOCK_NUM_N_CATEGORY SML_MAX_SUPPORT_CAT_N |
| #define SML_AUTOLOCK_NUM_NS_CATEGORY SML_MAX_SUPPORT_CAT_NS |
| #define SML_AUTOLOCK_NUM_SP_CATEGORY SML_MAX_SUPPORT_CAT_SP |
| #define SML_AUTOLOCK_NUM_C_CATEGORY SML_MAX_SUPPORT_CAT_C |
| #define SML_AUTOLOCK_NUM_SIM_CATEGORY SML_MAX_SUPPORT_CAT_SIM |
| |
| /* |
| * Maximum Retry Count |
| */ |
| #define SML_MAX_RETRY_COUNT 5 |
| #define SML_RETRY_TIMEOUT 3 /* in sec */ |
| #define SML_RETRY_COUNT_N_CAT SML_MAX_RETRY_COUNT |
| #define SML_RETRY_COUNT_NS_CAT SML_MAX_RETRY_COUNT |
| #define SML_RETRY_COUNT_SP_CAT SML_MAX_RETRY_COUNT |
| #define SML_RETRY_COUNT_C_CAT SML_MAX_RETRY_COUNT |
| #define SML_RETRY_COUNT_SIM_CAT SML_MAX_RETRY_COUNT |
| |
| // Penalty timer timeout |
| #define SML_PENALTY_TIMER_TIMEOUT 60 /* Define in Seconds. Set default 60 */ |
| |
| // Penalty timer bitmask |
| #define SML_ENABLE_PENALTY_TIMER_BIMASK 0x10 |
| |
| #if !defined(L1_SIM) || defined(__UE_SIMULATOR__) || defined(__DUMMY_L1_ON_TARGET_4G5G__) |
| #include "cust_chl_interface.h" |
| |
| #define SML_TMO_MAX_SHARED_KEY_LENGTH MAX_CUST_CHL_SYM_KEY_LEN |
| #define SML_TMO_MAX_ENCRYPTED_KEY_LENGTH MAX_CUST_CHL_ASYM_KEY_LEN |
| #define SML_ATT_MAX_SHARED_KEY_LENGTH MAX_CUST_CHL_SYM_KEY_LEN |
| #define SML_ATT_MAX_ENCRYPTED_KEY_LENGTH MAX_CUST_CHL_ASYM_KEY_LEN |
| |
| #endif /* L1_SIM */ |
| |
| /* The following size are referend from TMO SIM lock blob format */ |
| #define SML_TMO_SIZE_OF_API_VERSION 4 |
| #define SML_TMO_SIZE_OF_VERSION 4 |
| #define SML_TMO_SIZE_OF_LENGTH 2 |
| #define SML_TMO_SIZE_OF_MCC_MNC 4 |
| #define SML_TMO_SIZE_OF_GID 2 |
| #define SML_TMO_SIZE_OF_MCC_MNC_GID 6 |
| #define SML_TMO_SIZE_OF_RESERVED 2 |
| #define SML_TMO_SIZE_OF_START_TIME 8 |
| #define SML_TMO_SIZE_OF_END_TIME 4 |
| #define SML_TMO_SIZE_OF_VERIFICATION_CODE 256 |
| |
| #define SML_TMO_SIZE_OF_MAC 32 |
| #define SML_TMO_SIZE_OF_SIGNATURE 256 |
| |
| #define SML_TMO_MAX_SLB_SIZE NVRAM_EF_SIM_LOCK_SIZE |
| |
| /* TMO SIM lock blob format 1.5 */ |
| #define SML_TMO_MAX_PLMN_NUMBER 10 |
| #define SML_TMO_MAX_GID_NUMBER 10 |
| #define SML_TMO_SIZE_OF_NUM_PLMN 2 |
| #define SML_TMO_SIZE_OF_PLMN_LIST SML_TMO_SIZE_OF_MCC_MNC * SML_TMO_MAX_PLMN_NUMBER |
| #define SML_TMO_SIZE_OF_NUM_GID 2 |
| #define SML_TMO_SIZE_OF_GID_LIST SML_TMO_SIZE_OF_GID * SML_TMO_MAX_GID_NUMBER |
| #define SML_TMO_SIZE_OF_IMEI 16 |
| #define SML_TMO_SIZE_OF_UNLOCK_TIME 4 |
| |
| /* Invalid SML context obj length */ |
| #define SML_TMO_INVALID_CONTEXT_OBJ_LENGTH 0xFFFF |
| #define SML_TMO_NVRAM_ACCESS_ID_UPDATE_VERIFICATION_CODE 0xFD |
| #define SML_TMO_NVRAM_ACCESS_ID_UPDATE_SLB 0xFC |
| #define SML_TMO_NVRAM_ACCESS_ID_RESET_SLB 0xFB |
| #define SML_TMO_NVRAM_ACCESS_ID_UNLOCK_EXPIRE 0xFA |
| #define SML_TMO_TIMEOUT_PERIODIC_CHECK (KAL_TICKS_1_SEC*10)//(12*60*KAL_TICKS_1_MIN) /* 12 hours */ |
| #define SML_RSU_TIMER_INDEX_PERIODIC_CHECK 0x01 |
| |
| /* the SML flags */ |
| #define SML_FLAG_CAT_N 0x01 |
| #define SML_FLAG_CAT_NS 0x02 |
| #define SML_FLAG_CAT_SP 0x04 |
| #define SML_FLAG_CAT_C 0x08 |
| #define SML_FLAG_CAT_SIM 0x10 |
| |
| typedef struct { |
| kal_uint8 change_flag; |
| kal_uint8 num; /* num of valid sets */ |
| } sml_sl_blob_meta_struct; |
| |
| typedef struct { |
| kal_uint8 iteration_count[SML_SL_BLOB_ITERATION_COUNT_SIZE]; /* 4 */ |
| kal_uint8 salt[SML_SL_BLOB_SALT_SIZE]; /* 16 */ |
| kal_uint8 hck[SML_SL_BLOB_HCK_SIZE]; /* 32 */ |
| } sml_sl_blob_key_struct; |
| |
| /* The following size are referend from ATT SIM lock blob format */ |
| #define SML_ATT_SIZE_OF_API_VERSION 4 |
| #define SML_ATT_SIZE_OF_VERSION 4 |
| #define SML_ATT_SIZE_OF_LENGTH 2 |
| #define SML_ATT_SIZE_OF_MCC_MNC 4 |
| #define SML_ATT_SIZE_OF_GID 2 |
| #define SML_ATT_SIZE_OF_MCC_MNC_GID 6 |
| #define SML_ATT_SIZE_OF_RESERVED 2 |
| #define SML_ATT_SIZE_OF_START_TIME 8 |
| #define SML_ATT_SIZE_OF_END_TIME 4 |
| #define SML_ATT_SIZE_OF_VERIFICATION_CODE 256 |
| #define SML_ATT_SIZE_OF_MAC 32 |
| #define SML_ATT_SIZE_OF_SIGNATURE 256 |
| #define SML_ATT_MAX_SLB_SIZE NVRAM_EF_L4_ATT_SIM_LOCK_SIZE |
| |
| /* ATT SIM lock blob format 1.5 */ |
| #define SML_ATT_MAX_PLMN_NUMBER 10 |
| #define SML_ATT_MAX_GID_NUMBER 10 |
| #define SML_ATT_SIZE_OF_NUM_PLMN 2 |
| #define SML_ATT_SIZE_OF_PLMN_LIST SML_ATT_SIZE_OF_MCC_MNC * SML_ATT_MAX_PLMN_NUMBER |
| #define SML_ATT_SIZE_OF_NUM_GID 2 |
| #define SML_ATT_SIZE_OF_GID_LIST SML_ATT_SIZE_OF_GID * SML_ATT_MAX_GID_NUMBER |
| #define SML_ATT_SIZE_OF_IMEI 16 |
| #define SML_ATT_SIZE_OF_UNLOCK_TIME 4 |
| |
| /* Invalid SML context obj length */ |
| #define SML_ATT_INVALID_CONTEXT_OBJ_LENGTH 0xFFFF |
| #define SML_ATT_NVRAM_ACCESS_ID_UPDATE_VERIFICATION_CODE 0xED |
| #define SML_ATT_NVRAM_ACCESS_ID_UPDATE_SLB 0xEC |
| #define SML_ATT_NVRAM_ACCESS_ID_RESET_SLB 0xEB |
| #define SML_ATT_NVRAM_ACCESS_ID_UNLOCK_EXPIRE 0xEA |
| #define SML_ATT_TIMEOUT_PERIODIC_CHECK (KAL_TICKS_1_SEC*10)//(12*60*KAL_TICKS_1_MIN) /* 12 hours */ |
| |
| typedef struct { |
| kal_uint8 version[SML_ATT_SIZE_OF_VERSION]; /* 4 */ |
| kal_uint8 protection_scheme; /* 1 */ |
| kal_uint8 state; /* 1 */ |
| kal_uint8 length[SML_ATT_SIZE_OF_LENGTH]; /* 2 */ |
| kal_uint8 num_of_plmn[SML_ATT_SIZE_OF_NUM_PLMN]; /* 2 */ |
| kal_uint8 plmn_list[SML_ATT_SIZE_OF_PLMN_LIST]; /* N = 4 x plmn count */ |
| kal_uint8 num_of_gid[SML_ATT_SIZE_OF_NUM_GID]; /* 2 */ |
| kal_uint8 gid_list[SML_ATT_SIZE_OF_GID_LIST]; /* M = 2 x gid count */ |
| kal_uint8 reserved[SML_ATT_SIZE_OF_RESERVED]; /* 2 */ |
| kal_uint8 start_time[SML_ATT_SIZE_OF_START_TIME]; /* 8 */ |
| kal_uint8 end_time[SML_ATT_SIZE_OF_END_TIME]; /* 4 */ |
| kal_uint8 imei[SML_ATT_SIZE_OF_IMEI]; /* 16 */ |
| kal_uint8 verification_code[SML_ATT_SIZE_OF_VERIFICATION_CODE]; /* 256 */ |
| kal_uint8 unlock_time[SML_ATT_SIZE_OF_UNLOCK_TIME]; /* 4 */ |
| } sml_att_context_struct; /* 42 + N + M + 256 + 4*/ |
| typedef sml_att_context_struct nvram_sml_att_context_struct; |
| |
| typedef struct { |
| kal_uint8 major_version; |
| kal_uint8 minor_version; |
| kal_uint8 protection_algorithm; |
| kal_uint8 lock_operation; |
| kal_uint8 imei[SML_SL_BLOB_IMEI_SIZE]; /* 15 */ |
| kal_uint8 time_stamp[SML_SL_BLOB_TIME_STAMP_SIZE]; /* 8 */ |
| kal_uint8 length[SML_SL_BLOB_LENGTH_SIZE]; /* 2 */ |
| sml_sl_blob_meta_struct cat[SML_SL_BLOB_CONFIG_SUPPORT_CAT_SIZE]; /* (3 * 2) */ |
| sml_sl_blob_key_struct key[SML_SL_BLOB_CONFIG_SUPPORT_CAT_SIZE]; /* (3 * 52) */ |
| kal_uint8 code_cat_n[SML_SL_BLOB_CAT_N_SIZE]; /* (30 * 6) */ |
| kal_uint8 code_cat_ns[SML_SL_BLOB_CAT_NS_SIZE]; /* (10 * 8) */ |
| kal_uint8 code_cat_sp[SML_SL_BLOB_CAT_SP_SIZE]; /* (10 * 7) */ |
| kal_uint8 signature[SML_SL_BLOB_SIZE_OF_SIGNATURE]; /* 256 */ |
| } sml_sl_blob_context_struct; |
| typedef sml_sl_blob_context_struct nvram_sml_sl_blob_context_struct; |
| |
| typedef struct { |
| kal_uint8 public_key_mod[SML_SL_PUBLIC_KEY_MOD_SIZE]; /* 256 */ |
| kal_uint8 public_key_exp[SML_SL_PUBLIC_KEY_EXP_SIZE]; /* 3 */ |
| } sml_sl_odm_data_struct; |
| typedef sml_sl_odm_data_struct nvram_sml_sl_odm_data_struct; |
| |
| typedef enum |
| { |
| SML_INPUT_FORMAT_CATKEY_UNKNOWN, |
| SML_INPUT_FORMAT_CATKEY_BCD, |
| SML_INPUT_FORMAT_CATKEY_ASCII, |
| } sml_input_format_of_catkey_for_algo_enum; |
| |
| |
| typedef struct { |
| kal_uint8 max_retry_count[SML_SUPPORT_CAT_SIZE]; |
| } sml_max_retry_count_struct; |
| typedef sml_max_retry_count_struct nvram_sml_max_retry_count_struct; |
| |
| typedef struct { |
| kal_uint8 major_version; |
| kal_uint8 minor_version; |
| kal_uint8 device_lock_state; |
| kal_uint8 imei[SML_GBLOB_TOTAL_IMEI_SIZE]; /* 15 * 4 */ |
| kal_uint8 sml_lock_type; |
| kal_uint8 sml_lock_sub_type[SML_GBLOB_SUB_RULE_SIZE]; |
| #if GBLOB_LID_VER >= 3 |
| kal_uint8 cust_code; /* sml_lock_cust_code_enum */ |
| kal_uint8 cust_rule; /* sml_lock_cust_rule_enum */ |
| #endif |
| kal_uint8 tlv_data[SML_GBLOB_TLV_DATA_SIZE]; /* 256 */ |
| kal_uint8 dev_protection_algo; |
| kal_uint8 dev_max_retry_cnt[SML_GBLOB_SIZE_OF_MRC]; /* 4 */ |
| kal_uint8 dev_remain_retry_cnt[SML_GBLOB_SIZE_OF_MRC]; /* 4 */ |
| kal_uint8 device_interation_cnt[SML_GBLOB_SIZE_OF_DEV_INTCNT]; /* 4 */ |
| kal_uint8 device_salt[SML_GBLOB_SIZE_OF_DEV_SALT]; /* 32 */ |
| kal_uint8 device_hck[SML_GBLOB_SIZE_OF_DEV_HCK]; /* 64 */ |
| kal_uint8 sig_protection_algo; |
| kal_uint8 signature[SML_GBLOB_SIZE_OF_SIGNATURE]; /* 256 */ |
| } sml_gblob_s_context_struct; |
| typedef sml_gblob_s_context_struct nvram_sml_gblob_s_context_struct; |
| |
| typedef struct { |
| kal_uint8 key[SML_GBLOB_SIZE_OF_PACKAGE_KEY]; /* 1024 */ |
| } sml_gblob_key_s_context_struct; |
| typedef sml_gblob_key_s_context_struct nvram_sml_gblob_key_s_context_struct; |
| |
| /* For converting R1 SML structure to R2 */ |
| typedef struct { |
| kal_uint8 state; /* sml_state_enum */ |
| kal_uint8 retry_count; /* SML_RETRY_COUNT_X_CAT */ |
| kal_uint8 autolock_count; /* SML_AUTOLOCK_NUM_X_CAT */ |
| kal_uint8 num; /* num of valid sets */ |
| } sml_category_meta_r1_struct; |
| |
| typedef struct { |
| kal_uint8 state; /* Default Value or NULL */ |
| kal_uint8 key[8]; //actual data length is SML_MAX_SUPPORT_KEY_LEN |
| } sml_control_key_r1_struct; |
| |
| typedef struct { |
| kal_uint32 magic_head; /* 4 */ |
| sml_category_meta_r1_struct cat[SML_SUPPORT_CAT_SIZE]; /* (4 * 7) */ |
| sml_control_key_r1_struct key[SML_SUPPORT_CAT_SIZE]; /* (9 * 7) */ |
| kal_uint8 code_cat_n[SML_CFG_CAT_N_SIZE]; /* (30 * 3)*/ |
| kal_uint8 code_cat_ns[SML_CFG_CAT_NS_SIZE]; /* (30 * 4)*/ |
| kal_uint8 code_cat_sp[SML_CFG_CAT_SP_SIZE]; /* (30 * 4)*/ |
| kal_uint8 code_cat_c[SML_CFG_CAT_C_SIZE]; /* (30 * 5)*/ |
| kal_uint8 code_cat_sim[SML_CFG_CAT_SIM_SIZE]; /* (30 * 8)*/ |
| kal_uint8 code_cat_ns_sp[SML_CFG_CAT_NS_SP_SIZE]; /* (5 * 10)*/ |
| kal_uint8 code_cat_sim_c[SML_CFG_CAT_SIM_C_SIZE]; /* (10 * 10)*/ |
| kal_uint8 range_cat_ns[SML_CAT_NS_RANGE_SIZE]; /* 2 */ |
| kal_uint32 magic_tail; /* 4 */ |
| } sml_r1_context_struct; /* 971 */ |
| |
| typedef struct { |
| kal_uint8 version[SML_TMO_SIZE_OF_VERSION]; /* 4 */ |
| kal_uint8 protection_scheme; /* 1 */ |
| kal_uint8 state; /* 1 */ |
| kal_uint8 length[SML_TMO_SIZE_OF_LENGTH]; /* 2 */ |
| kal_uint8 num_of_plmn[SML_TMO_SIZE_OF_NUM_PLMN]; /* 2 */ |
| kal_uint8 plmn_list[SML_TMO_SIZE_OF_PLMN_LIST]; /* N = 4 x plmn count */ |
| kal_uint8 num_of_gid[SML_TMO_SIZE_OF_NUM_GID]; /* 2 */ |
| kal_uint8 gid_list[SML_TMO_SIZE_OF_GID_LIST]; /* M = 2 x gid count */ |
| kal_uint8 reserved[SML_TMO_SIZE_OF_RESERVED]; /* 2 */ |
| kal_uint8 start_time[SML_TMO_SIZE_OF_START_TIME]; /* 8 */ |
| kal_uint8 end_time[SML_TMO_SIZE_OF_END_TIME]; /* 4 */ |
| kal_uint8 imei[SML_TMO_SIZE_OF_IMEI]; /* 16 */ |
| kal_uint8 verification_code[SML_TMO_SIZE_OF_VERIFICATION_CODE]; /* 256 */ |
| kal_uint8 unlock_time[SML_TMO_SIZE_OF_UNLOCK_TIME]; /* 4 */ |
| } sml_tmo_context_struct; /* 42 + N + M + 256 + 4*/ |
| typedef sml_tmo_context_struct nvram_sml_tmo_context_struct; |
| |
| extern const nvram_sml_tmo_context_struct NVRAM_EF_SML_TMO_DEFAULT; |
| extern const nvram_sml_att_context_struct NVRAM_EF_L4_SML_ATT_DEFAULT; |
| |
| |
| typedef struct { |
| kal_uint32 nonce_length; |
| kal_uint8 nonce[256]; |
| } sml_uulk_nonce_struct; |
| typedef sml_uulk_nonce_struct nvram_ef_sml_nonce_struct; |
| |
| typedef struct { |
| kal_uint8 unlock_code; |
| } sml_uulk_unlock_code_struct; |
| typedef sml_uulk_unlock_code_struct nvram_ef_sml_unlock_code_struct; |
| |
| typedef struct { |
| kal_uint32 signature_length; |
| kal_uint8 signature[256]; |
| } sml_uulk_signature_struct; |
| typedef sml_uulk_signature_struct nvram_ef_sml_signature_struct; |
| |
| |
| /* The maximum size of Response Message according VZW RSU SPEC is |
| major version :1 byte |
| minor version :1 byte |
| protection alg :1 byte |
| network lock op :1 byte |
| imei :15 bytes |
| timestamp :8 bytes |
| length :2 bytes (size of following fields, including Signature) |
| category lock data :? bytes |
| signature :256 bytes |
| |
| possible maximum length is (1+1+1+1+15+8+2+65535) |
| */ |
| #define MAX_VZW_RSU_RSP_SIZE 1024 |
| |
| typedef enum { |
| SML_VZW_RSU_UNLOCK_TIMER_SUCCESS = 0, |
| SML_VZW_RSU_UNLOCK_TIMER_FAIL = 1, |
| SML_VZW_RSU_UNLOCK_TIMER_EXPIRED = 3, //defined by VZW RSU SPEC |
| } sml_vzw_rsu_unlock_timer_resp_enum; |
| |
| typedef enum { |
| SML_ES_ID_VZW_RSU, |
| SML_ES_ID_TMO_PERIODIC_CHECK, //shall be equal to SML_TMO_TIMER_INDEX_PERIODIC_CHECK |
| SML_ES_ID_PENALTY_TIMER, |
| SML_ES_ID_MAX_NUM |
| } sml_es_id_enum; |
| |
| typedef enum { |
| SMU_VZW_RSU_STOP_DELAY_TIMER, |
| SMU_VZW_RSU_START_DELAY_TIMER |
| } smu_vzw_rsu_delay_timer_op_enum; |
| |
| typedef enum { |
| SML_VZW_DISALLOW_TEMP_UNLOCK_CAUSE_NONE, |
| SML_VZW_DISALLOW_TEMP_UNLOCK_HAS_EXPIRED, |
| SML_VZW_DISALLOW_TEMP_UNLOCK_HAS_STARTED, |
| } sml_vzw_rsu_disallow_temp_unlock_cause_enum; |
| |
| |
| #ifdef __CARRIER_RESTRICTION__ |
| |
| /* Carrier Restriction */ |
| /* Basic unit of categories */ |
| #define SMU_CARRIER_MATCH_SIZE_OF_CAT_N 3 /* MCC/MNC */ |
| #define SMU_CARRIER_MATCH_SIZE_OF_CAT_SPN 23 /* MCC/MNC + SPN(20) */ |
| #define SMU_CARRIER_MATCH_SIZE_OF_CAT_IMSI_PREFIX 4 /* MCC/MNC + HLR */ |
| #define SMU_CARRIER_MATCH_SIZE_OF_CAT_GID1 4 /* MCC/MNC + GID1 */ |
| #define SMU_CARRIER_MATCH_SIZE_OF_CAT_GID2 4 /* MCC/MNC + GID2 */ |
| |
| /* Define the maximum supported categories */ |
| #define SMU_CARRIER_MATCH_MAX_SUPPORT_CAT_N 5 |
| #define SMU_CARRIER_MATCH_MAX_SUPPORT_CAT_SPN 5 |
| #define SMU_CARRIER_MATCH_MAX_SUPPORT_CAT_IMSI_PREFIX 5 |
| #define SMU_CARRIER_MATCH_MAX_SUPPORT_CAT_GID1 5 |
| #define SMU_CARRIER_MATCH_MAX_SUPPORT_CAT_GID2 5 |
| |
| /* Define the total size of each category */ |
| #define SMU_CARRIER_MATCH_CFG_CAT_N_SIZE (SMU_CARRIER_MATCH_MAX_SUPPORT_CAT_N * SMU_CARRIER_MATCH_SIZE_OF_CAT_N) |
| #define SMU_CARRIER_MATCH_CFG_CAT_SPN_SIZE (SMU_CARRIER_MATCH_MAX_SUPPORT_CAT_SPN * SMU_CARRIER_MATCH_SIZE_OF_CAT_SPN) |
| #define SMU_CARRIER_MATCH_CFG_CAT_IMSI_PREFIX_SIZE (SMU_CARRIER_MATCH_MAX_SUPPORT_CAT_IMSI_PREFIX * SMU_CARRIER_MATCH_SIZE_OF_CAT_IMSI_PREFIX) |
| #define SMU_CARRIER_MATCH_CFG_CAT_GID1_SIZE (SMU_CARRIER_MATCH_MAX_SUPPORT_CAT_GID1 * SMU_CARRIER_MATCH_SIZE_OF_CAT_GID1) |
| #define SMU_CARRIER_MATCH_CFG_CAT_GID2_SIZE (SMU_CARRIER_MATCH_MAX_SUPPORT_CAT_GID2 * SMU_CARRIER_MATCH_SIZE_OF_CAT_GID2) |
| |
| /* Define the support category size */ |
| #define SMU_CARRIER_MATCH_SUPPORT_CAT_SIZE 5 /* SMU_CARRIER_MATCH_CAT_SIZE in sml_carrier_match_cat_enum */ |
| |
| typedef enum { |
| SMU_CARRIER_MATCH_CAT_N, |
| SMU_CARRIER_MATCH_CAT_SPN, |
| SMU_CARRIER_MATCH_CAT_IMSI_PREFIX, |
| SMU_CARRIER_MATCH_CAT_GID1, |
| SMU_CARRIER_MATCH_CAT_GID2, |
| SMU_CARRIER_MATCH_CAT_SIZE |
| } smu_carrier_match_cat_enum; |
| |
| /* General lock structure */ |
| typedef struct { |
| kal_uint8 num; /* num of valid sets */ |
| } smu_carrier_match_category_meta_struct; |
| |
| /* General control key structure */ |
| typedef struct { |
| kal_uint8 state; |
| kal_uint8 algo; |
| kal_uint32 max_retry_count; |
| kal_uint32 retry_count; |
| kal_uint8 salt[NVRAM_SML_S_MAX_SUPPORT_SALT_LEN]; |
| kal_uint8 iter_cnt[NVRAM_SML_S_MAX_SUPPORT_INTER_CNT_LEN]; |
| kal_uint8 key[NVRAM_SML_S_MAX_SUPPORT_HCK_LEN]; |
| } smu_carrier_match_control_key_struct; |
| |
| typedef enum { |
| SMU_CARRIER_RESTRICTION_ENABLED, |
| SMU_CARRIER_RESTRICTION_DISABLED |
| } smu_carrier_restriction_state_enum; |
| |
| typedef enum { |
| SMU_CARRIER_RESTRICTION_MULTI_SIM_POLICY_NONE, |
| SMU_CARRIER_RESTRICTION_ONE_VALID_SIM_MUST_BE_PRESENT |
| } smu_carrier_restriction_multi_sim_policy_enum; |
| |
| typedef struct { |
| smu_carrier_match_category_meta_struct cat[SMU_CARRIER_MATCH_SUPPORT_CAT_SIZE]; /* (5 * 1) */ |
| kal_uint8 code_cat_n[SMU_CARRIER_MATCH_CFG_CAT_N_SIZE]; /* (5 * 3) */ |
| kal_uint8 code_cat_spn[SMU_CARRIER_MATCH_CFG_CAT_SPN_SIZE]; /* (5 * 23)*/ |
| kal_uint8 code_cat_imsi_prefix[SMU_CARRIER_MATCH_CFG_CAT_IMSI_PREFIX_SIZE]; /* (5 * 4)*/ |
| kal_uint8 code_cat_gid1[SMU_CARRIER_MATCH_CFG_CAT_GID1_SIZE]; /* (5 * 4)*/ |
| kal_uint8 code_cat_gid2[SMU_CARRIER_MATCH_CFG_CAT_GID2_SIZE]; /* (5 * 4)*/ |
| }smu_carrier_restriction_list_struct; |
| |
| typedef struct { |
| kal_uint32 magic_head; |
| smu_carrier_match_control_key_struct key; |
| smu_carrier_restriction_list_struct black_list; |
| smu_carrier_restriction_list_struct white_list; |
| kal_uint8 allow_all; |
| smu_carrier_restriction_state_enum carrier_rest_state; |
| kal_uint8 allowed_carriers_prioritized; |
| kal_uint8 multi_sim_policy; |
| kal_uint32 magic_tail; |
| } smu_carrier_match_context_struct; |
| typedef smu_carrier_match_context_struct nvram_smu_carrier_match_context_struct; |
| |
| typedef enum |
| { |
| CRRST_INPUT_FORMAT_CATKEY_UNKNOWN, |
| CRRST_INPUT_FORMAT_CATKEY_BCD, |
| CRRST_INPUT_FORMAT_CATKEY_ASCII, |
| } crrst_input_format_of_catkey_for_algo_enum; |
| |
| /* carrier restriction: magic numbers of file header and tail */ |
| #define SML_CARRIER_RESTRICTION_MAGIC_HEAD_VALUE (sizeof(smu_carrier_match_context_struct)) |
| #define SML_CARRIER_RESTRICTION_MAGIC_TAIL_VALUE 0x26598088 |
| |
| #endif /* __CARRIER_RESTRICTION__ */ |
| |
| #ifdef __MBIM_MS_NETWORK_BLACKLIST__ |
| #define MAX_NW_BLACK_LIST 50 |
| |
| #define SML_MS_SIM_BLACK_LIST_SIZE (MAX_NW_BLACK_LIST*3) |
| |
| typedef struct { |
| kal_uint8 num_of_black_list; |
| kal_uint8 black_list[SML_MS_SIM_BLACK_LIST_SIZE]; |
| }smu_ms_sim_black_list_context_struct; |
| typedef smu_ms_sim_black_list_context_struct nvram_smu_ms_sim_black_list_context_struct; |
| #endif |
| #endif /* SML_PUBLIC_DEF_H */ |