536 lines
		
	
	
		
			19 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			536 lines
		
	
	
		
			19 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_DSA_ASYNC_API_H_
 | ||
|  | #define _IOT_CRYPTO_DSA_ASYNC_API_H_
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | extern "C" { | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #include "iot_pkt_api.h"
 | ||
|  | #include "iot_crypto_error_api.h"
 | ||
|  | #include "iot_crypto_dsa_api.h"
 | ||
|  | 
 | ||
|  | /* crypto calculate type */ | ||
|  | #define IOT_CRYPTO_CALC_TYPE_INVALID                    0
 | ||
|  | #define IOT_CRYPTO_CALC_TYPE_SM2_SIGN                   1
 | ||
|  | #define IOT_CRYPTO_CALC_TYPE_SM2_VERIFY                 2
 | ||
|  | #define IOT_CRYPTO_CALC_TYPE_ECDSA_SHA256_SIGN          3
 | ||
|  | #define IOT_CRYPTO_CALC_TYPE_ECDSA_SHA256_VERIFY        4
 | ||
|  | #define IOT_CRYPTO_CALC_TYPE_SM2_KDF_GEN                5
 | ||
|  | #define IOT_CRYPTO_CALC_TYPE_SM2_KEYPAIR_GEN            6
 | ||
|  | #define IOT_CRYPTO_CALC_TYPE_ECDSA_KEYPAIR_GEN          7
 | ||
|  | #define IOT_CRYPTO_CALC_TYPE_SG_AUTH_SIGN               8
 | ||
|  | #define IOT_CRYPTO_CALC_TYPE_SG_AUTH_VERIRY             9
 | ||
|  | #define IOT_CRYPTO_CALC_TYPE_MAX                        10
 | ||
|  | 
 | ||
|  | /* sg id authentication random calculate type */ | ||
|  | #define IOT_CRYPTO_SG_RANDOM_SIGN_SM2                   0
 | ||
|  | #define IOT_CRYPTO_SG_RANDOM_SIGN_ECC                   1
 | ||
|  | #define IOT_CRYPTO_SG_RANDOM_VERIFY_SM2                 2
 | ||
|  | #define IOT_CRYPTO_SG_RANDOM_VERIFY_ECC                 3
 | ||
|  | 
 | ||
|  | /* save the pack status and set 1 byte align */ | ||
|  | #pragma pack(push)
 | ||
|  | #pragma pack(1)
 | ||
|  | 
 | ||
|  | typedef struct _iot_crypto_async_user_info { | ||
|  |     uint8_t info[40]; | ||
|  | } iot_crypto_async_user_info_t; | ||
|  | 
 | ||
|  | typedef struct _iot_crypto_async_hdr { | ||
|  |     /* crypto calculate type, see IOT_CRYPTO_CALC_TYPE_XXX */ | ||
|  |     uint8_t type; | ||
|  |     /* error code, see CRYPTO_RET_XXX */ | ||
|  |     uint8_t err_code; | ||
|  |     /* reserved */ | ||
|  |     uint16_t rsvd; | ||
|  |     /* user information */ | ||
|  |     iot_crypto_async_user_info_t user; | ||
|  | } iot_crypto_async_hdr_t; | ||
|  | 
 | ||
|  | typedef struct _iot_crypto_ret_sm2_sign { | ||
|  |     /* sm2 signature r */ | ||
|  |     uint8_t r[32]; | ||
|  |     /* sm2 signature s */ | ||
|  |     uint8_t s[32]; | ||
|  | } iot_crypto_ret_sm2_sign_t; | ||
|  | 
 | ||
|  | typedef struct _iot_crypto_ret_ecdsa_sha256_sign { | ||
|  |     /* ecdsa sha256 signature r */ | ||
|  |     uint8_t r[32]; | ||
|  |     /* ecdsa sha256 signature s */ | ||
|  |     uint8_t s[32]; | ||
|  | } iot_crypto_ret_ecdsa_sha256_sign_t; | ||
|  | 
 | ||
|  | typedef struct _iot_crypto_ret_sm2_gen_keypair_info_t { | ||
|  |     uint32_t pub_key_len; | ||
|  |     uint32_t pri_key_len; | ||
|  |     uint8_t pub_key[64]; | ||
|  |     uint8_t pri_key[32]; | ||
|  | } iot_crypto_ret_sm2_gen_keypair_info_t; | ||
|  | 
 | ||
|  | typedef struct _iot_crypto_ret_ecdsa_gen_keypair_info_t { | ||
|  |     ecdsa_ecp_t ecp; | ||
|  |     uint32_t pub_key_len; | ||
|  |     uint32_t pri_key_len; | ||
|  |     uint8_t pub_key[64]; | ||
|  |     uint8_t pri_key[32]; | ||
|  | } iot_crypto_ret_ecdsa_gen_keypair_info_t; | ||
|  | 
 | ||
|  | typedef struct _iot_crypto_ret_sm2_kdf_gen { | ||
|  |     /* sm2 kdf generate key length */ | ||
|  |     uint32_t len; | ||
|  |     /* sm2 kdf generate key buffer */ | ||
|  |     uint8_t key[0]; | ||
|  | } iot_crypto_ret_sm2_kdf_gen_t; | ||
|  | 
 | ||
|  | typedef struct _iot_crypto_ret_sg_auth_gen_key { | ||
|  |     /* indicate key[] buffer length */ | ||
|  |     uint16_t key_len; | ||
|  |     /* generate key buffer */ | ||
|  |     uint8_t key[0]; | ||
|  | } iot_crypto_ret_sg_auth_gen_key_t; | ||
|  | 
 | ||
|  | /* sg authentication signature async result */ | ||
|  | typedef struct _iot_crypto_ret_sg_sign_async { | ||
|  |     /* asynchronous signature result header */ | ||
|  |     iot_crypto_async_hdr_t async_hdr; | ||
|  |     union { | ||
|  |         /* random sm2 signature */ | ||
|  |         iot_crypto_ret_sm2_sign_t sm2_sign; | ||
|  |         /* random ecdsa sha256 signature */ | ||
|  |         iot_crypto_ret_ecdsa_sha256_sign_t sha256_sign; | ||
|  |     }; | ||
|  |     /* the key generated by sg authentication */ | ||
|  |     iot_crypto_ret_sg_auth_gen_key_t sg_gen_key; | ||
|  | } iot_crypto_ret_sg_sign_async_t; | ||
|  | 
 | ||
|  | /* sg authentication verify async result */ | ||
|  | typedef struct _iot_crypto_ret_sg_verify_async { | ||
|  |     /* asynchronous verfiy result header */ | ||
|  |     iot_crypto_async_hdr_t async_hdr; | ||
|  |     /* the key generated by sg authentication */ | ||
|  |     iot_crypto_ret_sg_auth_gen_key_t sg_gen_key; | ||
|  | } iot_crypto_ret_sg_verify_async_t; | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_crypto_async_func_t - crypto done callback function | ||
|  |  * | ||
|  |  * @param pkt: crypto done data pkt | ||
|  |  * @retval: none | ||
|  |  */ | ||
|  | typedef void (*iot_crypto_async_done_func_t)(iot_pkt_t *pkt); | ||
|  | 
 | ||
|  | /* restore the pack status */ | ||
|  | #pragma pack(pop)
 | ||
|  | 
 | ||
|  | #if IOT_CRYPTO_ASYNC_SUPPORT
 | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_crypto_ecdsa_with_sha256_sign_async() - ESDA signature for async, | ||
|  |  *      message hash algorithm is SHA256. | ||
|  |  *      asynchronous result data map: | ||
|  |  *      iot_crypto_async_hdr_t + iot_crypto_ret_ecdsa_sha256_sign_t | ||
|  |  * @param ecp: curve type, see ecdsa_ecp_t. | ||
|  |  * @param msg: message to be signed | ||
|  |  * @param len: message len | ||
|  |  * @param pri_key: private key | ||
|  |  * @param pri_key_len: private key len | ||
|  |  * @param cb: crypto done callback function | ||
|  |  * @param user: current crypto user info arguments | ||
|  |  * | ||
|  |  * @retval:error code. see CRYPTO_RET_XXX | ||
|  |  */ | ||
|  | uint32_t iot_crypto_ecdsa_with_sha256_sign_async( | ||
|  |     ecdsa_ecp_t ecp, const uint8_t *msg, uint32_t len, | ||
|  |     const uint8_t *pri_key, uint32_t pri_key_len, | ||
|  |     iot_crypto_async_done_func_t cb, iot_crypto_async_user_info_t *user); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_crypto_ecdsa_with_sha256_verify_async() - ESDA signature verify | ||
|  |  *      for async, message hash algorithm is SHA256. | ||
|  |  *      asynchronous result data map: | ||
|  |  *      iot_crypto_async_hdr_t | ||
|  |  * @param ecp: curve type, see ecdsa_ecp_t. | ||
|  |  * @param msg: original message to be signed verify | ||
|  |  * @param len: original message len | ||
|  |  * @param public_key: pointer public key | ||
|  |  * @param public_key_len: public key len | ||
|  |  * @param r_buf: signature info r part for verification | ||
|  |  * @param r_buf_len: r part len | ||
|  |  * @param s_buf: signature info s part for verification | ||
|  |  * @param s_buf_len: s part len | ||
|  |  * @param cb: crypto done callback function | ||
|  |  * @param user: current crypto user info arguments | ||
|  |  * | ||
|  |  * @retval:error code. see CRYPTO_RET_XXX | ||
|  |  */ | ||
|  | uint32_t iot_crypto_ecdsa_with_sha256_verify_async( | ||
|  |     ecdsa_ecp_t ecp, | ||
|  |     const uint8_t *msg, uint32_t len, | ||
|  |     const uint8_t *public_key, uint32_t public_key_len, | ||
|  |     const uint8_t *r_buf, uint32_t r_buf_len, | ||
|  |     const uint8_t *s_buf, uint32_t s_buf_len, | ||
|  |     iot_crypto_async_done_func_t cb, iot_crypto_async_user_info_t *user); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_crypto_sm2_sign_async() - sm2 signature for async with pub key and | ||
|  |  *      private key | ||
|  |  *      asynchronous result data map: | ||
|  |  *      iot_crypto_async_hdr_t + iot_crypto_ret_sm2_sign_t | ||
|  |  * @param message: original message to be signed | ||
|  |  * @param message_size: original message length | ||
|  |  * @param id: user id | ||
|  |  * @param id_len: user id length | ||
|  |  * @param public_key: pointer public key | ||
|  |  * @param public_key_len: public key len | ||
|  |  * @param private_key: pointer private key | ||
|  |  * @param private_key_len: private length | ||
|  |  * @param cb: crypto done callback function | ||
|  |  * @param user: current crypto user info arguments | ||
|  |  * | ||
|  |  * @retval:error code. see CRYPTO_RET_XXX | ||
|  |  */ | ||
|  | uint32_t iot_crypto_sm2_sign_async(uint8_t *message, uint32_t message_size, | ||
|  |     uint8_t *id, uint32_t id_len, uint8_t *public_key, uint32_t public_key_len, | ||
|  |     uint8_t *private_key, uint32_t private_key_len, | ||
|  |     iot_crypto_async_done_func_t cb, | ||
|  |     iot_crypto_async_user_info_t *user); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_crypto_sm2_verify_async() - sm2 verify for async with pub key | ||
|  |  *      asynchronous result data map: | ||
|  |  *      iot_crypto_async_hdr_t | ||
|  |  * @param message: original message to be signed | ||
|  |  * @param message_size: original message length | ||
|  |  * @param id: user id | ||
|  |  * @param id_len: user id length | ||
|  |  * @param public_key: pointer public key | ||
|  |  * @param public_key_len: public key len | ||
|  |  * @param r         signature r | ||
|  |  * @param rlen      signature r len | ||
|  |  * @param s         signature s | ||
|  |  * @param slen      signature s len | ||
|  |  * @param cb: crypto done callback function | ||
|  |  * @param user: current crypto user info arguments | ||
|  |  * | ||
|  |  * @retval:error code. see CRYPTO_RET_XXX | ||
|  |  */ | ||
|  | uint32_t iot_crypto_sm2_verify_async(uint8_t *message, uint32_t message_size, | ||
|  |     uint8_t *id, uint32_t id_len, uint8_t *public_key, uint32_t public_key_len, | ||
|  |     uint8_t *r, uint32_t rlen, uint8_t *s, uint32_t slen, | ||
|  |     iot_crypto_async_done_func_t cb, iot_crypto_async_user_info_t *user); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_crypto_sm2_gen_share_key_async() -  calc share key by pub key and | ||
|  |  *      private key | ||
|  |  *      asynchronous result data map: | ||
|  |  *      iot_crypto_async_hdr_t + iot_crypto_ret_sm2_kdf_gen_t | ||
|  |  * @param pub_key: public key, Fixed 64 bytes | ||
|  |  * @param pri_key: private key, Fixed 32 bytes | ||
|  |  * @param gen_key_len: the size of the gen_key | ||
|  |  * @param cb: crypto done callback function | ||
|  |  * @param user: current crypto user info arguments | ||
|  |  * | ||
|  |  * @retval:error code. see CRYPTO_RET_XXX | ||
|  |  */ | ||
|  | uint32_t iot_crypto_sm2_gen_share_key_async(uint8_t *pub_key, uint8_t *pri_key, | ||
|  |     uint32_t gen_key_len, iot_crypto_async_done_func_t cb, | ||
|  |     iot_crypto_async_user_info_t *user); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_crypto_sm2_gen_keypair_async() - sm2 generate pair key | ||
|  |  *      asynchronous result data map: | ||
|  |  *      iot_crypto_async_hdr_t + iot_crypto_ret_sm2_gen_keypair_info_t | ||
|  |  * @param cb: crypto done callback function | ||
|  |  * @param user: current crypto user info arguments | ||
|  |  * | ||
|  |  * @retval:error code. see CRYPTO_RET_XXX | ||
|  |  */ | ||
|  | uint32_t iot_crypto_sm2_gen_keypair_async( | ||
|  |     iot_crypto_async_done_func_t cb, iot_crypto_async_user_info_t *user); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_crypto_sm2_gen_keypair_async() - sm2 generate pair key | ||
|  |  *      asynchronous result data map: | ||
|  |  *      iot_crypto_async_hdr_t + iot_crypto_ret_sm2_gen_keypair_info_t | ||
|  |  * @param ecp: curve type, see ecdsa_ecp_t | ||
|  |  * @param cb: crypto done callback function | ||
|  |  * @param user: current crypto user info arguments | ||
|  |  * | ||
|  |  * @retval:error code. see CRYPTO_RET_XXX | ||
|  |  */ | ||
|  | uint32_t iot_crypto_ecdsa_gen_keypair_async(ecdsa_ecp_t ecp, | ||
|  |     iot_crypto_async_done_func_t cb, iot_crypto_async_user_info_t *user); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_crypto_sg_auth_random_sign_async() -  calculate identity | ||
|  |  *      authentication for sg security authentication(random signature). | ||
|  |  *      asynchronous result data map: | ||
|  |  *          iot_crypto_ret_sg_sign_async_t | ||
|  |  * @param root_pub: root public key | ||
|  |  * @param root_pub_len: root public key length | ||
|  |  * @param auth_chip_id: the chip id of the certificate to be authenticated | ||
|  |  * @param auth_chip_id_len: auth_chip_id data length | ||
|  |  * @param auth_ecp: the elliptic curve type of the certificate to be | ||
|  |  *      authenticated, see ecdsa_ecp_t. | ||
|  |  * @param auth_pub: the public key of the certificate to be authenticated | ||
|  |  * @param auth_pub_len: auth_pub data length | ||
|  |  * @param auth_sign: the signature of the certificate to be authenticated | ||
|  |  * @param auth_sign_len: auth_sign data length | ||
|  |  * @param gen_key_len: generate share key length | ||
|  |  * @param random_type: indicate random and random_sign means, | ||
|  |  *      see IOT_CRYPTO_SG_RANDOM_SIGN_XXX. | ||
|  |  * @param random: random data address | ||
|  |  * @param random_len: random data length | ||
|  |  * @param local_ecp: the elliptic curve type of the local device certificate | ||
|  |  * @param local_pub: the public key of the local device certificate | ||
|  |  * @param local_pub_len: local_pub data length | ||
|  |  * @param local_pri: the private key of the local device certificate | ||
|  |  * @param local_pri_len: local_pri data length | ||
|  |  * @param sm2_id: sm2 user id | ||
|  |  * @param sm2_id_len: sm2 user id length | ||
|  |  * @param cb: crypto done callback function | ||
|  |  * @param user: current crypto user info arguments | ||
|  |  * | ||
|  |  * @retval:error code. see CRYPTO_RET_XXX | ||
|  |  */ | ||
|  | uint32_t iot_crypto_sg_auth_random_sign_async( | ||
|  |     uint8_t *root_pub, uint32_t root_pub_len, | ||
|  |     uint8_t *auth_chip_id, uint32_t auth_chip_id_len, | ||
|  |     ecdsa_ecp_t auth_ecp, uint8_t *auth_pub, uint32_t auth_pub_len, | ||
|  |     uint8_t *auth_sign, uint32_t auth_sign_len, | ||
|  |     uint16_t gen_key_len, uint8_t random_type, | ||
|  |     uint8_t *random, uint32_t random_len, | ||
|  |     ecdsa_ecp_t local_ecp, uint8_t *local_pub, uint32_t local_pub_len, | ||
|  |     uint8_t *local_pri, uint32_t local_pri_len, | ||
|  |     uint8_t *sm2_id, uint8_t sm2_id_len, | ||
|  |     iot_crypto_async_done_func_t cb, | ||
|  |     iot_crypto_async_user_info_t *user); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_crypto_sg_auth_random_verify_async() -  calculate identity | ||
|  |  *      authentication for sg security authentication(random verify). | ||
|  |  *      asynchronous result data map: | ||
|  |  *          iot_crypto_ret_sg_verify_async_t | ||
|  |  * @param root_pub: root public key | ||
|  |  * @param root_pub_len: root public key length | ||
|  |  * @param auth_chip_id: the chip id of the certificate to be authenticated | ||
|  |  * @param auth_chip_id_len: auth_chip_id data length | ||
|  |  * @param auth_ecp: the elliptic curve type of the certificate to be | ||
|  |  *      authenticated, see ecdsa_ecp_t. | ||
|  |  * @param auth_pub: the public key of the certificate to be authenticated | ||
|  |  * @param auth_pub_len: auth_pub data length | ||
|  |  * @param auth_sign: the signature of the certificate to be authenticated | ||
|  |  * @param auth_sign_len: auth_sign data length | ||
|  |  * @param gen_key_len: generate share key length | ||
|  |  * @param random_type: indicate random and random_sign means, | ||
|  |  *      see /IOT_CRYPTO_SG_RANDOM_VERIFY_XXX. | ||
|  |  * @param random: random data address | ||
|  |  * @param random_len: random data length | ||
|  |  * @param ramdom_sign: signatures data address | ||
|  |  * @param random_sign_len: ramdom_sign data length | ||
|  |  * @param local_ecp: the elliptic curve type of the local device certificate | ||
|  |  * @param local_pub: the public key of the local device certificate | ||
|  |  * @param local_pub_len: local_pub data length | ||
|  |  * @param local_pri: the private key of the local device certificate | ||
|  |  * @param local_pri_len: local_pri data length | ||
|  |  * @param sm2_id: sm2 user id | ||
|  |  * @param sm2_id_len: sm2 user id length | ||
|  |  * @param cb: crypto done callback function | ||
|  |  * @param user: current crypto user info arguments | ||
|  |  * | ||
|  |  * @retval:error code. see CRYPTO_RET_XXX | ||
|  |  */ | ||
|  | uint32_t iot_crypto_sg_auth_random_verify_async( | ||
|  |     uint8_t *root_pub, uint32_t root_pub_len, | ||
|  |     uint8_t *auth_chip_id, uint32_t auth_chip_id_len, | ||
|  |     ecdsa_ecp_t auth_ecp, uint8_t *auth_pub, uint32_t auth_pub_len, | ||
|  |     uint8_t *auth_sign, uint32_t auth_sign_len, | ||
|  |     uint16_t gen_key_len, uint8_t random_verify_type, | ||
|  |     uint8_t *random, uint32_t random_len, | ||
|  |     uint8_t *ramdom_sign, uint32_t random_sign_len, | ||
|  |     ecdsa_ecp_t local_ecp, uint8_t *local_pub, uint32_t local_pub_len, | ||
|  |     uint8_t *local_pri, uint32_t local_pri_len, | ||
|  |     uint8_t *sm2_id, uint8_t sm2_id_len, | ||
|  |     iot_crypto_async_done_func_t cb, | ||
|  |     iot_crypto_async_user_info_t *user); | ||
|  | 
 | ||
|  | #else /* IOT_CRYPTO_ASYNC_SUPPORT */
 | ||
|  | 
 | ||
|  | #define iot_crypto_ecdsa_with_sha256_sign_async(ecp, msg, len, pri_key, \
 | ||
|  |     pri_key_len, cb, user)  \ | ||
|  |     (void)(CRYPTO_RET_NOSUPP); \ | ||
|  |     do { \ | ||
|  |         (void)ecp; \ | ||
|  |         (void)msg; \ | ||
|  |         (void)len; \ | ||
|  |         (void)pri_key; \ | ||
|  |         (void)pri_key_len; \ | ||
|  |         (void)cb; \ | ||
|  |         (void)user; \ | ||
|  |     } while(0) | ||
|  | 
 | ||
