本文整理汇总了C++中SMSG函数的典型用法代码示例。如果您正苦于以下问题:C++ SMSG函数的具体用法?C++ SMSG怎么用?C++ SMSG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SMSG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: masp_secro_md_len
/******************************************************************************
* RETURN SECROIMG MD LENGTH
******************************************************************************/
uint32 masp_secro_md_len (uchar *md_info)
{
uint32 index = 0;
AND_AC_MD_INFO_V3a_T* cur_md_info = NULL;
uint32 md_info_len = 0;
SMSG(FALSE,"[%s]md_info:%s \n",MOD,md_info);
if(TRUE == bSecroExist)
{
/* check if this secro supports v5 format(world phone) , in v3 format
this area should be zero.*/
if (FALSE == secroimg.m_header.world_phone_support)
{
/* read v3 format and return, it depends on first character */
if ('1' == md_info[0])
{
return secroimg.m_header.md_length;
}
else if ('2' == md_info[0])
{
return secroimg.m_header.md2_length;
}
}
/* if it supports v5 format (world phone) */
else if (TRUE == secroimg.m_header.world_phone_support)
{
if (NULL != md_info)
{
md_info_len = strlen(md_info);
}
/* check if this image's information exist */
for(index=0; index<MAX_V5_SUPPORT_MD_NUM; index++)
{
cur_md_info = &(secroimg.m_padding.md_v3a_info[index]);
if(0 == strncmp(md_info,cur_md_info->md_name+strlen("SECURE_RO_"),md_info_len))
{
SMSG(TRUE,"[%s]md[%d]len:0x%x \n",MOD,index,cur_md_info->md_len);
return cur_md_info->md_len;
}
}
if (MAX_V5_SUPPORT_MD_NUM == index)
{
/* no match found, return 0 */
SMSG(TRUE,"[%s]v5 no match \n",MOD);
return 0;
}
}
}
else
{
SMSG(TRUE,"[%s]Secro v3 does not exist \n",MOD);
return 0;
}
return 0;
}
示例2: sec_util_brom_download_recovery_check
BOOL sec_util_brom_download_recovery_check(void)
{
#ifdef KPD_DL_KEY2
if (mtk_detect_key (KPD_DL_KEY2) && FALSE==bUsbHandshakeSuccess
&& is_BR_cmd_disabled())
{
SMSG("[%s] Start checking (1500 ms)\n", MOD);
mdelay(1500);
if(false == mtk_detect_key (KPD_DL_KEY2))
{
SMSG("[%s] Key is not detected, wait for 1500ms \n", MOD);
mdelay(1500);
if(mtk_detect_key (KPD_DL_KEY2))
{
SMSG("[%s] Key is detected\n", MOD);
return sec_util_force_brom_download_recovery();
}
else
{
SMSG("[%s] Key is not detected\n", MOD);
return FALSE;
}
}
else
{
SMSG("[%s] Key is detected\n", MOD);
return FALSE;
}
}
#endif
return FALSE;
}
示例3: sec_aes_test
/* Note: this function is only for aes test */
int sec_aes_test(void)
{
int ret = SEC_OK;
uchar buf[CIPHER_BLOCK_SIZE] = "AES_TEST";
SMSG("\n[%s] SW AES test\n", MOD);
/* -------------------------- */
/* sec aes encrypt test */
/* -------------------------- */
SMSG("[%s] input = 0x%x,0x%x,0x%x,0x%x\n", MOD, buf[0], buf[1], buf[2], buf[3]);
if (SEC_OK != (ret = lib_aes_enc(buf, CIPHER_BLOCK_SIZE, buf, CIPHER_BLOCK_SIZE))) {
pr_err("[%s] error (0x%x)\n", MOD, ret);
goto _exit;
}
SMSG("[%s] cipher = 0x%x,0x%x,0x%x,0x%x\n", MOD, buf[0], buf[1], buf[2], buf[3]);
/* -------------------------- */
/* sec aes decrypt test */
/* -------------------------- */
if (SEC_OK != (ret = lib_aes_dec(buf, CIPHER_BLOCK_SIZE, buf, CIPHER_BLOCK_SIZE))) {
pr_err("[%s] error (0x%x)\n", MOD, ret);
goto _exit;
}
SMSG("[%s] plain text = 0x%x,0x%x,0x%x,0x%x\n", MOD, buf[0], buf[1], buf[2], buf[3]);
_exit:
return ret;
}
示例4: is_lk_img
BOOL is_lk_img(void)
{
part_hdr_t *part_hdr = (part_hdr_t*)COMMON_BUFFER_ADDR;
blkdev_t *bdev = blkdev_get(CFG_BOOT_DEV);
part_t *part;
u64 src;
if (NULL == (part = part_get(PART_UBOOT)))
goto error;
src = part->startblk * bdev->blksz;
/* retrieve partition header. */
if ((blkdev_read(bdev, src, sizeof(part_hdr_t), (u8*)part_hdr) == 0) &&
(!memcmp(part_hdr->info.name, "LK", strlen("LK")))) {
SMSG ("[%s] Found LK... \n",MOD);
return TRUE;
}else{
SMSG ("[%s] LK does not exist, use uboot... \n",MOD);
return FALSE;
}
error:
SMSG ("[%s] part_get (PART_UBOOT) Fail\n",MOD);
return FALSE;
}
示例5: sec_get_rid
static int sec_get_rid(uint32 *rid)
{
uint32 obuf[5];
uint32 ibuf[4];
secpal_get_uuid(ibuf);
sha1((uchar*)ibuf, 16, (uchar*)obuf);
secpal_memcpy(rid, obuf, 16);
#ifdef SEC_DEBUG
{
int i = 0;
for (i = 0; i < 4; i++)
{
SMSG(TRUE,"IBUF[%d] = 0x%.8x\n", i, ibuf[i]);
SMSG(TRUE,"OBUF[%d] = 0x%.8x\n", i, obuf[i]);
}
}
#endif
return 0;
}
示例6: sec_signfmt_image_read
/**************************************************************************
* FUNCTION To Generate Hash by Chunk
**************************************************************************/
static int sec_signfmt_image_read(ASF_FILE fp, char* part_name, uint32 seek_offset, char* read_buf, uint32 read_len)
{
uint32 read_sz = 0;
uint32 ret = SEC_OK;
#if DUMP_MORE_FOR_DEBUG
SMSG(true,"[%s] Read image for length %d at offset 0x%x\n",MOD,read_len,seek_offset);
#endif
/* read from file */
if (ASF_FILE_NULL != fp)
{
ASF_SEEK_SET(fp, seek_offset*sizeof(char));
read_sz = ASF_READ(fp, read_buf, read_len);
return read_sz;
}
/* read from mtd */
else
{
if(SEC_OK != (ret = sec_dev_read_image ( pl2part(part_name),
(char*)read_buf,
seek_offset,
read_len,
NORMAL_ROM)))
{
SMSG(true,"[%s] read mtd '%s' fail at image offset 0x%x with length 0x%x\n",MOD,(char*)pl2part(part_name),seek_offset,read_len);
return 0;
}
return read_len;
}
}
示例7: lib_aes_init_key
int lib_aes_init_key(uchar* key_buf, uint32 key_len, AES_VER ver)
{
switch (ver)
{
case AES_VER_LEGACY:
g_ver = AES_VER_LEGACY;
SMSG("\n[%s] Legacy\n",MOD);
if(0 != aes_legacy_init_key(key_buf,key_len))
{
goto _err;
}
break;
case AES_VER_SO:
g_ver = AES_VER_SO;
SMSG("\n[%s] SO\n",MOD);
if(0 != aes_so_init_key(key_buf,key_len))
{
goto _err;
}
break;
default:
SMSG("\n[%s] Invalid Ver\n",MOD);
goto _err;
}
return 0;
_err:
return -1;
}
示例8: lib_aes_init_vector
int lib_aes_init_vector(AES_VER ver)
{
switch (ver)
{
case AES_VER_LEGACY:
g_ver = AES_VER_LEGACY;
SMSG("[%s] Legacy(V)\n",MOD);
if(0 != aes_legacy_init_vector())
{
goto _err;
}
break;
case AES_VER_SO:
g_ver = AES_VER_SO;
SMSG("[%s] SO(V)\n",MOD);
if(0 != aes_so_init_vector())
{
goto _err;
}
break;
default:
SMSG("[%s] Invalid Ver(V)\n",MOD);
goto _err;
}
return 0;
_err:
return -1;
}
示例9: sec_signfmt_search_extension
/**************************************************************************
* FUNCTION To Search Extension Header
**************************************************************************/
static uint32 sec_signfmt_search_extension(uchar *ext, uint32 ext_len, SEC_IMG_EXTENSTION_SET *ext_set)
{
SEC_EXTENSTION_END_MARK *search_pattern;
uchar *d_ptr,*end_ptr;
uint32 hash_only_idx = 0;
#if DUMP_MORE_FOR_DEBUG
SMSG(sec_info.bMsg,"[%s] Dump extension data ============> START\n",MOD);
sec_signfmt_dump_buffer(ext,ext_len);
SMSG(sec_info.bMsg,"[%s] Dump extension data ============> END\n",MOD);
#endif
end_ptr = ext + ext_len;
d_ptr = ext;
while( d_ptr < end_ptr )
{
search_pattern = (SEC_EXTENSTION_END_MARK *)d_ptr;
if(search_pattern->magic!=SEC_EXTENSION_HEADER_MAGIC)
{
SMSG(true,"[%s] Image extension header magic wrong\n",MOD);
return ERR_SIGN_FORMAT_EXT_HDR_MAGIC_WRONG;
}
switch(search_pattern->ext_type)
{
case SEC_EXT_HDR_CRYPTO:
ext_set->crypto = (SEC_EXTENSTION_CRYPTO *)d_ptr;
d_ptr += sizeof(SEC_EXTENSTION_CRYPTO);
break;
case SEC_EXT_HDR_FRAG_CFG:
ext_set->frag = (SEC_FRAGMENT_CFG *)d_ptr;
d_ptr += sizeof(SEC_FRAGMENT_CFG);
ext_set->hash_only = (SEC_EXTENSTION_HASH_ONLY **)ASF_MALLOC(ext_set->frag->frag_count*sizeof(SEC_EXTENSTION_HASH_ONLY *));
break;
case SEC_EXT_HDR_HASH_ONLY:
ext_set->hash_only[hash_only_idx] = (SEC_EXTENSTION_HASH_ONLY *)d_ptr;
d_ptr += sizeof(SEC_EXTENSTION_HASH_ONLY) + get_hash_size(ext_set->hash_only[hash_only_idx]->sub_type);
hash_only_idx++;
break;
case SEC_EXT_HDR_END_MARK:
ext_set->end = (SEC_EXTENSTION_END_MARK *)d_ptr;
d_ptr += sizeof(SEC_EXTENSTION_END_MARK);
break;
case SEC_EXT_HDR_HASH_SIG:
default:
SMSG(true,"[%s] Image header type not support %d\n",MOD,search_pattern->ext_type);
return ERR_SIGN_FORMAT_EXT_TYPE_NOT_SUPPORT;
}
}
if( ext_set->crypto == NULL || ext_set->frag == NULL || ext_set->hash_only == NULL || ext_set->end == NULL)
{
SMSG(true,"[%s] Some header is not searched\n",MOD);
return ERR_SIGN_FORMAT_EXT_HDR_NOT_FOUND;
}
return SEC_OK;
}
示例10: lib_verify
/**************************************************************************
* VERIFY SIGNATURE
**************************************************************************/
int lib_verify (uchar* data_buf, uint32 data_len, uchar* sig_buf, uint32 sig_len)
{
if (RSA_KEY_LEN != sig_len)
{
SMSG(true,"signature length is wrong (%d)\n",sig_len);
goto _err;
}
SMSG(true,"[%s] 0x%x,0x%x,0x%x,0x%x\n",MOD,data_buf[0],data_buf[1],data_buf[2],data_buf[3]);
/* hash the plain text */
sha1(data_buf, data_len, sha1sum);
/* verify this signature */
SMSG(true,"[%s] verify signature",MOD);
if( rsa_verify( &rsa, HASH_LEN, sha1sum, sig_buf ) != 0 )
{
SMSG(true, " ... failed\n" );
goto _err;
}
SMSG(true," ... pass\n");
return 0;
_err:
return -1;
}
示例11: seccfg_ver_verify
/******************************************************************************
* SECCFG VERSION CHECK
******************************************************************************/
int seccfg_ver_verify(void)
{
int ret = SEC_OK;
/* ----------------------------------- */
/* check seccfg magic */
/* ----------------------------------- */
if (SEC_CFG_MAGIC_NUM != seccfg.v1.magic_number) {
ret = ERR_SEC_CFG_MAGIC_INVALID;
goto _end;
}
/* ----------------------------------- */
/* check seccfg version */
/* ----------------------------------- */
switch (get_seccfg_ver()) {
case SECCFG_V1:
case SECCFG_V1_2:
SMSG(true, "[%s] seccfg id = %s\n", MOD, seccfg.v1.id);
if (0 != mcmp(seccfg.v1.id, SEC_CFG_BEGIN, SEC_CFG_BEGIN_LEN)) {
ret = ERR_SEC_CFG_INVALID_ID;
goto _end;
}
SMSG(true, "[%s] seccfg end pattern = 0x%x\n", MOD, seccfg.v1.end_pattern);
if (SEC_CFG_END_PATTERN != seccfg.v1.end_pattern) {
ret = ERR_SEC_CFG_INVALID_END_PATTERN;
goto _end;
}
break;
case SECCFG_V3:
SMSG(true, "[%s] seccfg id = %s\n", MOD, seccfg.v3.id);
if (0 != mcmp(seccfg.v3.id, SEC_CFG_BEGIN, SEC_CFG_BEGIN_LEN)) {
ret = ERR_SEC_CFG_INVALID_ID;
goto _end;
}
SMSG(true, "[%s] seccfg end pattern = 0x%x\n", MOD, seccfg.v3.end_pattern);
if (SEC_CFG_END_PATTERN != seccfg.v3.end_pattern) {
ret = ERR_SEC_CFG_INVALID_END_PATTERN;
goto _end;
}
break;
default:
ret = ERR_SEC_CFG_VERSION_INVALID;
goto _end;
}
_end:
return ret;
}
示例12: SLOG
void StringTest::test03()
{
SLOG(CLS_NAME, "test03");
FixedString<10> str = "1234567890";
try
{
str.copy("1234567890a");
SASSERT("01", false);
}
catch (Exception e)
{
SMSG(slog::INFO, e.getMessage());
SASSERT("01", true);
}
try
{
FixedString<10> str2 = "1234567890a";
SASSERT("02", false);
}
catch (Exception e)
{
SMSG(slog::INFO, e.getMessage());
SASSERT("02", true);
}
}
示例13: sec_lib_read_secro
/**************************************************************************
* [SECRO IMG]
**************************************************************************/
void sec_lib_read_secro (void)
{
#if SEC_ENV_ENABLE
U32 err;
U8 *buf = sec_util_get_secro_buf();
const U32 buf_len = sizeof(AND_SECROIMG_T);
const U32 ac_offset = sizeof(AND_AC_HEADER_T);
const U32 ac_len = sizeof(AND_AC_ANDRO_T) + sizeof(AND_AC_SV5_T);
const bAC = g_ROM_INFO.m_SEC_CTRL.m_secro_ac_en;
secroimg = NULL;
boot_arg_t *bootarg = (boot_arg_t*)BOOT_ARGUMENT_ADDR;
/* ---------------------- */
/* check status */
/* ---------------------- */
if(FALSE == seclib_sec_usbdl_enabled(TRUE))
{
SMSG("[%s] Don't read\n",MOD);
return ;
}
/* ---------------------- */
/* read secro image */
/* ---------------------- */
if(SEC_OK != (err = seclib_secroimg_read (buf, buf_len, ac_offset, ac_len, bAC)))
{
SMSG("[%s] read secroimg fail '0x%x'\n",MOD,err);
ASSERT (0);
}
else
{
secroimg = (AND_SECROIMG_T*) buf;
SMSG("[%s] secroimg '0x%x'\n",MOD, secroimg->m_andro.magic_number);
SMSG("[%s] secroimg '0x%x'\n",MOD, secroimg->m_sv5.magic_number);
/* ---------------------- */
/* check forbidden mode */
/* ---------------------- */
if(FALSE == factory_mode_valid())
{
/* ---------------------- */
/* set magic number */
/* ---------------------- */
bootarg->sec_limit.magic_num = SEC_LIMIT_MAGIC;
bootarg->sec_limit.forbid_mode = F_FACTORY_MODE;
}
}
#endif
}
示例14: KSemaphoreTimedWait
/* TimedWait
* block until a count becomes available
*
* "lock" [ IN ] - externally acquired lock
*
* "tm" [ IN, NULL OKAY ] - optional timeout where
* NULL means timeout value of 0
*/
LIB_EXPORT rc_t CC KSemaphoreTimedWait ( KSemaphore *self,
struct KLock *lock, struct timeout_t *tm )
{
if ( self == NULL )
return RC ( rcPS, rcSemaphore, rcWaiting, rcSelf, rcNull );
if ( self -> avail == 0 )
{
SMSG ( "%s[%p]: avail == 0\n", __func__, self );
if ( tm == NULL )
{
SMSG ( "%s[%p]: non-blocking mode - return timeout exhausted\n", __func__, self );
return RC ( rcPS, rcSemaphore, rcWaiting, rcTimeout, rcExhausted );
}
if ( ++ self -> waiting == 1 )
{
SMSG ( "%s[%p]: first waiter\n", __func__, self );
self -> requested = self -> min_requested = 1;
self -> uniform = true;
}
else if ( self -> requested != 1 )
{
SMSG ( "%s[%p]: multiple waiters ( %u )\n", __func__, self, self -> waiting );
self -> min_requested = 1;
self -> uniform = false;
}
do
{
rc_t rc;
SMSG ( "%s[%p]: wait on condition...\n", __func__, self );
rc = KConditionTimedWait ( self -> cond, lock, tm );
SMSG ( "%s[%p]:...done, rc = %R\n", __func__, self, rc );
if ( rc != 0 )
{
SMSG ( "%s[%p]: timed out - decrementing wait count\n", __func__, self );
-- self -> waiting;
return ResetRCContext ( rc, rcPS, rcSemaphore, rcWaiting );
}
SMSG ( "%s[%p]: condition signaled - avail = %lu\n", __func__, self, self -> avail );
}
while ( self -> avail == 0 );
SMSG ( "%s[%p]: finished waiting\n", __func__, self );
-- self -> waiting;
}
SMSG ( "%s[%p]: decrementing count from %lu\n", __func__, self, self -> avail );
-- self -> avail;
return 0;
}
示例15: sec_schip_enabled
/******************************************************************************
* CHECK IF SECURITY CHIP IS ENABLED
******************************************************************************/
int sec_schip_enabled(void)
{
if (TRUE == masp_hal_sbc_enabled()) {
SMSG(true, "SC\n");
return 1;
} else {
SMSG(true, "NSC\n");
return 0;
}
return 0;
}