/** ****************************************************************************** * @file sts_cmox_hmac_sha.c * * @author Yunhorn (r) Technology Limited Application Team * * @brief Yunhorn (r) SmarToilets (r) HMAC-SHA1 Process file. * ****************************************************************************** * @attention * * Copyright (c) 2023 Yunhorn Technology Limited. * Copyright (c) 2023 Shenzhen Yunhorn Technology Co., Ltd. * All rights reserved. ****************************************************************************** */ #include "main.h" #include "string.h" #include "cmox_init.h" #include "cmox_low_level.h" #include "stm32wlxx_hal.h" #include "sts_cmox_hmac_sha.h" #include "yunhorn_sts_prd_conf.h" #include "sys_app.h" /* Private macros ------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ const uint8_t mKey[] = { 0x59,0x75,0x33,0x6e,0x31,0x48,0x34,0x4f,0x31,0x52,0x35,0x4e,0x39,0x53,0x32,0x54,0x36,0x53 }; uint8_t Computed_Tag_SHA1[YUNHORN_STS_AC_CODE_SIZE]={0x0}; extern volatile uint8_t sts_ac_code[YUNHORN_STS_AC_CODE_SIZE]; hmac_result_t hmac_result; uint32_t sts_hmac_verify(void) { uint8_t i=0; uint8_t uid[8]=""; uint32_t ret=0; hmac_result.ac_pass = 60; hmac_result.hmac_tag_size = 0; GetUniqueId(uid); ret = sts_hmac_sha1((const uint8_t *) mKey, sizeof(mKey), (const uint8_t*)(uid+4), 4, &hmac_result); for (i=0;ihmac_tag, Computed_Tag_SHA1, sizeof(Computed_Tag_SHA1)); hmac_result->hmac_tag_size = computed_size; return retval; } /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/