|  | #define iot_crypto_ecdsa_with_sha256_verify_async(ecp, msg, len, public_key, \
 | ||
|  |     public_key_len, r_buf, r_buf_len, s_buf, s_buf_len, cb, user) \ | ||
|  |     (void)(CRYPTO_RET_NOSUPP); \ | ||
|  |     do { \ | ||
|  |         (void)ecp; \ | ||
|  |         (void)msg; \ | ||
|  |         (void)len; \ | ||
|  |         (void)public_key; \ | ||
|  |         (void)public_key_len; \ | ||
|  |         (void)r_buf; \ | ||
|  |         (void)r_buf_len; \ | ||
|  |         (void)s_buf; \ | ||
|  |         (void)s_buf_len; \ | ||
|  |         (void)cb; \ | ||
|  |         (void)user; \ | ||
|  |     } while(0) | ||
|  | 
 | ||
|  | #define iot_crypto_sm2_sign_async(message, message_size, ID, ID_len, \
 | ||
|  |     public_key, public_key_len, private_key, private_key_len, cb, user) \ | ||
|  |     (CRYPTO_RET_NOSUPP); \ | ||
|  |     do { \ | ||
|  |         (void)message; \ | ||
|  |         (void)message_size; \ | ||
|  |         (void)ID; \ | ||
|  |         (void)ID_len; \ | ||
|  |         (void)public_key; \ | ||
|  |         (void)private_key_len; \ | ||
|  |         (void)private_key; \ | ||
|  |         (void)private_key_len; \ | ||
|  |         (void)cb; \ | ||
|  |         (void)user; \ | ||
|  |     } while(0); | ||
|  | 
 | ||
