minor change

This commit is contained in:
Yunhorn 2023-06-28 19:01:17 +08:00
parent 39a2eb6ab3
commit 6055588ceb
2 changed files with 4 additions and 4 deletions

View File

@ -40,7 +40,7 @@ uint32_t sts_hmac_verify(void)
hmac_result.ac_pass = 60; hmac_result.ac_pass = 60;
hmac_result.hmac_tag_size = 0; hmac_result.hmac_tag_size = 0;
GetUniqueId(uid); GetUniqueId(uid);
APP_LOG(TS_OFF, VLEVEL_M, "\r\nUID=%02x %02x %02x %02x\r\n",uid[4],uid[5],uid[6],uid[7]);
ret = sts_hmac_sha1((const uint8_t *) mKey, sizeof(mKey), (const uint8_t*)(uid+4), 4, &hmac_result); ret = sts_hmac_sha1((const uint8_t *) mKey, sizeof(mKey), (const uint8_t*)(uid+4), 4, &hmac_result);
for (i=0;i<sizeof(Computed_Tag_SHA1); i++) { for (i=0;i<sizeof(Computed_Tag_SHA1); i++) {
APP_LOG(TS_OFF,VLEVEL_M,"0x%02x ", hmac_result.hmac_tag[i]); APP_LOG(TS_OFF,VLEVEL_M,"0x%02x ", hmac_result.hmac_tag[i]);
@ -50,12 +50,12 @@ uint32_t sts_hmac_verify(void)
if (ret !=0) if (ret !=0)
{ {
hmac_result.ac_pass =0; hmac_result.ac_pass =0U;
APP_LOG(TS_OFF, VLEVEL_M, "\r\nHMAC Verify Error \r\n"); APP_LOG(TS_OFF, VLEVEL_M, "\r\nHMAC Verify Error \r\n");
} else } else
{ {
ret =0; ret =0;
hmac_result.ac_pass = 1; hmac_result.ac_pass = 1U;
APP_LOG(TS_OFF, VLEVEL_M, "\r\nHMAC Verify Success\r\n"); APP_LOG(TS_OFF, VLEVEL_M, "\r\nHMAC Verify Success\r\n");
} }
return ret; return ret;

View File

@ -48,7 +48,7 @@
/* USER CODE BEGIN EV */ /* USER CODE BEGIN EV */
extern volatile uint8_t sts_service_mask; extern volatile uint8_t sts_service_mask;
extern volatile uint32_t rfac_timer; extern volatile uint32_t rfac_timer;
volatile uint8_t sts_ac_code[YUNHORN_STS_AC_CODE_SIZE]=""; volatile uint8_t sts_ac_code[YUNHORN_STS_AC_CODE_SIZE]={0x0};
extern hmac_result_t hmac_result; extern hmac_result_t hmac_result;
volatile uint8_t sts_work_mode =0; volatile uint8_t sts_work_mode =0;
//volatile uint32_t SamplingPeriodicity = 15000; //unit ms //volatile uint32_t SamplingPeriodicity = 15000; //unit ms