TuyaOS
结构体 | 函数
tal_hash.h 文件参考

Common process - adapter the hash api provide by OS 更多...

#include "tuya_cloud_types.h"
#include "tkl_hash.h"
tal_hash.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

结构体

struct  tal_hash_mac_context_t
 

函数

OPERATE_RET tal_md5_create_init (TKL_HASH_HANDLE *ctx)
 This function Create&initializes a md5 context. 更多...
 
OPERATE_RET tal_md5_finish_ret (TKL_HASH_HANDLE ctx, UINT8_T output[16])
 This function finishes the md5 operation, and writes the result to the output buffer. 更多...
 
OPERATE_RET tal_md5_free (TKL_HASH_HANDLE ctx)
 This function clears a md5 context. 更多...
 
OPERATE_RET tal_md5_ret (const UINT8_T *input, size_t ilen, UINT8_T output[16])
 Output = MD5( input buffer ) 更多...
 
OPERATE_RET tal_md5_self_test (INT32_T verbose)
 
OPERATE_RET tal_md5_starts_ret (TKL_HASH_HANDLE ctx)
 This function starts a md5 checksum calculation. 更多...
 
OPERATE_RET tal_md5_update_ret (TKL_HASH_HANDLE ctx, const UINT8_T *input, size_t ilen)
 This function feeds an input buffer into an ongoing md5 checksum calculation. 更多...
 
OPERATE_RET tal_sha1_create_init (TKL_HASH_HANDLE *ctx)
 This function Create&initializes a sha1 context. 更多...
 
OPERATE_RET tal_sha1_finish_ret (TKL_HASH_HANDLE ctx, UINT8_T output[16])
 This function finishes the sha1 operation, and writes the result to the output buffer. 更多...
 
OPERATE_RET tal_sha1_free (TKL_HASH_HANDLE ctx)
 This function clears a sha1 context. 更多...
 
OPERATE_RET tal_sha1_mac (const UINT8_T *key, size_t keylen, const UINT8_T *input, size_t ilen, UINT8_T *output)
 This function calculates the SHA-256 MAC checksum of a buffer. 更多...
 
OPERATE_RET tal_sha1_mac_create_init (tal_hash_mac_context_t *hmac_handle)
 This function Create&initializes a sha1 maccontext. 更多...
 
OPERATE_RET tal_sha1_mac_finish (tal_hash_mac_context_t *hmac_handle, UINT8_T *output)
 This function finishes the sha1 mac operation, and writes the result to the output buffer. 更多...
 
OPERATE_RET tal_sha1_mac_free (tal_hash_mac_context_t *hmac_handle)
 This function clears a sha1 mac context. 更多...
 
OPERATE_RET tal_sha1_mac_self_test (INT32_T verbose)
 
OPERATE_RET tal_sha1_mac_starts (tal_hash_mac_context_t *hmac_handle, const UINT8_T *key, size_t keylen)
 This function starts a sha1 mac checksum calculation. 更多...
 
OPERATE_RET tal_sha1_mac_update (tal_hash_mac_context_t *hmac_handle, const UINT8_T *input, size_t ilen)
 This function feeds an input buffer into an ongoing sha1 mac checksum calculation. 更多...
 
OPERATE_RET tal_sha1_ret (const UINT8_T *input, size_t ilen, UINT8_T output[20])
 Output = sha1( input buffer ) 更多...
 
OPERATE_RET tal_sha1_self_test (INT32_T verbose)
 
OPERATE_RET tal_sha1_starts_ret (TKL_HASH_HANDLE ctx)
 This function starts a sha1 checksum calculation. 更多...
 
OPERATE_RET tal_sha1_update_ret (TKL_HASH_HANDLE ctx, const UINT8_T *input, size_t ilen)
 This function feeds an input buffer into an ongoing sha1 checksum calculation. 更多...
 
OPERATE_RET tal_sha256_create_init (TKL_HASH_HANDLE *ctx)
 This function Create&initializes a sha256 context. 更多...
 
OPERATE_RET tal_sha256_finish_ret (TKL_HASH_HANDLE ctx, UINT8_T output[32])
 This function finishes the sha256 operation, and writes the result to the output buffer. 更多...
 
OPERATE_RET tal_sha256_free (TKL_HASH_HANDLE ctx)
 This function clears a sha256 context. 更多...
 
OPERATE_RET tal_sha256_mac (const UINT8_T *key, size_t keylen, const UINT8_T *input, size_t ilen, UINT8_T *output)
 This function calculates the SHA-256 MAC checksum of a buffer. 更多...
 
