1 /* 2 * This file is part of the openHiTLS project. 3 * 4 * openHiTLS is licensed under the Mulan PSL v2. 5 * You can use this software according to the terms and conditions of the Mulan PSL v2. 6 * You may obtain a copy of Mulan PSL v2 at: 7 * 8 * http://license.coscl.org.cn/MulanPSL2 9 * 10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 13 * See the Mulan PSL v2 for more details. 14 */ 15 16 /** 17 * @defgroup hitls_crypt_reg 18 * @ingroup hitls 19 * @brief Algorithm related interfaces to be registered 20 */ 21 22 #ifndef HITLS_CRYPT_REG_H 23 #define HITLS_CRYPT_REG_H 24 25 #include <stdint.h> 26 #include "hitls_type.h" 27 #include "hitls_crypt_type.h" 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 /** 34 * @brief Input parameters for KEM encapsulation 35 */ 36 typedef struct { 37 HITLS_NamedGroup groupId; /**< Named group ID */ 38 uint8_t *peerPubkey; /**< Peer's public key */ 39 uint32_t pubKeyLen; /**< Length of peer's public key */ 40 uint8_t *ciphertext; /**< [OUT] Encapsulated ciphertext */ 41 uint32_t *ciphertextLen; /**< [IN/OUT] IN: Maximum ciphertext buffer length OUT: Actual ciphertext length */ 42 uint8_t *sharedSecret; /**< [OUT] Generated shared secret */ 43 uint32_t *sharedSecretLen; /**< [IN/OUT] IN: Maximum shared secret buffer length OUT: Actual shared secret length */ 44 } HITLS_KemEncapsulateParams; 45 46 /** 47 * @ingroup hitls_crypt_reg 48 * @brief Obtain the random number. 49 * 50 * @param buf [OUT] Random number 51 * @param len [IN] Random number length 52 * 53 * @retval 0 indicates success. Other values indicate failure. 54 */ 55 typedef int32_t (*CRYPT_RandBytesCallback)(uint8_t *buf, uint32_t len); 56 57 /** 58 * @ingroup hitls_crypt_reg 59 * @brief ECDH: Generate a key pair based on elliptic curve parameters. 60 * 61 * @param curveParams [IN] Elliptic curve parameter 62 * 63 * @retval Key handle 64 */ 65 typedef HITLS_CRYPT_Key *(*CRYPT_GenerateEcdhKeyPairCallback)(const HITLS_ECParameters *curveParams); 66 67 /** 68 * @ingroup hitls_crypt_reg 69 * @brief Release the key. 70 * 71 * @param key [IN] Key handle 72 */ 73 typedef void (*CRYPT_FreeEcdhKeyCallback)(HITLS_CRYPT_Key *key); 74 75 /** 76 * @ingroup hitls_crypt_reg 77 * @brief ECDH: Extract the public key data. 78 * 79 * @param key [IN] Key handle 80 * @param pubKeyBuf [OUT] Public key data 81 * @param bufLen [IN] Buffer length 82 * @param pubKeyLen [OUT] Public key data length 83 * 84 * @retval 0 indicates success. Other values indicate failure. 85 */ 86 typedef int32_t (*CRYPT_GetEcdhEncodedPubKeyCallback)(HITLS_CRYPT_Key *key, uint8_t *pubKeyBuf, uint32_t bufLen, 87 uint32_t *pubKeyLen); 88 89 /** 90 * @ingroup hitls_crypt_reg 91 * @brief ECDH: Calculate the shared key based on the local key and peer public key. Ref RFC 8446 section 7.4.1, 92 * this callback should strip the leading zeros. 93 * 94 * @param key [IN] Key handle 95 * @param peerPubkey [IN] Public key data 96 * @param pubKeyLen [IN] Public key data length 97 * @param sharedSecret [OUT] Shared key 98 * @param sharedSecretLen [IN/OUT] IN: Maximum length of the key padding OUT: Key length 99 * 100 * @retval 0 indicates success. Other values indicate failure. 101 */ 102 typedef int32_t (*CRYPT_CalcEcdhSharedSecretCallback)(HITLS_CRYPT_Key *key, uint8_t *peerPubkey, uint32_t pubKeyLen, 103 uint8_t *sharedSecret, uint32_t *sharedSecretLen); 104 105 /** 106 * @ingroup hitls_crypt_reg 107 * @brief KEM: Encapsulate a shared secret using peer's public key. 108 * 109 * @param params [IN/OUT] Parameters for KEM encapsulation 110 * 111 * @retval 0 indicates success. Other values indicate failure. 112 */ 113 typedef int32_t (*CRYPT_KemEncapsulateCallback)(HITLS_KemEncapsulateParams *params); 114 /** 115 * @ingroup hitls_crypt_reg 116 * @brief KEM: Decapsulate the ciphertext to recover shared secret. 117 * 118 * @param key [IN] Key handle 119 * @param ciphertext [IN] Ciphertext buffer 120 * @param ciphertextLen [IN] Ciphertext length 121 * @param sharedSecret [OUT] Shared secret buffer 122 * @param sharedSecretLen [IN/OUT] IN: Maximum length of the shared secret buffer OUT: Actual shared secret length 123 * 124 * @retval 0 indicates success. Other values indicate failure. 125 */ 126 typedef int32_t (*CRYPT_KemDecapsulateCallback)(HITLS_CRYPT_Key *key, const uint8_t *ciphertext, uint32_t ciphertextLen, 127 uint8_t *sharedSecret, uint32_t *sharedSecretLen); 128 129 /** 130 * @ingroup hitls_crypt_reg 131 * @brief SM2 calculates the shared key based on the local key and peer public key. 132 * 133 * @param sm2Params [IN] Shared key calculation parameters 134 * @param sharedSecret [OUT] Shared key 135 * @param sharedSecretLen [IN/OUT] IN: Maximum length of the key padding OUT: Key length 136 * 137 * @retval 0 indicates success. Other values indicate failure. 138 */ 139 typedef int32_t (*CRYPT_Sm2CalcEcdhSharedSecretCallback)(HITLS_Sm2GenShareKeyParameters *sm2Params, 140 uint8_t *sharedSecret, uint32_t *sharedSecretLen); 141 142 /** 143 * @ingroup hitls_crypt_reg 144 * @brief Generate a key pair based on secbits. 145 * 146 * @param secbits [IN] Key security level 147 * 148 * @retval Key handle 149 */ 150 typedef HITLS_CRYPT_Key *(*CRYPT_GenerateDhKeyBySecbitsCallback)(int32_t secbits); 151 152 /** 153 * @ingroup hitls_crypt_reg 154 * @brief DH: Generate a key pair based on the dh parameter. 155 * 156 * @param p [IN] p Parameter 157 * @param plen [IN] p Parameter length 158 * @param g [IN] g Parameter 159 * @param glen [IN] g Parameter length 160 * 161 * @retval Key handle 162 */ 163 typedef HITLS_CRYPT_Key *(*CRYPT_GenerateDhKeyByParamsCallback)(uint8_t *p, uint16_t plen, uint8_t *g, uint16_t glen); 164 165 /** 166 * @ingroup hitls_crypt_reg 167 * @brief Deep copy key 168 * 169 * @param key [IN] Key handle 170 * @retval Key handle 171 */ 172 typedef HITLS_CRYPT_Key *(*CRYPT_DupDhKeyCallback)(HITLS_CRYPT_Key *key); 173 174 /** 175 * @ingroup hitls_crypt_reg 176 * @brief Release the key. 177 * 178 * @param key [IN] Key handle 179 */ 180 typedef void (*CRYPT_FreeDhKeyCallback)(HITLS_CRYPT_Key *key); 181 182 /** 183 * @ingroup hitls_crypt_reg 184 * @brief DH: Obtain p g plen glen by using the key handle. 185 * 186 * @attention If the p and g parameters are null pointers, only the lengths of p and g are obtained. 187 * 188 * @param key [IN] Key handle 189 * @param p [OUT] p Parameter 190 * @param plen [IN/OUT] IN: Maximum length of data padding OUT: p Parameter length 191 * @param g [OUT] g Parameter 192 * @param glen [IN/OUT] IN: Maximum length of data padding OUT: g Parameter length 193 * 194 * @retval 0 indicates success. Other values indicate failure. 195 */ 196 typedef int32_t (*CRYPT_DHGetParametersCallback)(HITLS_CRYPT_Key *key, uint8_t *p, uint16_t *plen, 197 uint8_t *g, uint16_t *glen); 198 199 /** 200 * @ingroup hitls_crypt_reg 201 * @brief DH: Extract the Dh public key data. 202 * 203 * @param key [IN] Key handle 204 * @param pubKeyBuf [OUT] Public key data 205 * @param bufLen [IN] Buffer length 206 * @param pubKeyLen [OUT] Public key data length 207 * 208 * @retval 0 indicates success. Other values indicate failure. 209 */ 210 typedef int32_t (*CRYPT_GetDhEncodedPubKeyCallback)(HITLS_CRYPT_Key *key, uint8_t *pubKeyBuf, uint32_t bufLen, 211 uint32_t *pubKeyLen); 212 213 /** 214 * @ingroup hitls_crypt_reg 215 * @brief DH: Calculate the shared key based on the local key and peer public key. Ref RFC 5246 section 8.1.2, 216 * this callback should retain the leading zeros. 217 * 218 * @param key [IN] Key handle 219 * @param peerPubkey [IN] Public key data 220 * @param pubKeyLen [IN] Public key data length 221 * @param sharedSecret [OUT] Shared key 222 * @param sharedSecretLen [IN/OUT] IN: Maximum length of the key padding OUT: Key length 223 * 224 * @retval 0 indicates success. Other values indicate failure. 225 */ 226 typedef int32_t (*CRYPT_CalcDhSharedSecretCallback)(HITLS_CRYPT_Key *key, uint8_t *peerPubkey, uint32_t pubKeyLen, 227 uint8_t *sharedSecret, uint32_t *sharedSecretLen); 228 229 /** 230 * @ingroup hitls_crypt_reg 231 * @brief Obtain the HMAC length based on the hash algorithm. 232 * 233 * @param hashAlgo [IN] Hash algorithm 234 * 235 * @retval HMAC length 236 */ 237 typedef uint32_t (*CRYPT_HmacSizeCallback)(HITLS_HashAlgo hashAlgo); 238 239 /** 240 * @ingroup hitls_crypt_reg 241 * @brief Initialize the HMAC context. 242 * 243 * @param hashAlgo [IN] Hash algorithm 244 * @param key [IN] Key 245 * @param len [IN] Key length 246 * 247 * @retval HMAC context 248 */ 249 typedef HITLS_HMAC_Ctx *(*CRYPT_HmacInitCallback)(HITLS_HashAlgo hashAlgo, const uint8_t *key, uint32_t len); 250 251 /** 252 * @ingroup hitls_crypt_reg 253 * @brief reinit the HMAC context. 254 * 255 * @param ctx [IN] HMAC context 256 * 257 * @retval HMAC context 258 */ 259 typedef int32_t (*CRYPT_HmacReInitCallback)(HITLS_HMAC_Ctx *ctx); 260 261 /** 262 * @ingroup hitls_crypt_reg 263 * @brief Release the HMAC context. 264 * 265 * @param ctx [IN] HMAC context 266 */ 267 typedef void (*CRYPT_HmacFreeCallback)(HITLS_HMAC_Ctx *ctx); 268 269 /** 270 * @ingroup hitls_crypt_reg 271 * @brief Add the HMAC input data. 272 * 273 * @param ctx [IN] HMAC context 274 * @param data [IN] Input data 275 * @param len [IN] Data length 276 * 277 * @retval 0 indicates success. Other values indicate failure. 278 */ 279 typedef int32_t (*CRYPT_HmacUpdateCallback)(HITLS_HMAC_Ctx *ctx, const uint8_t *data, uint32_t len); 280 281 /** 282 * @ingroup hitls_crypt_reg 283 * @brief Output the HMAC result. 284 * 285 * @param ctx [IN] HMAC context 286 * @param out [OUT] Output data 287 * @param len [IN/OUT] IN: Maximum buffer length OUT: Output data length 288 * 289 * @retval 0 indicates success. Other values indicate failure. 290 */ 291 typedef int32_t (*CRYPT_HmacFinalCallback)(HITLS_HMAC_Ctx *ctx, uint8_t *out, uint32_t *len); 292 293 /** 294 * @ingroup hitls_crypt_reg 295 * @brief Function for calculating the HMAC for a single time 296 * 297 * @param hashAlgo [IN] Hash algorithm 298 * @param key [IN] Key 299 * @param keyLen [IN] Key length 300 * @param in [IN] Input data. 301 * @param inLen [IN] Input data length 302 * @param out [OUT] Output the HMAC data result. 303 * @param outLen [IN/OUT] IN: Maximum buffer length OUT: Output data length 304 * 305 * @retval 0 indicates success. Other values indicate failure. 306 */ 307 typedef int32_t (*CRYPT_HmacCallback)(HITLS_HashAlgo hashAlgo, const uint8_t *key, uint32_t keyLen, 308 const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen); 309 310 /** 311 * @ingroup hitls_crypt_reg 312 * @brief Obtain the hash length. 313 * 314 * @param hashAlgo [IN] Hash algorithm. 315 * 316 * @retval Hash length 317 */ 318 typedef uint32_t (*CRYPT_DigestSizeCallback)(HITLS_HashAlgo hashAlgo); 319 320 /** 321 * @ingroup hitls_crypt_reg 322 * @brief Initialize the hash context. 323 * 324 * @param hashAlgo [IN] Hash algorithm 325 * 326 * @retval Hash context 327 */ 328 typedef HITLS_HASH_Ctx *(*CRYPT_DigestInitCallback)(HITLS_HashAlgo hashAlgo); 329 330 /** 331 * @ingroup hitls_crypt_reg 332 * @brief Copy the hash context. 333 * 334 * @param ctx [IN] Hash Context 335 * 336 * @retval Hash context 337 */ 338 typedef HITLS_HASH_Ctx *(*CRYPT_DigestCopyCallback)(HITLS_HASH_Ctx *ctx); 339 340 /** 341 * @ingroup hitls_crypt_reg 342 * @brief Release the hash context. 343 * 344 * @param ctx [IN] Hash Context 345 */ 346 typedef void (*CRYPT_DigestFreeCallback)(HITLS_HASH_Ctx *ctx); 347 348 /** 349 * @ingroup hitls_crypt_reg 350 * @brief Hash Add input data. 351 * 352 * @param ctx [IN] Hash context 353 * @param data [IN] Input data 354 * @param len [IN] Input data length 355 * 356 * @retval 0 indicates success. Other values indicate failure. 357 */ 358 typedef int32_t (*CRYPT_DigestUpdateCallback)(HITLS_HASH_Ctx *ctx, const uint8_t *data, uint32_t len); 359 360 /** 361 * @ingroup hitls_crypt_reg 362 * @brief Output the hash result. 363 * 364 * @param ctx [IN] Hash context 365 * @param out [IN] Output data. 366 * @param len [IN/OUT] IN: Maximum buffer length OUT: Output data length 367 * 368 * @retval 0 indicates success. Other values indicate failure. 369 */ 370 typedef int32_t (*CRYPT_DigestFinalCallback)(HITLS_HASH_Ctx *ctx, uint8_t *out, uint32_t *len); 371 372 /** 373 * @ingroup hitls_crypt_reg 374 * @brief Hash function 375 * 376 * @param hashAlgo [IN] Hash algorithm 377 * @param in [IN] Input data 378 * @param inLen [IN] Input data length 379 * @param out [OUT] Output data 380 * @param outLen [IN/OUT] IN: Maximum buffer length OUT: Output data length 381 * 382 * @retval 0 indicates success. Other values indicate failure. 383 */ 384 typedef int32_t (*CRYPT_DigestCallback)(HITLS_HashAlgo hashAlgo, const uint8_t *in, uint32_t inLen, 385 uint8_t *out, uint32_t *outLen); 386 387 /** 388 * @ingroup hitls_crypt_reg 389 * @brief TLS encryption 390 * 391 * Provides the encryption capability for records, including the AEAD and CBC algorithms. 392 * Encrypts the input factor (key parameter) and plaintext based on the record protocol 393 * to obtain the ciphertext. 394 * 395 * @attention: The protocol allows the sending of app packets with payload length 0. 396 * Therefore, the length of the plaintext input may be 0. Therefore, 397 * the plaintext with the length of 0 must be encrypted. 398 * @param cipher [IN] Key parameters 399 * @param in [IN] Plaintext data 400 * @param inLen [IN] Plaintext data length 401 * @param out [OUT] Ciphertext data 402 * @param outLen [IN/OUT] IN: maximum buffer length OUT: ciphertext data length 403 * 404 * @retval 0 indicates success. Other values indicate failure. 405 */ 406 typedef int32_t (*CRYPT_EncryptCallback)(const HITLS_CipherParameters *cipher, const uint8_t *in, uint32_t inLen, 407 uint8_t *out, uint32_t *outLen); 408 409 /** 410 * @ingroup hitls_crypt_reg 411 * @brief TLS decryption 412 * 413 * Provides decryption capabilities for records, including the AEAD and CBC algorithms. 414 * Decrypt the input factor (key parameter) and ciphertext according to the record protocol to obtain the plaintext. 415 * 416 * @param cipher [IN] Key parameters 417 * @param in [IN] Ciphertext data 418 * @param inLen [IN] Ciphertext data length 419 * @param out [OUT] Plaintext data 420 * @param outLen [IN/OUT] IN: maximum buffer length OUT: plaintext data length 421 * 422 * @retval 0 indicates success. Other values indicate failure. 423 */ 424 typedef int32_t (*CRYPT_DecryptCallback)(const HITLS_CipherParameters *cipher, const uint8_t *in, uint32_t inLen, 425 uint8_t *out, uint32_t *outLen); 426 427 /** 428 * @ingroup hitls_crypt_reg 429 * @brief Release the cipher ctx. 430 * 431 * @param ctx [IN] cipher ctx handle 432 */ 433 typedef void (*CRYPT_CipherFreeCallback)(HITLS_Cipher_Ctx *ctx); 434 /** 435 * @ingroup hitls_crypt_reg 436 * @brief HKDF-Extract 437 * 438 * @param input [IN] Enter the key material. 439 * @param prk [OUT] Output key 440 * @param prkLen [IN/OUT] IN: Maximum buffer length OUT: Output key length 441 * 442 * @retval 0 indicates success. Other values indicate failure. 443 */ 444 typedef int32_t (*CRYPT_HkdfExtractCallback)(const HITLS_CRYPT_HkdfExtractInput *input, uint8_t *prk, uint32_t *prkLen); 445 446 /** 447 * @ingroup hitls_crypt_reg 448 * @brief HKDF-Expand 449 * 450 * @param input [IN] Enter the key material. 451 * @param outputKeyMaterial [OUT] Output key 452 * @param outputKeyMaterialLen [IN] Output key length 453 * 454 * @retval 0 indicates success. Other values indicate failure. 455 */ 456 typedef int32_t (*CRYPT_HkdfExpandCallback)( 457 const HITLS_CRYPT_HkdfExpandInput *input, uint8_t *outputKeyMaterial, uint32_t outputKeyMaterialLen); 458 459 /** 460 * @ingroup hitls_cert_reg 461 * @brief Callback function that must be registered 462 */ 463 typedef struct { 464 CRYPT_RandBytesCallback randBytes; /**< Obtain the random number. */ 465 CRYPT_HmacSizeCallback hmacSize; /**< HMAC: obtain the HMAC length based 466 on the hash algorithm. */ 467 CRYPT_HmacInitCallback hmacInit; /**< HMAC: initialize the context. */ 468 CRYPT_HmacReInitCallback hmacReinit; /**< HMAC: reinitialize the context. */ 469 CRYPT_HmacFreeCallback hmacFree; /**< HMAC: release the context. */ 470 CRYPT_HmacUpdateCallback hmacUpdate; /**< HMAC: add input data. */ 471 CRYPT_HmacFinalCallback hmacFinal; /**< HMAC: output result. */ 472 CRYPT_HmacCallback hmac; /**< HMAC: single HMAC function. */ 473 CRYPT_DigestSizeCallback digestSize; /**< HASH: obtains the hash length. */ 474 CRYPT_DigestInitCallback digestInit; /**< HASH: initialize the context. */ 475 CRYPT_DigestCopyCallback digestCopy; /**< HASH: copy the hash context. */ 476 CRYPT_DigestFreeCallback digestFree; /**< HASH: release the context. */ 477 CRYPT_DigestUpdateCallback digestUpdate; /**< HASH: add input data. */ 478 CRYPT_DigestFinalCallback digestFinal; /**< HASH: output the hash result. */ 479 CRYPT_DigestCallback digest; /**< HASH: single hash function. */ 480 CRYPT_EncryptCallback encrypt; /**< TLS encryption: provides the encryption 481 capability for records. */ 482 CRYPT_DecryptCallback decrypt; /**< TLS decryption: provides the decryption 483 capability for records. */ 484 CRYPT_CipherFreeCallback cipherFree; /**< CIPHER: release the context. */ 485 } HITLS_CRYPT_BaseMethod; 486 487 /** 488 * @ingroup hitls_cert_reg 489 * @brief ECDH Callback function to be registered 490 */ 491 typedef struct { 492 CRYPT_GenerateEcdhKeyPairCallback generateEcdhKeyPair; /**< ECDH: generate a key pair based 493 on the elliptic curve parameters. */ 494 CRYPT_FreeEcdhKeyCallback freeEcdhKey; /**< ECDH: release the elliptic curve key. */ 495 CRYPT_GetEcdhEncodedPubKeyCallback getEcdhPubKey; /**< ECDH: extract public key data. */ 496 CRYPT_CalcEcdhSharedSecretCallback calcEcdhSharedSecret; /**< ECDH: calculate the shared key based on 497 the local key and peer public key. */ 498 CRYPT_Sm2CalcEcdhSharedSecretCallback sm2CalEcdhSharedSecret; 499 CRYPT_KemEncapsulateCallback kemEncapsulate; /**< KEM: encapsulate a shared secret */ 500 CRYPT_KemDecapsulateCallback kemDecapsulate; /**< KEM: decapsulate the ciphertext */ 501 } HITLS_CRYPT_EcdhMethod; 502 503 /** 504 * @ingroup hitls_cert_reg 505 * @brief DH Callback function to be registered 506 */ 507 typedef struct { 508 CRYPT_GenerateDhKeyBySecbitsCallback generateDhKeyBySecbits; /**< DH: Generate a key pair based on secbits */ 509 CRYPT_GenerateDhKeyByParamsCallback generateDhKeyByParams; /**< DH: Generate a key pair 510 based on the dh parameter */ 511 CRYPT_DupDhKeyCallback dupDhKey; /**< DH: deep copy key*/ 512 CRYPT_FreeDhKeyCallback freeDhKey; /**< DH: release the key */ 513 CRYPT_DHGetParametersCallback getDhParameters; /**< DH: obtain the p g plen glen 514 by using the key handle */ 515 CRYPT_GetDhEncodedPubKeyCallback getDhPubKey; /**< DH: extract the Dh public key data */ 516 CRYPT_CalcDhSharedSecretCallback calcDhSharedSecret; /**< DH: calculate the shared key based on 517 the local key and peer public key */ 518 } HITLS_CRYPT_DhMethod; 519 520 /** 521 * @ingroup hitls_cert_reg 522 * @brief KDF function 523 */ 524 typedef struct { 525 CRYPT_HkdfExtractCallback hkdfExtract; 526 CRYPT_HkdfExpandCallback hkdfExpand; 527 } HITLS_CRYPT_KdfMethod; 528 529 /** 530 * @ingroup hitls_cert_reg 531 * @brief Register the basic callback function. 532 * 533 * @param userCryptCallBack [IN] Callback function to be registered 534 * 535 * @retval HITLS_SUCCESS, if successful. 536 * @retval HITLS_NULL_INPUT, the input parameter is NULL.. 537 */ 538 int32_t HITLS_CRYPT_RegisterBaseMethod(HITLS_CRYPT_BaseMethod *userCryptCallBack); 539 540 /** 541 * @ingroup hitls_cert_reg 542 * @brief Register the ECDH callback function. 543 * 544 * @param userCryptCallBack [IN] Callback function to be registered 545 * 546 * @retval HITLS_SUCCESS, if successful. 547 * @retval HITLS_NULL_INPUT, the input parameter is NULL.. 548 */ 549 int32_t HITLS_CRYPT_RegisterEcdhMethod(HITLS_CRYPT_EcdhMethod *userCryptCallBack); 550 551 /** 552 * @ingroup hitls_cert_reg 553 * @brief Register the callback function of the DH. 554 * 555 * @param userCryptCallBack [IN] Callback function to be registered 556 * 557 * @retval HITLS_SUCCESS, if successful. 558 * @retval HITLS_NULL_INPUT, the input parameter is NULL.. 559 */ 560 int32_t HITLS_CRYPT_RegisterDhMethod(const HITLS_CRYPT_DhMethod *userCryptCallBack); 561 562 /** 563 * @brief Register the callback function of the HKDF. 564 * 565 * @param userCryptCallBack [IN] Callback function to be registered 566 * 567 * @retval HITLS_SUCCESS, if successful. 568 * @retval HITLS_NULL_INPUT, the input parameter is NULL.. 569 */ 570 int32_t HITLS_CRYPT_RegisterHkdfMethod(HITLS_CRYPT_KdfMethod *userCryptCallBack); 571 572 #ifdef __cplusplus 573 } 574 #endif 575 #endif