TLS Custom Extensions
更多...
|
|
#define | HITLS_EX_TYPE_CLIENT_HELLO 0x00001 |
| | Extension is used in ClientHello messages.
|
|
#define | HITLS_EX_TYPE_TLS1_2_SERVER_HELLO 0x00002 |
| | Extension is used in Tls1.2 ServerHello messages.
|
|
#define | HITLS_EX_TYPE_TLS1_3_SERVER_HELLO 0x00004 |
| | Extension is used in Tls1.3 ServerHello messages.
|
|
#define | HITLS_EX_TYPE_HELLO_RETRY_REQUEST 0x00008 |
| | Extension is used in HelloRetryRequest messages (TLS 1.3).
|
|
#define | HITLS_EX_TYPE_ENCRYPTED_EXTENSIONS 0x00010 |
| | Extension is used in EncryptedExtensions messages (TLS 1.3).
|
|
#define | HITLS_EX_TYPE_TLS1_3_CERTIFICATE 0x00020 |
| | Extension is used in Certificate messages.
|
|
#define | HITLS_EX_TYPE_TLS1_3_CERTIFICATE_REQUEST 0x00040 |
| | Extension is used in CertificateRequest messages.
|
|
#define | HITLS_EX_TYPE_TLS1_3_NEW_SESSION_TICKET 0x00080 |
| | Extension is used in NewSessionTicket messages (TLS 1.3).
|
|
| typedef int(* | HITLS_AddCustomExtCallback) (const HITLS_Ctx *ctx, uint16_t extType, uint32_t context, uint8_t **out, uint32_t *outLen, HITLS_CERT_X509 *cert, uint32_t certIndex, uint32_t *alert, void *addArg) |
| | Callback function to add a custom extension.
|
| typedef void(* | HITLS_FreeCustomExtCallback) (const HITLS_Ctx *ctx, uint16_t extType, uint32_t context, uint8_t *out, void *addArg) |
| | Callback function to free a custom extension.
|
| typedef int(* | HITLS_ParseCustomExtCallback) (const HITLS_Ctx *ctx, uint16_t extType, uint32_t context, const uint8_t **in, uint32_t *inLen, HITLS_CERT_X509 *cert, uint32_t certIndex, uint32_t *alert, void *parseArg) |
| | Callback function to parse a custom extension.
|
TLS Custom Extensions
◆ HITLS_AddCustomExtCallback
| typedef int(* HITLS_AddCustomExtCallback) (const HITLS_Ctx *ctx, uint16_t extType, uint32_t context, uint8_t **out, uint32_t *outLen, HITLS_CERT_X509 *cert, uint32_t certIndex, uint32_t *alert, void *addArg) |
Callback function to add a custom extension.
This function is invoked when adding a custom extension to a TLS message. It prepares the extension data to be sent, utilizing certificate information if necessary.
- 参数
-
| ctx | [IN] TLS context |
| extType | [IN] Extension type |
| context | [IN] Context where the extension applies |
| out | [OUT] Pointer to the extension data to be sent |
| outLen | [OUT] Length of the extension data |
| cert | [IN] Pointer to the HITLS_CERT_X509 structure representing certificate information |
| certIndex | [IN] Certificate index indicating its position in the certificate chain |
| alert | [OUT] Alert value provided by the user when requesting to add the custom extension |
| addArg | [IN] Additional argument provided when registering the callback |
- 返回值
-
| HITLS_ADD_CUSTOM_EXTENSION_RET_PACK | if the extension needs to be packed, HITLS_ADD_CUSTOM_EXTENSION_RET_PASS if it does not need to be packed, otherwise, any other return value is considered a failure and will trigger a fatal alert based on the alert value. |
◆ HITLS_FreeCustomExtCallback
| typedef void(* HITLS_FreeCustomExtCallback) (const HITLS_Ctx *ctx, uint16_t extType, uint32_t context, uint8_t *out, void *addArg) |
Callback function to free a custom extension.
This function is invoked to release resources allocated for a custom extension.
- 参数
-
| ctx | [IN] TLS context |
| ext_type | [IN] Extension type |
| context | [IN] Context where the extension applies |
| out | [IN] Extension data to be freed |
| add_arg | [IN] Additional argument provided when registering the callback |
◆ HITLS_ParseCustomExtCallback
| typedef int(* HITLS_ParseCustomExtCallback) (const HITLS_Ctx *ctx, uint16_t extType, uint32_t context, const uint8_t **in, uint32_t *inLen, HITLS_CERT_X509 *cert, uint32_t certIndex, uint32_t *alert, void *parseArg) |
Callback function to parse a custom extension.
This function is invoked when parsing a received custom extension. It interprets the extension data and updates the TLS context based on certificate information if necessary.
- 参数
-
| ctx | [IN] TLS context |
| extType | [IN] Extension type |
| context | [IN] Context where the extension applies |
| in | [IN] Pointer to the received extension data |
| inlen | [IN] Length of the extension data |
| cert | [IN] Pointer to the HITLS_CERT_X509 structure representing certificate information |
| certIndex | [IN] Certificate index indicating its position in the certificate chain |
| alert | [OUT] Alert value provided by the user when requesting to add the custom extension |
| parseArg | [IN] Additional argument provided when registering the callback |
- 返回值
-
| HITLS_SUCCESS | if successful, otherwise an error code |
◆ HITLS_AddCustomExtension()
Add a custom extension to the TLS context using a parameter structure.
This function adds a custom extension to the specified TLS context using the provided parameters encapsulated in the HITLS_CustomExtParams structure.
- 参数
-
| ctx | [IN] TLS context |
| params | [IN] Pointer to the structure containing custom extension parameters |
- 返回值
-
| HITLS_SUCCESS | if successful For other error codes, see hitls_error.h |
◆ HITLS_CFG_AddCustomExtension()
Add a custom extension to the HITLS configuration using a parameter structure.
This function adds a custom extension to the specified HITLS configuration using the provided parameters encapsulated in the HITLS_CustomExtParams structure.
- 参数
-
| config | [IN] Pointer to the HITLS configuration |
| params | [IN] Pointer to the structure containing custom extension parameters |
- 返回值
-
| HITLS_SUCCESS | if successful For other error codes, see hitls_error.h |