Files
kunlun/export/inc/utils/iot_sha1_api.h
2024-09-28 14:24:04 +08:00

72 lines
2.0 KiB
C

/****************************************************************************
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
be copied by any method or incorporated into another program without
the express written consent of Aerospace C.Power. This Information or any portion
thereof remains the property of Aerospace C.Power. The Information contained herein
is believed to be accurate and Aerospace C.Power assumes no responsibility or
liability for its use in any way and conveys no license or title under
any patent or copyright and makes no representation or warranty that this
Information is free from patent or copyright infringement.
****************************************************************************/
#ifndef IOT_SHA1_API_H
#define IOT_SHA1_API_H
/* os shim includes */
#include "os_types_api.h"
#ifdef __cplusplus
extern "C" {
#endif
/* sha1 hanlder */
typedef void *iot_sha1_h;
/**
* @brief: iot_sha1_start - SHA-1 start.
* @retval: sha1 hanlder -- start success.
* @retval: NULL -- start fail.
*/
iot_sha1_h iot_sha1_start(void);
/**
* @brief: iot_sha1_end - SHA-1 end.
* @param handle: SHA-1 hanlder.
*/
void iot_sha1_end(iot_sha1_h handle);
/**
* @brief: iot_sha1_update - SHA-1 process buffer update.
* @param handle: SHA-1 hanlder.
* @param data: buffer holding the data.
* @param len: length of data.
* @retval: ERR_OK -- update success.
* @retval: otherwise -- update fail.
*/
uint32_t iot_sha1_update(iot_sha1_h handle, const uint8_t *data,
uint32_t len);
/**
* @brief: iot_sha1_finish - SHA-1 final digest.
* @param handle: SHA-1 hanlder.
* @param data: cache SHA-1 checksum result.
* @param len: length of data.
* @retval: ERR_OK -- update success.
* @retval: otherwise -- update fail.
*/
uint32_t iot_sha1_finish(iot_sha1_h handle, uint8_t *data, uint32_t len);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* IOT_SHA1_API_H */