|  | #define iot_crypto_sm2_verify_async(message, message_size, ID, ID_len, \
 | ||
|  |     public_key, public_key_len, r, rlen, s, slen, cb, user) \ | ||
|  |     (void)(CRYPTO_RET_NOSUPP); \ | ||
|  |     do { \ | ||
|  |         (void)message; \ | ||
|  |         (void)message_size; \ | ||
|  |         (void)ID; \ | ||
|  |         (void)ID_len; \ | ||
|  |         (void)public_key; \ | ||
|  |         (void)public_key_len; \ | ||
|  |         (void)r; \ | ||
|  |         (void)rlen; \ | ||
|  |         (void)s; \ | ||
|  |         (void)slen; \ | ||
|  |         (void)cb; \ | ||
|  |         (void)user; \ | ||
|  |     } while(0); | ||
|  | 
 | ||
|  | #define iot_crypto_sm2_gen_share_key_async(pub_key, pri_key, gen_key_len, \
 | ||
|  |     cb, user) \ | ||
|  |     (void)(CRYPTO_RET_NOSUPP); \ | ||
|  |     do { \ | ||
|  |         (void)pub_key; \ | ||
|  |         (void)pri_key; \ | ||
|  |         (void)gen_key_len; \ | ||
|  |         (void)cb; \ | ||
|  |         (void)user; \ | ||
|  |     } while(0); | ||
|  | 
 | ||