OPERATE_RET tal_sha256_mac_create_init (tal_hash_mac_context_t *hmac_handle)
 This function Create&initializes a sha256 maccontext. 更多...
 
OPERATE_RET tal_sha256_mac_finish (tal_hash_mac_context_t *hmac_handle, UINT8_T *output)
 This function finishes the sha256 mac operation, and writes the result to the output buffer. 更多...
 
OPERATE_RET tal_sha256_mac_free (tal_hash_mac_context_t *hmac_handle)
 This function clears a sha256 mac context. 更多...
 
OPERATE_RET tal_sha256_mac_self_test (INT32_T verbose)
 
OPERATE_RET tal_sha256_mac_starts (tal_hash_mac_context_t *hmac_handle, const UINT8_T *key, size_t keylen)
 This function starts a sha256 mac checksum calculation. 更多...
 
OPERATE_RET tal_sha256_mac_update (tal_hash_mac_context_t *hmac_handle, const UINT8_T *input, size_t ilen)
 This function feeds an input buffer into an ongoing sha256 mac checksum calculation. 更多...
 
OPERATE_RET tal_sha256_ret (const UINT8_T *input, size_t ilen, UINT8_T output[32], INT32_T is224)
 This function calculates the SHA-224 or SHA-256 checksum of a buffer. 更多...
 
OPERATE_RET tal_sha256_self_test (INT32_T verbose)
 
OPERATE_RET tal_sha256_starts_ret (TKL_HASH_HANDLE ctx, INT32_T is224)
 This function starts a sha224 or sha256 checksum calculation. 更多...
 
OPERATE_RET tal_sha256_update_ret (TKL_HASH_HANDLE ctx, const UINT8_T *input, size_t ilen)
 This function feeds an input buffer into an ongoing sha256 checksum calculation. 更多...
 

详细描述

Common process - adapter the hash api provide by OS

版本
0.1
日期
2022-04-22

函数说明

◆ tal_md5_create_init()

OPERATE_RET tal_md5_create_init ( TKL_HASH_HANDLE *  ctx)

This function Create&initializes a md5 context.

参数
[out]ctxmd5 handle
注解
This API is used to create and init md5.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_md5_finish_ret()

OPERATE_RET tal_md5_finish_ret ( TKL_HASH_HANDLE  ctx,
UINT8_T  output[16] 
)

This function finishes the md5 operation, and writes the result to the output buffer.

参数
[in]ctxThe context to use. This must be initialized.
[out]outputThe sha224 or md5 checksum result. This must be a writable buffer of length 16 Bytes.
注解
This API is used to out md5 result.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_md5_free()

OPERATE_RET tal_md5_free ( TKL_HASH_HANDLE  ctx)

This function clears a md5 context.

参数
[in]ctxmd5 handle
注解
This API is used to release md5.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_md5_ret()

OPERATE_RET tal_md5_ret ( const UINT8_T *  input,
size_t  ilen,
UINT8_T  output[16] 
)

Output = MD5( input buffer )

参数
[in]inputbuffer holding the data
[in]ilenlength of the input data
[out]outputMD5 checksum result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_md5_starts_ret()

OPERATE_RET tal_md5_starts_ret ( TKL_HASH_HANDLE  ctx)

This function starts a md5 checksum calculation.

参数
[in]ctxThe context to use. This must be initialized.
注解
This API is used to start md5.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_md5_update_ret()

OPERATE_RET tal_md5_update_ret ( TKL_HASH_HANDLE  ctx,
const UINT8_T *  input,
size_t  ilen 
)

This function feeds an input buffer into an ongoing md5 checksum calculation.

参数
[in]ctxThe context to use. This must be initialized.
[in]inputThe buffer holding the data. This must be a readable buffer of length ilen Bytes.
[in]ilenThe length of the input data in Bytes.
注解
This API is used to update md5.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha1_create_init()

OPERATE_RET tal_sha1_create_init ( TKL_HASH_HANDLE *  ctx)

This function Create&initializes a sha1 context.

参数
[out]ctxsha1 handle
注解
This API is used to create and init sha1.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha1_finish_ret()

OPERATE_RET tal_sha1_finish_ret ( TKL_HASH_HANDLE  ctx,
UINT8_T  output[16] 
)

This function finishes the sha1 operation, and writes the result to the output buffer.

参数
[in]ctxThe context to use. This must be initialized.
[out]outputThe sha224 or sha1 checksum result. This must be a writable buffer of length 16 Bytes.
注解
This API is used to out sha1 result.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha1_free()

