19#define SM9_MAX_ID_BYTE_LEN (1 << 13)
20#define SM9_MAX_MSG_BYTE_LEN (0xFFFFFF9F)
21#define SM9_MAX_ENC_K2_BYTE_LEN (0x40)
22#define SM9_POINT_NOT_COMPRESSED (0x04)
60 uint8_t hid, uint8_t ks[32], uint8_t dsA[64]);
62uint32_t
sm9_sign(
const uint8_t *M, uint32_t MByteLen,
63 const uint8_t Ppub_s[128],
const uint8_t dsA[64],
64 uint8_t r[32], uint8_t h[32], uint8_t S[65]);
66uint32_t
sm9_verify(
const uint8_t *M, uint32_t MByteLen,
const uint8_t *IDA,
67 uint32_t IDA_byteLen, uint8_t hid,
68 const uint8_t Ppub_s[128],
const uint8_t h[32],
77 uint8_t hid, uint8_t ke[32], uint8_t deB[128]);
79uint32_t
sm9_wrap_key(
const uint8_t *IDB, uint32_t IDB_byteLen, uint8_t hid,
80 const uint8_t Ppub_e[64], uint8_t r[32], uint8_t C[64],
81 uint32_t KByteLen, uint8_t *K);
84 const uint8_t deB[128],
const uint8_t C[64],
85 uint32_t KByteLen, uint8_t *K);
87uint32_t
sm9_enc(
const uint8_t *IDB, uint32_t IDB_byteLen, uint8_t hid,
88 const uint8_t *M, uint32_t MByteLen,
const uint8_t Ppub_e[64],
93uint32_t
sm9_dec(
const uint8_t *IDB, uint32_t IDB_byteLen,
const uint8_t *C,
94 uint32_t CByteLen,
const uint8_t deB[128],
96 uint32_t K2ByteLen, uint8_t *M, uint32_t *MByteLen);
104 uint8_t hid, uint8_t ke[32],
108 const uint8_t *IDB, uint32_t IDB_byteLen, uint8_t hid,
109 const uint8_t Ppub_e[64], uint8_t rA[32], uint8_t RA[64]);
112 uint8_t hid,
const uint8_t Ppub_e[64],
113 uint8_t rA[32], uint8_t RA[64]);
116 uint32_t IDA_byteLen,
const uint8_t *IDB,
117 uint32_t IDB_byteLen,
const uint8_t Ppub_e[64],
118 const uint8_t deA[128],
const uint8_t rA[32],
119 const uint8_t RA[64],
const uint8_t RB[64],
120 uint32_t kByteLen, uint8_t *KA, uint8_t S1[32],
Semidrive CRYPTO pke header file.
uint32_t sm9_sign_gen_mastPubKey_from_mastPriKey(uint8_t ks[32], uint8_t Ppub_s[128])
sm9_enc_type_e
Definition: sm9.h:39
@ SM9_ENC_KDF_BLOCK_CIPHER
Definition: sm9.h:41
@ SM9_ENC_KDF_STREAM_CIPHER
Definition: sm9.h:40
uint32_t sm9_exckey_gen_mastPubKey_from_mastPriKey(uint8_t ke[32], uint8_t Ppub_e[64])
uint32_t sm9_exchangekey(sm9_exchange_role_e role, const uint8_t *IDA, uint32_t IDA_byteLen, const uint8_t *IDB, uint32_t IDB_byteLen, const uint8_t Ppub_e[64], const uint8_t deA[128], const uint8_t rA[32], const uint8_t RA[64], const uint8_t RB[64], uint32_t kByteLen, uint8_t *KA, uint8_t S1[32], uint8_t SA[32])
uint32_t sm9_dec(const uint8_t *IDB, uint32_t IDB_byteLen, const uint8_t *C, uint32_t CByteLen, const uint8_t deB[128], sm9_enc_type_e enc_type, sm9_enc_padding_e padding_type, uint32_t K2ByteLen, uint8_t *M, uint32_t *MByteLen)
sm9_exchange_role_e
Definition: sm9.h:52
@ SM9_ROLE_SPONSOR
Definition: sm9.h:52
@ SM9_ROLE_RESPONSOR
Definition: sm9.h:52
uint32_t sm9_exckey_gen_tmpKeyPair(const uint8_t *IDB, uint32_t IDB_byteLen, uint8_t hid, const uint8_t Ppub_e[64], uint8_t rA[32], uint8_t RA[64])
uint32_t sm9_enc_gen_mastKeyPair(uint8_t ke[32], uint8_t Ppub_e[64])
uint32_t sm9_sign_gen_mastKeyPair(uint8_t ks[32], uint8_t Ppub_s[128])
uint32_t sm9_enc_gen_mastPubKey_from_mastPriKey(uint8_t ke[32], uint8_t Ppub_e[64])
uint32_t sm9_exckey_gen_tmpPubKey_from_tmpPriKey(const uint8_t *IDB, uint32_t IDB_byteLen, uint8_t hid, const uint8_t Ppub_e[64], uint8_t rA[32], uint8_t RA[64])
uint32_t sm9_enc_gen_userPriKey(const uint8_t *IDB, uint32_t IDB_byteLen, uint8_t hid, uint8_t ke[32], uint8_t deB[128])
SM9_RET_CODE
Definition: sm9.h:25
@ SM9_IN_OUT_SAME_BUFFER
Definition: sm9.h:34
@ SM9_INPUT_INVALID
Definition: sm9.h:30
@ SM9_EXCHANGE_ROLE_INVALID
Definition: sm9.h:29
@ SM9_INTEGER_TOO_BIG
Definition: sm9.h:32
@ SM9_BUFFER_NULL
Definition: sm9.h:27
@ SM9_VERIFY_FAILED
Definition: sm9.h:33
@ SM9_SUCCESS
Definition: sm9.h:26
@ SM9_ZERO_ALL
Definition: sm9.h:31
@ SM9_NOT_ON_CURVE
Definition: sm9.h:28
@ SM9_DECRY_VERIFY_FAILED
Definition: sm9.h:35
uint32_t sm9_enc(const uint8_t *IDB, uint32_t IDB_byteLen, uint8_t hid, const uint8_t *M, uint32_t MByteLen, const uint8_t Ppub_e[64], uint8_t r[32], sm9_enc_type_e enc_type, sm9_enc_padding_e padding_type, uint32_t K2ByteLen, uint8_t *C, uint32_t *CByteLen)
sm9_enc_padding_e
Definition: sm9.h:45
@ SM9_ENC_PKCS7_PADDING
Definition: sm9.h:47
@ SM9_ENC_MAX_PADDING
Definition: sm9.h:48
@ SM9_ENC_NO_PADDING
Definition: sm9.h:46
uint32_t sm9_exckey_gen_mastKeyPair(uint8_t ke[32], uint8_t Ppub_e[64])
uint32_t sm9_wrap_key(const uint8_t *IDB, uint32_t IDB_byteLen, uint8_t hid, const uint8_t Ppub_e[64], uint8_t r[32], uint8_t C[64], uint32_t KByteLen, uint8_t *K)
uint32_t sm9_sign_gen_userPriKey(const uint8_t *IDA, uint32_t IDA_byteLen, uint8_t hid, uint8_t ks[32], uint8_t dsA[64])
uint32_t sm9_exckey_gen_userPriKey(const uint8_t *IDA, uint32_t IDA_byteLen, uint8_t hid, uint8_t ke[32], uint8_t deA[128])
uint32_t sm9_unwrap_key(const uint8_t *IDB, uint32_t IDB_byteLen, const uint8_t deB[128], const uint8_t C[64], uint32_t KByteLen, uint8_t *K)
uint32_t sm9_sign(const uint8_t *M, uint32_t MByteLen, const uint8_t Ppub_s[128], const uint8_t dsA[64], uint8_t r[32], uint8_t h[32], uint8_t S[65])
uint32_t sm9_verify(const uint8_t *M, uint32_t MByteLen, const uint8_t *IDA, uint32_t IDA_byteLen, uint8_t hid, const uint8_t Ppub_s[128], const uint8_t h[32], const uint8_t S[65])
Semidrive CRYPTO trng header file.