|  | #define iot_crypto_sm2_gen_keypair_async(cb, user) \
 | ||
|  |     (void)(CRYPTO_RET_NOSUPP); \ | ||
|  |     do { \ | ||
|  |         (void)cb; \ | ||
|  |         (void)user; \ | ||
|  |     } while(0); | ||
|  | 
 | ||
|  | #define iot_crypto_ecdsa_gen_keypair_async(ecp, cb, user) \
 | ||
|  |     (void)(CRYPTO_RET_NOSUPP); \ | ||
|  |     do { \ | ||
|  |         (void)ecp; \ | ||
|  |         (void)cb; \ | ||
|  |         (void)user; \ | ||
|  |     } while(0); | ||
|  | 
 | ||
|  | #define iot_crypto_sg_auth_random_sign_async( \
 | ||
|  |     root_pub, root_pub_len, auth_chip_id, auth_chip_id_len, \ | ||
|  |     auth_ecp, auth_pub, auth_pub_len, auth_sign, auth_sign_len, \ | ||
|  |     gen_key_len, random_type, random, random_len, \ | ||
|  |     local_ecp, local_pub, local_pub_len, \ | ||
|  |     local_pri, local_pri_len, sm2_id, sm2_id_len, \ | ||
|  |     cb, user) \ | ||
|  |     (CRYPTO_RET_NOSUPP); \ | ||
|  |     do { \ | ||
|  |         (void)root_pub; \ | ||
|  |         (void)root_pub_len; \ | ||
|  |         (void)auth_chip_id; \ | ||
|  |         (void)auth_chip_id_len; \ | ||
|  |         (void)auth_ecp; \ | ||
|  |         (void)auth_pub; \ | ||
|  |         (void)auth_pub_len; \ | ||
|  |         (void)auth_sign; \ | ||
|  |         (void)auth_sign_len; \ | ||
|  |         (void)gen_key_len; \ | ||
|  |         (void)random_type; \ | ||
|  |         (void)random; \ | ||
|  |         (void)random_len; \ | ||
|  |         (void)local_ecp; \ | ||
|  |         (void)local_pub; \ | ||
|  |         (void)local_pub_len; \ | ||
|  |         (void)local_pri; \ | ||
|  |         (void)local_pri_len; \ | ||
|  |         (void)cb; \ | ||
|  |         (void)user; \ | ||
|  |     } while(0) | ||
|  | 
 | ||