OPERATE_RET tal_sha1_free ( TKL_HASH_HANDLE  ctx)

This function clears a sha1 context.

参数
[in]ctxsha1 handle
注解
This API is used to release sha1.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha1_mac()

OPERATE_RET tal_sha1_mac ( const UINT8_T *  key,
size_t  keylen,
const UINT8_T *  input,
size_t  ilen,
UINT8_T *  output 
)

This function calculates the SHA-256 MAC checksum of a buffer.

The function allocates the context, performs the calculation, and frees the context.

The SHA-256 result is calculated as output = SHA-256 MAC.

参数
[in]keyThe buffer holding the data. This must be a readable buffer of length keylen Bytes.
[in]keylenThe length of the key data in Bytes.*
[in]inputThe buffer holding the data. This must be a readable buffer of length ilen Bytes.
[in]ilenThe length of the input data in Bytes.
[out]outputThe SHA-256 MAC checksum result. This must be a writable buffer of length 32 Bytes.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha1_mac_create_init()

OPERATE_RET tal_sha1_mac_create_init ( tal_hash_mac_context_t hmac_handle)

This function Create&initializes a sha1 maccontext.

参数
[out]hmac_handlesha1_mac handle
注解
This API is used to create and init sha1_mac.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha1_mac_finish()

OPERATE_RET tal_sha1_mac_finish ( tal_hash_mac_context_t hmac_handle,
UINT8_T *  output 
)

This function finishes the sha1 mac operation, and writes the result to the output buffer.

参数
[in]hmac_handleThe context to use. This must be initialized.
[out]outputThe sha1 mac checksum result. This must be a writable buffer of length 32 Bytes.
注解
This API is used to out sha1 mac result.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha1_mac_free()

OPERATE_RET tal_sha1_mac_free ( tal_hash_mac_context_t hmac_handle)

This function clears a sha1 mac context.

参数
[in]hmac_handlesha1 mac handle
注解
This API is used to release sha1.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha1_mac_starts()

OPERATE_RET tal_sha1_mac_starts ( tal_hash_mac_context_t hmac_handle,
const UINT8_T *  key,
size_t  keylen 
)

This function starts a sha1 mac checksum calculation.

参数
[in]hmac_handleThe context to use. This must be initialized.
[in]keykey
[in]keylenkeylen
注解
This API is used to start sha1 mac.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha1_mac_update()

OPERATE_RET tal_sha1_mac_update ( tal_hash_mac_context_t hmac_handle,
const UINT8_T *  input,
size_t  ilen 
)

This function feeds an input buffer into an ongoing sha1 mac checksum calculation.

参数
[in]hmac_handleThe context to use. This must be initialized.
[in]inputThe buffer holding the data. This must be a readable buffer of length ilen Bytes.
[in]ilenThe length of the input data in Bytes.
注解
This API is used to update sha1 mac.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha1_ret()

OPERATE_RET tal_sha1_ret ( const UINT8_T *  input,
size_t  ilen,
UINT8_T  output[20] 
)

Output = sha1( input buffer )

参数
[in]inputbuffer holding the data
[in]ilenlength of the input data
[out]outputsha1 checksum result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha1_starts_ret()

OPERATE_RET tal_sha1_starts_ret ( TKL_HASH_HANDLE  ctx)

This function starts a sha1 checksum calculation.

参数
[in]ctxThe context to use. This must be initialized.
注解
This API is used to start sha1.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha1_update_ret()

OPERATE_RET tal_sha1_update_ret ( TKL_HASH_HANDLE  ctx,
const UINT8_T *  input,
size_t  ilen 
)

This function feeds an input buffer into an ongoing sha1 checksum calculation.

参数
[in]ctxThe context to use. This must be initialized.
[in]inputThe buffer holding the data. This must be a readable buffer of length ilen Bytes.
[in]ilenThe length of the input data in Bytes.
注解
This API is used to update sha1.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha256_create_init()

OPERATE_RET tal_sha256_create_init ( TKL_HASH_HANDLE *  ctx)

This function Create&initializes a sha256 context.

参数
[out]ctxsha256 handle
注解
This API is used to create and init sha256.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha256_finish_ret()

OPERATE_RET tal_sha256_finish_ret ( TKL_HASH_HANDLE  ctx,
UINT8_T  output[32] 
)

This function finishes the sha256 operation, and writes the result to the output buffer.

参数
[in]ctxThe context to use. This must be initialized.
[out]outputThe sha224 or sha256 checksum result. This must be a writable buffer of length 32 Bytes.
注解
This API is used to out sha256 result.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha256_free()

