minor update

This commit is contained in:
Yunhorn 2023-06-28 19:00:47 +08:00
parent 56e0b1540b
commit 18ac578373
2 changed files with 6 additions and 4 deletions

View File

@ -17,6 +17,7 @@
#include "cmox_low_level.h" #include "cmox_low_level.h"
#include "stm32wlxx_hal.h" #include "stm32wlxx_hal.h"
#include "sts_cmox_hmac_sha.h" #include "sts_cmox_hmac_sha.h"
#include "yunhorn_sts_prd_conf.h"
#include "sys_app.h" #include "sys_app.h"
/* Private macros ------------------------------------------------------------*/ /* Private macros ------------------------------------------------------------*/
@ -27,8 +28,8 @@ const uint8_t mKey[] =
0x59,0x75,0x33,0x6e,0x31,0x48,0x34,0x4f,0x31,0x52,0x35,0x4e,0x39,0x53,0x32,0x54,0x36,0x53 0x59,0x75,0x33,0x6e,0x31,0x48,0x34,0x4f,0x31,0x52,0x35,0x4e,0x39,0x53,0x32,0x54,0x36,0x53
}; };
uint8_t Computed_Tag_SHA1[20]={0x0}; uint8_t Computed_Tag_SHA1[YUNHORN_STS_AC_CODE_SIZE]={0x0};
extern volatile uint8_t sts_ac_code[20]; extern volatile uint8_t sts_ac_code[YUNHORN_STS_AC_CODE_SIZE];
hmac_result_t hmac_result; hmac_result_t hmac_result;
uint32_t sts_hmac_verify(void) uint32_t sts_hmac_verify(void)
@ -39,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_H, "\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_H,"0x%02x ", hmac_result.hmac_tag[i]); APP_LOG(TS_OFF,VLEVEL_H,"0x%02x ", hmac_result.hmac_tag[i]);

View File

@ -45,12 +45,13 @@
/* External variables ---------------------------------------------------------*/ /* External variables ---------------------------------------------------------*/
/* USER CODE BEGIN EV */ /* USER CODE BEGIN EV */
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]={0x0}; volatile uint8_t sts_ac_code[YUNHORN_STS_AC_CODE_SIZE]={0x0};
extern hmac_result_t hmac_result; extern hmac_result_t hmac_result;
extern volatile uint8_t sts_reed_hall_ext_int; extern volatile uint8_t sts_reed_hall_ext_int;
extern volatile uint8_t sts_work_mode, sts_cloud_netcolor, sts_lamp_bar_color, sts_status_color; extern volatile uint8_t sts_work_mode, sts_cloud_netcolor, sts_lamp_bar_color, sts_status_color;
extern volatile uint8_t sts_service_mask;
volatile uint8_t sts_fall_detection_acc_threshold = 10, sts_fall_detection_depth_threshold=30, sts_occupancy_overtime_threshold=20; volatile uint8_t sts_fall_detection_acc_threshold = 10, sts_fall_detection_depth_threshold=30, sts_occupancy_overtime_threshold=20;
extern volatile uint32_t event_start_time, event_stop_time; extern volatile uint32_t event_start_time, event_stop_time;
volatile uint8_t sts_occupancy_overtime_state = 0; volatile uint8_t sts_occupancy_overtime_state = 0;