[Meizu M3 Note Guides, News, & Discussion] XRed_CubeX:
I try to disassembly seccfg

---------- Post added at 07:48 AM ---------- Previous post was at 07:42 AM ----------

static unsigned int get_default_lock_state(unsigned int *lock_state){ unsigned int ret = 0; *lock_state = LKS_LOCK; return ret;)

#include "sec_policy.h"#include "lock_state.h"#include <debug.h>#define SHA256_HASH_SZ (32) unsigned char g_binding_hash[SHA256_HASH_SZ] = {0}; struct policy_part_map g_policy_map[] = {	{0, "default", 0, 0, 0, DEFAULT_SEC_POLICY_1, DEFAULT_SEC_POLICY_2, DEFAULT_SEC_POLICY_3, DEFAULT_SEC_POLICY_4, 0},	{PL_SW_ID, "preloader", 0, 0, 0, PL_SEC_POLICY_1, PL_SEC_POLICY_2, PL_SEC_POLICY_3, PL_SEC_POLICY_4, PL_BINDING_HASH},	{LK_SW_ID, "lk", 0, 0, 0, LK_SEC_POLICY_1, LK_SEC_POLICY_2, LK_SEC_POLICY_3, LK_SEC_POLICY_4, LK_BINDING_HASH},	{LOGO_SW_ID, "logo", 0, 0, 0, LOGO_SEC_POLICY_1, LOGO_SEC_POLICY_2, LOGO_SEC_POLICY_3, LOGO_SEC_POLICY_4, LOGO_BINDING_HASH},	{BOOT_SW_ID, "boot", 0, 0, 0, BOOT_SEC_POLICY_1, BOOT_SEC_POLICY_2, BOOT_SEC_POLICY_3, BOOT_SEC_POLICY_4, BOOT_BINDING_HASH},	{RECOVERY_SW_ID, "recovery", 0, 0, 0, RECOVERY_SEC_POLICY_1, RECOVERY_SEC_POLICY_2, RECOVERY_SEC_POLICY_3, RECOVERY_SEC_POLICY_4, RECOVERY_BINDING_HASH},	{SYSTEM_SW_ID, "system", 0, 0, 0, SYSTEM_SEC_POLICY_1, SYSTEM_SEC_POLICY_2, SYSTEM_SEC_POLICY_3, SYSTEM_SEC_POLICY_4, SYSTEM_BINDING_HASH},	{TEE1_SW_ID, "tee1", 0, 0, 0, TEE1_SEC_POLICY_1, TEE1_SEC_POLICY_2, TEE1_SEC_POLICY_3, TEE1_SEC_POLICY_4, TEE1_BINDING_HASH},	{TEE2_SW_ID, "tee2", 0, 0, 0, TEE2_SEC_POLICY_1, TEE2_SEC_POLICY_2, TEE2_SEC_POLICY_3, TEE2_SEC_POLICY_4, TEE2_BINDING_HASH},	{OEMKEYSTORE_SW_ID, "oemkeystore", 0, 0, 0, OEMKEYSTORE_SEC_POLICY_1, OEMKEYSTORE_SEC_POLICY_2, OEMKEYSTORE_SEC_POLICY_3, OEMKEYSTORE_SEC_POLICY_4, OEMKEYSTORE_BINDING_HASH},	{KEYSTORE_SW_ID, "keystore", 0, 0, 0, KEYSTORE_SEC_POLICY_1, KEYSTORE_SEC_POLICY_2, KEYSTORE_SEC_POLICY_3, KEYSTORE_SEC_POLICY_4, KEYSTORE_BINDING_HASH},	{USERDATA_SW_ID, "userdata", 0, 0, 0, USERDATA_SEC_POLICY_1, USERDATA_SEC_POLICY_2, USERDATA_SEC_POLICY_3, USERDATA_SEC_POLICY_4, USERDATA_BINDING_HASH},	{MD1IMG_SW_ID, "md1img", 0, 0, 0, MD1IMG_SEC_POLICY_1, MD1IMG_SEC_POLICY_2, MD1IMG_SEC_POLICY_3, MD1IMG_SEC_POLICY_4, MD1IMG_BINDING_HASH},	{MD1DSP_SW_ID, "md1dsp", 0, 0, 0, MD1DSP_SEC_POLICY_1, MD1DSP_SEC_POLICY_2, MD1DSP_SEC_POLICY_3, MD1DSP_SEC_POLICY_4, MD1DSP_BINDING_HASH},	{MD1ARM7_SW_ID, "md1arm7", 0, 0, 0, MD1ARM7_SEC_POLICY_1, MD1ARM7_SEC_POLICY_2, MD1ARM7_SEC_POLICY_3, MD1ARM7_SEC_POLICY_4, MD1ARM7_BINDING_HASH},	{MD3IMG_SW_ID, "md3img", 0, 0, 0, MD3IMG_SEC_POLICY_1, MD3IMG_SEC_POLICY_2, MD3IMG_SEC_POLICY_3, MD3IMG_SEC_POLICY_4, MD3IMG_BINDING_HASH},	/*Custom img*/	{0, CUST1_IMG_NAME, 0, 0, 0, CUST1_SEC_POLICY_1, CUST1_SEC_POLICY_2, CUST1_SEC_POLICY_3, CUST1_SEC_POLICY_4 , CUST1_BINDING_HASH},	{0, CUST2_IMG_NAME, 0, 0, 0, CUST2_SEC_POLICY_1, CUST2_SEC_POLICY_2, CUST2_SEC_POLICY_3, CUST2_SEC_POLICY_4 , CUST2_BINDING_HASH},	/*End of array*/	{0, "NULL", "NULL", "NULL", "NULL", 0 , 0, 0, 0, 0},}; static int strcmp(const char *cs, const char *ct){ signed char __res; while (1) { if ((__res = *cs - *ct++) != 0 || !*cs++) break; } return __res;} unsigned int get_policy_entry_idx(unsigned char *part_name) {	unsigned int i = 0; unsigned int num_of_entries = sizeof(g_policy_map)/sizeof(struct policy_part_map);	while (i < num_of_entries) { if (0 == strcmp(part_name, g_policy_map.part_name1))	break;	else if (0 == strcmp(part_name, g_policy_map.part_name2))	break;	else if (0 == strcmp(part_name, g_policy_map.part_name3))	break;	else if (0 == strcmp(part_name, g_policy_map.part_name4))	break;	i++;	} if (i == num_of_entries) { dprintf(CRITICAL, "[SEC_POLICY] reached the end, use default policy\n"); i = 0; }	return i;} static unsigned int get_default_lock_state(unsigned int *lock_state){ unsigned int ret = 0; *lock_state = LKS_LOCK; return ret;} static unsigned int get_sec_state(unsigned int *sboot_state, unsigned int *lock_state){ unsigned int ret = 0; unsigned int default_lock_state = 0; ret = get_sboot_state(sboot_state); if (ret) sboot_state = 0; ret = get_lock_state(lock_state); /* dont't process return value here */ if ((LKS_DEFAULT == *lock_state) || (LKS_MP_DEFAULT == *lock_state)) { ret = get_default_lock_state(&default_lock_state); if (ret) *lock_state = LKS_LOCK; *lock_state = default_lock_state; } dprintf(CRITICAL, "[SEC_POLICY] sboot_state = 0x%x\n", *sboot_state); if (!default_lock_state) dprintf(CRITICAL, "[SEC_POLICY] lock_state = 0x%x\n", *lock_state); else dprintf(CRITICAL, "[SEC_POLICY] lock_state(default) = 0x%x\n", *lock_state); return 0;} static char get_sec_policy(unsigned int policy_entry_idx){ unsigned int sboot_state = 0; unsigned int lock_state = 0; unsigned char sec_policy = 0; unsigned int ret = 0;

Maybe?