1 /* 2 * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef IOT_HMAC_H 17 #define IOT_HMAC_H 18 /** 19 * This function used to generate the passwd for the mqtt to connect the HW IoT platform 20 * @param content: This is the content for the hmac, 21 * and usually it is the device passwd set or get from the Iot Platform 22 * @param content_len: The length of the content 23 * @param key: This is the key for the hmac, and usually it is the time used in the client_id: 24 * the format is:yearmonthdatehour:like 1970010100 25 * @param key_len: The length of the key 26 * @param buf: used to storage the hmac code 27 * @param buf_len:the buf length 28 * @return:0 success while others failed 29 */ 30 int HmacGeneratePwd(const unsigned char *content, int contentLen, const unsigned char *key, 31 int keyLen, unsigned char *buf); 32 #endif