OPERATE_RET tal_sha256_free ( TKL_HASH_HANDLE  ctx)

This function clears a sha256 context.

参数
[in]ctxsha256 handle
注解
This API is used to release sha256.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha256_mac()

OPERATE_RET tal_sha256_mac ( const UINT8_T *  key,
size_t  keylen,
const UINT8_T *  input,
size_t  ilen,
UINT8_T *  output 
)

This function calculates the SHA-256 MAC checksum of a buffer.

The function allocates the context, performs the calculation, and frees the context.

The SHA-256 result is calculated as output = SHA-256 MAC.

参数
[in]keyThe buffer holding the data. This must be a readable buffer of length keylen Bytes.
[in]keylenThe length of the key data in Bytes.*
[in]inputThe buffer holding the data. This must be a readable buffer of length ilen Bytes.
[in]ilenThe length of the input data in Bytes.
[out]outputThe SHA-256 MAC checksum result. This must be a writable buffer of length 32 Bytes.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha256_mac_create_init()

OPERATE_RET tal_sha256_mac_create_init ( tal_hash_mac_context_t hmac_handle)

This function Create&initializes a sha256 maccontext.

参数
[out]hmac_handlesha256_mac handle
注解
This API is used to create and init sha256_mac.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha256_mac_finish()

OPERATE_RET tal_sha256_mac_finish ( tal_hash_mac_context_t hmac_handle,
UINT8_T *  output 
)

This function finishes the sha256 mac operation, and writes the result to the output buffer.

参数
[in]hmac_handleThe context to use. This must be initialized.
[out]outputThe sha256 mac checksum result. This must be a writable buffer of length 32 Bytes.
注解
This API is used to out sha256 mac result.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha256_mac_free()

OPERATE_RET tal_sha256_mac_free ( tal_hash_mac_context_t hmac_handle)

This function clears a sha256 mac context.

参数
[in]hmac_handlesha256 mac handle
注解
This API is used to release sha256.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha256_mac_starts()

OPERATE_RET tal_sha256_mac_starts ( tal_hash_mac_context_t hmac_handle,
const UINT8_T *  key,
size_t  keylen 
)

This function starts a sha256 mac checksum calculation.

参数
[in]hmac_handleThe context to use. This must be initialized.
[in]keykey
[in]keylenkeylen
注解
This API is used to start sha256 mac.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha256_mac_update()

OPERATE_RET tal_sha256_mac_update ( tal_hash_mac_context_t hmac_handle,
const UINT8_T *  input,
size_t  ilen 
)

This function feeds an input buffer into an ongoing sha256 mac checksum calculation.

参数
[in]hmac_handleThe context to use. This must be initialized.
[in]inputThe buffer holding the data. This must be a readable buffer of length ilen Bytes.
[in]ilenThe length of the input data in Bytes.
注解
This API is used to update sha256 mac.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha256_ret()

OPERATE_RET tal_sha256_ret ( const UINT8_T *  input,
size_t  ilen,
UINT8_T  output[32],
INT32_T  is224 
)

This function calculates the SHA-224 or SHA-256 checksum of a buffer.

The function allocates the context, performs the calculation, and frees the context.

The SHA-256 result is calculated as output = SHA-256(input buffer).

参数
[in]inputThe buffer holding the data. This must be a readable buffer of length ilen Bytes.
[in]ilenThe length of the input data in Bytes.
[out]outputThe SHA-224 or SHA-256 checksum result. This must be a writable buffer of length 32 Bytes.
[in]is224Determines which function to use. This must be either 0 for SHA-256, or 1 for SHA-224.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha256_starts_ret()

OPERATE_RET tal_sha256_starts_ret ( TKL_HASH_HANDLE  ctx,
INT32_T  is224 
)

This function starts a sha224 or sha256 checksum calculation.

参数
[in]ctxThe context to use. This must be initialized.
[in]is224This determines which function to use. This must be either 0 for sha256, or 1 for sha224.
注解
This API is used to start sha256 or sha224.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tal_sha256_update_ret()

OPERATE_RET tal_sha256_update_ret ( TKL_HASH_HANDLE  ctx,
const UINT8_T *  input,
size_t  ilen 
)

This function feeds an input buffer into an ongoing sha256 checksum calculation.

参数
[in]ctxThe context to use. This must be initialized.
[in]inputThe buffer holding the data. This must be a readable buffer of length ilen Bytes.
[in]ilenThe length of the input data in Bytes.
注解
This API is used to update sha256 or sha224.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h