15#ifndef HITLS_CRYPT_REG_H
16#define HITLS_CRYPT_REG_H
92 uint8_t *sharedSecret, uint32_t *sharedSecretLen);
105 uint8_t *sharedSecret, uint32_t *sharedSecretLen);
128typedef HITLS_CRYPT_Key *(*CRYPT_GenerateDhKeyByParamsCallback)(uint8_t *p, uint16_t plen, uint8_t *g, uint16_t glen);
162 uint8_t *g, uint16_t *glen);
176 uint32_t *pubKeyLen);
191 uint8_t *sharedSecret, uint32_t *sharedSecretLen);
262 const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen);
339 uint8_t *out, uint32_t *outLen);
361 uint8_t *out, uint32_t *outLen);
379 uint8_t *out, uint32_t *outLen);
int32_t HITLS_CRYPT_RegisterHkdfMethod(HITLS_CRYPT_KdfMethod *userCryptCallBack)
Register the callback function of the HKDF.
void HITLS_HASH_Ctx
Hash context. The user converts the structure based on the algorithm library.
Definition hitls_crypt_type.h:35
void HITLS_HMAC_Ctx
HMAC context. The user converts the HMAC context into the corresponding structure based on the algori...
Definition hitls_crypt_type.h:42
void HITLS_CRYPT_Key
Key handle, which is converted into the corresponding structure based on the algorithm library used b...
Definition hitls_crypt_type.h:29
HITLS_HashAlgo
Hash algorithm enumeration
Definition hitls_crypt_type.h:77
int32_t HITLS_CRYPT_RegisterDhMethod(const HITLS_CRYPT_DhMethod *userCryptCallBack)
Register the callback function of the DH.
int32_t HITLS_CRYPT_RegisterBaseMethod(HITLS_CRYPT_BaseMethod *userCryptCallBack)
Register the basic callback function.
int32_t HITLS_CRYPT_RegisterEcdhMethod(HITLS_CRYPT_EcdhMethod *userCryptCallBack)
Register the ECDH callback function.
int32_t(* CRYPT_CalcEcdhSharedSecretCallback)(HITLS_CRYPT_Key *key, uint8_t *peerPubkey, uint32_t pubKeyLen, uint8_t *sharedSecret, uint32_t *sharedSecretLen)
ECDH: Calculate the shared key based on the local key and peer public key.
Definition hitls_crypt_reg.h:91
int32_t(* CRYPT_HmacCallback)(HITLS_HashAlgo hashAlgo, const uint8_t *key, uint32_t keyLen, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen)
Function for calculating the HMAC for a single time
Definition hitls_crypt_reg.h:261
HITLS_CRYPT_Key *(* CRYPT_GenerateDhKeyBySecbitsCallback)(int32_t secbits)
Generate a key pair based on secbits.
Definition hitls_crypt_reg.h:115
HITLS_CRYPT_Key *(* CRYPT_DupEcdhKeyCallback)(HITLS_CRYPT_Key *key)
Deep copy key
Definition hitls_crypt_reg.h:55
void(* CRYPT_HmacFreeCallback)(HITLS_HMAC_Ctx *ctx)
Release the HMAC context.
Definition hitls_crypt_reg.h:221
HITLS_HMAC_Ctx *(* CRYPT_HmacInitCallback)(HITLS_HashAlgo hashAlgo, const uint8_t *key, uint32_t len)
Initialize the HMAC context.
Definition hitls_crypt_reg.h:213
int32_t(* CRYPT_DHGetParametersCallback)(HITLS_CRYPT_Key *key, uint8_t *p, uint16_t *plen, uint8_t *g, uint16_t *glen)
DH: Obtain p g plen glen by using the key handle.
Definition hitls_crypt_reg.h:161
void(* CRYPT_FreeDhKeyCallback)(HITLS_CRYPT_Key *key)
Release the key.
Definition hitls_crypt_reg.h:145
int32_t(* CRYPT_HkdfExpandCallback)(const HITLS_CRYPT_HkdfExpandInput *input, uint8_t *okm, uint32_t okmLen)
HKDF-Expand
Definition hitls_crypt_reg.h:403
int32_t(* CRYPT_HmacFinalCallback)(HITLS_HMAC_Ctx *ctx, uint8_t *out, uint32_t *len)
Output the HMAC result.
Definition hitls_crypt_reg.h:245
void(* CRYPT_DigestFreeCallback)(HITLS_HASH_Ctx *ctx)
Release the hash context.
Definition hitls_crypt_reg.h:300
HITLS_CRYPT_Key *(* CRYPT_GenerateEcdhKeyPairCallback)(const HITLS_ECParameters *curveParams)
ECDH: Generate a key pair based on elliptic curve parameters.
Definition hitls_crypt_reg.h:45
int32_t(* CRYPT_CalcDhSharedSecretCallback)(HITLS_CRYPT_Key *key, uint8_t *peerPubkey, uint32_t pubKeyLen, uint8_t *sharedSecret, uint32_t *sharedSecretLen)
DH: Calculate the shared key based on the local key and peer public key.
Definition hitls_crypt_reg.h:190
int32_t(* CRYPT_GetEcdhEncodedPubKeyCallback)(HITLS_CRYPT_Key *key, uint8_t *pubKeyBuf, uint32_t bufLen, uint32_t *pubKeyLen)
ECDH: Extract the public key data.
Definition hitls_crypt_reg.h:76
int32_t(* CRYPT_HmacUpdateCallback)(HITLS_HMAC_Ctx *ctx, const uint8_t *data, uint32_t len)
Add the HMAC input data.
Definition hitls_crypt_reg.h:233
HITLS_CRYPT_Key *(* CRYPT_GenerateDhKeyByParamsCallback)(uint8_t *p, uint16_t plen, uint8_t *g, uint16_t glen)
DH: Generate a key pair based on the dh parameter.
Definition hitls_crypt_reg.h:128
void(* CRYPT_FreeEcdhKeyCallback)(HITLS_CRYPT_Key *key)
Release the key.
Definition hitls_crypt_reg.h:63
int32_t(* CRYPT_DigestCallback)(HITLS_HashAlgo hashAlgo, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen)
Hash function
Definition hitls_crypt_reg.h:338
int32_t(* CRYPT_GetDhEncodedPubKeyCallback)(HITLS_CRYPT_Key *key, uint8_t *pubKeyBuf, uint32_t bufLen, uint32_t *pubKeyLen)
DH: Extract the Dh public key data.
Definition hitls_crypt_reg.h:175
HITLS_CRYPT_Key *(* CRYPT_DupDhKeyCallback)(HITLS_CRYPT_Key *key)
Deep copy key
Definition hitls_crypt_reg.h:137
int32_t(* CRYPT_DigestFinalCallback)(HITLS_HASH_Ctx *ctx, uint8_t *out, uint32_t *len)
Output the hash result.
Definition hitls_crypt_reg.h:324
uint32_t(* CRYPT_DigestSizeCallback)(HITLS_HashAlgo hashAlgo)
Obtain the hash length.
Definition hitls_crypt_reg.h:272
int32_t(* CRYPT_RandBytesCallback)(uint8_t *buf, uint32_t len)
Obtain the random number.
Definition hitls_crypt_reg.h:35
int32_t(* CRYPT_HkdfExtractCallback)(const HITLS_CRYPT_HkdfExtractInput *input, uint8_t *prk, uint32_t *prkLen)
HKDF-Extract
Definition hitls_crypt_reg.h:391
int32_t(* CRYPT_DigestUpdateCallback)(HITLS_HASH_Ctx *ctx, const uint8_t *data, uint32_t len)
Hash Add input data.
Definition hitls_crypt_reg.h:312
HITLS_HASH_Ctx *(* CRYPT_DigestCopyCallback)(HITLS_HASH_Ctx *ctx)
Copy the hash context.
Definition hitls_crypt_reg.h:292
int32_t(* CRYPT_DecryptCallback)(const HITLS_CipherParameters *cipher, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen)
TLS decryption
Definition hitls_crypt_reg.h:378
int32_t(* CRYPT_EncryptCallback)(const HITLS_CipherParameters *cipher, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen)
TLS encryption
Definition hitls_crypt_reg.h:360
HITLS_HASH_Ctx *(* CRYPT_DigestInitCallback)(HITLS_HashAlgo hashAlgo)
Initialize the hash context.
Definition hitls_crypt_reg.h:282
int32_t(* CRYPT_Sm2CalcEcdhSharedSecretCallback)(HITLS_Sm2GenShareKeyParameters *sm2Params, uint8_t *sharedSecret, uint32_t *sharedSecretLen)
SM2 calculates the shared key based on the local key and peer public key.
Definition hitls_crypt_reg.h:104
uint32_t(* CRYPT_HmacSizeCallback)(HITLS_HashAlgo hashAlgo)
Obtain the HMAC length based on the hash algorithm.
Definition hitls_crypt_reg.h:201
CRYPT_DecryptCallback decrypt
Definition hitls_crypt_reg.h:427
CRYPT_HmacSizeCallback hmacSize
Definition hitls_crypt_reg.h:411
CRYPT_HmacUpdateCallback hmacUpdate
Definition hitls_crypt_reg.h:415
CRYPT_DigestCallback digest
Definition hitls_crypt_reg.h:424
CRYPT_DigestFreeCallback digestFree
Definition hitls_crypt_reg.h:421
CRYPT_DigestFinalCallback digestFinal
Definition hitls_crypt_reg.h:423
CRYPT_HmacFreeCallback hmacFree
Definition hitls_crypt_reg.h:414
CRYPT_DigestInitCallback digestInit
Definition hitls_crypt_reg.h:419
CRYPT_EncryptCallback encrypt
Definition hitls_crypt_reg.h:425
CRYPT_HmacFinalCallback hmacFinal
Definition hitls_crypt_reg.h:416
CRYPT_DigestUpdateCallback digestUpdate
Definition hitls_crypt_reg.h:422
CRYPT_HmacInitCallback hmacInit
Definition hitls_crypt_reg.h:413
CRYPT_RandBytesCallback randBytes
Definition hitls_crypt_reg.h:410
CRYPT_HmacCallback hmac
Definition hitls_crypt_reg.h:417
CRYPT_DigestCopyCallback digestCopy
Definition hitls_crypt_reg.h:420
CRYPT_DigestSizeCallback digestSize
Definition hitls_crypt_reg.h:418
Callback function that must be registered
Definition hitls_crypt_reg.h:409
CRYPT_GenerateEcdhKeyPairCallback generateEcdhKeyPair
Definition hitls_crypt_reg.h:436
CRYPT_Sm2CalcEcdhSharedSecretCallback sm2CalEcdhSharedSecret
Definition hitls_crypt_reg.h:443
CRYPT_FreeEcdhKeyCallback freeEcdhKey
Definition hitls_crypt_reg.h:439
CRYPT_CalcEcdhSharedSecretCallback calcEcdhSharedSecret
Definition hitls_crypt_reg.h:441
CRYPT_GetEcdhEncodedPubKeyCallback getEcdhPubKey
Definition hitls_crypt_reg.h:440
CRYPT_DupEcdhKeyCallback dupEcdhKey
Definition hitls_crypt_reg.h:438
ECDH Callback function to be registered
Definition hitls_crypt_reg.h:435
CRYPT_DupDhKeyCallback dupDhKey
Definition hitls_crypt_reg.h:454
CRYPT_FreeDhKeyCallback freeDhKey
Definition hitls_crypt_reg.h:455
CRYPT_CalcDhSharedSecretCallback calcDhSharedSecret
Definition hitls_crypt_reg.h:459
CRYPT_GetDhEncodedPubKeyCallback getDhPubKey
Definition hitls_crypt_reg.h:458
CRYPT_GenerateDhKeyBySecbitsCallback generateDhKeyBySecbits
Definition hitls_crypt_reg.h:451
CRYPT_DHGetParametersCallback getDhParameters
Definition hitls_crypt_reg.h:456
CRYPT_GenerateDhKeyByParamsCallback generateDhKeyByParams
Definition hitls_crypt_reg.h:452
DH Callback function to be registered
Definition hitls_crypt_reg.h:450
CRYPT_HkdfExpandCallback hkdfExpand
Definition hitls_crypt_reg.h:469
CRYPT_HkdfExtractCallback hkdfExtract
Definition hitls_crypt_reg.h:468
KDF function
Definition hitls_crypt_reg.h:467
Elliptic curve parameter
Definition hitls_crypt_type.h:201
Key parameters
Definition hitls_crypt_type.h:214
sm2 ecdhe negotiation key parameters
Definition hitls_crypt_type.h:232
HKDF-Extract Input
Definition hitls_crypt_type.h:247
HKDF-Expand Input
Definition hitls_crypt_type.h:259