99 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			99 lines
		
	
	
		
			2.7 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_CRYPTO_HASH_API_H
							 | 
						||
| 
								 | 
							
								#define IOT_CRYPTO_HASH_API_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "iot_crypto_error_api.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/** \defgroup CRYPTO_APIs CRYPTO APIs
							 | 
						||
| 
								 | 
							
								  */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/** @addtogroup CRYPTO_APIs
							 | 
						||
| 
								 | 
							
								  * @{
							 | 
						||
| 
								 | 
							
								  */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief iot_crypto_sha224() - SHA224
							 | 
						||
| 
								 | 
							
								 * @param input:         input buffer
							 | 
						||
| 
								 | 
							
								 * @param ilen:          buffer len
							 | 
						||
| 
								 | 
							
								 * @param output:        output buffer
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @retval:              error code. see CRYPTO_RET_XXX
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t iot_crypto_sha224(const uint8_t *input, uint32_t ilen,
							 | 
						||
| 
								 | 
							
								    uint8_t output[28]);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief iot_crypto_sha256() - SHA256
							 | 
						||
| 
								 | 
							
								 * @param input:         input buffer
							 | 
						||
| 
								 | 
							
								 * @param ilen:          buffer len
							 | 
						||
| 
								 | 
							
								 * @param output:        output buffer
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @retval:              error code. see CRYPTO_RET_XXX
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t iot_crypto_sha256(const uint8_t *input, uint32_t ilen,
							 | 
						||
| 
								 | 
							
								    uint8_t output[32]);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief iot_crypto_sha384() - SHA384
							 | 
						||
| 
								 | 
							
								 * @param input:         input buffer
							 | 
						||
| 
								 | 
							
								 * @param ilen:          buffer len
							 | 
						||
| 
								 | 
							
								 * @param output:        output buffer
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @retval:              error code. see CRYPTO_RET_XXX
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t iot_crypto_sha384( const uint8_t *input, size_t ilen,
							 | 
						||
| 
								 | 
							
								    uint8_t output[48]);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief iot_crypto_sha512() - SHA512
							 | 
						||
| 
								 | 
							
								 * @param input:         input buffer
							 | 
						||
| 
								 | 
							
								 * @param ilen:          buffer len
							 | 
						||
| 
								 | 
							
								 * @param output:        output buffer
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @retval:              error code. see CRYPTO_RET_XXX
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t iot_crypto_sha512( const uint8_t *input, size_t ilen,
							 | 
						||
| 
								 | 
							
								    uint8_t output[64]);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief iot_crypto_sm3
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @param indata:           input data
							 | 
						||
| 
								 | 
							
								 * @param indata_len:       inbuffer len
							 | 
						||
| 
								 | 
							
								 * @param outdata:          output data
							 | 
						||
| 
								 | 
							
								 * @param outdata_len:      output len
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @retval:                 error code. see CRYPTO_RET_XXX
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t iot_crypto_sm3(uint8_t *indata, uint32_t indata_len,
							 | 
						||
| 
								 | 
							
								    uint8_t *outdata, uint32_t outdata_len);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								  * @}
							 | 
						||
| 
								 | 
							
								  */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif //IOT_CRYPTO_HASH_API_H
							 |