|  | #define iot_crypto_sg_auth_random_verify_async( \
 | ||
|  |     root_pub, root_pub_len, auth_chip_id, auth_chip_id_len, \ | ||
|  |     auth_ecp, auth_pub, auth_pub_len, auth_sign, auth_sign_len, \ | ||
|  |     gen_key_len, random_type, random, random_len, \ | ||
|  |     ramdom_sign, random_sign_len, local_ecp, local_pub, local_pub_len, \ | ||
|  |     local_pri, local_pri_len, sm2_id, sm2_id_len, \ | ||
|  |     cb, user) \ | ||
|  |     (CRYPTO_RET_NOSUPP); \ | ||
|  |     do { \ | ||
|  |         (void)root_pub; \ | ||
|  |         (void)root_pub_len; \ | ||
|  |         (void)auth_chip_id; \ | ||
|  |         (void)auth_chip_id_len; \ | ||
|  |         (void)auth_ecp; \ | ||
|  |         (void)auth_pub; \ | ||
|  |         (void)auth_pub_len; \ | ||
|  |         (void)auth_sign; \ | ||
|  |         (void)auth_sign_len; \ | ||
|  |         (void)gen_key_len; \ | ||
|  |         (void)random_type; \ | ||
|  |         (void)random; \ | ||
|  |         (void)random_len; \ | ||
|  |         (void)ramdom_sign; \ | ||
|  |         (void)random_sign_len; \ | ||
|  |         (void)local_ecp; \ | ||
|  |         (void)local_pub; \ | ||
|  |         (void)local_pub_len; \ | ||
|  |         (void)local_pri; \ | ||
|  |         (void)local_pri_len; \ | ||
|  |         (void)cb; \ | ||
|  |         (void)user; \ | ||
|  |     } while(0) | ||
|  | 
 | ||
|  | #endif /* IOT_CRYPTO_ASYNC_SUPPORT */
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | } | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #endif /* _IOT_CRYPTO_DSA_ASYNC_API_H_ */
 |