22#ifndef HITLS_SECURITY_H
23#define HITLS_SECURITY_H
26#include "hitls_type.h"
38#ifndef HITLS_DEFAULT_SECURITY_LEVEL
39#define HITLS_DEFAULT_SECURITY_LEVEL 1
46#define HITLS_SECURITY_LEVEL_ZERO 0
47#define HITLS_SECURITY_LEVEL_ONE 1
48#define HITLS_SECURITY_LEVEL_TWO 2
49#define HITLS_SECURITY_LEVEL_THREE 3
50#define HITLS_SECURITY_LEVEL_FOUR 4
51#define HITLS_SECURITY_LEVEL_FIVE 5
52#define HITLS_SECURITY_LEVEL_MIN HITLS_SECURITY_LEVEL_ZERO
53#define HITLS_SECURITY_LEVEL_MAX HITLS_SECURITY_LEVEL_FIVE
59#define HITLS_SECURITY_LEVEL_ONE_SECBITS 80
60#define HITLS_SECURITY_LEVEL_TWO_SECBITS 112
61#define HITLS_SECURITY_LEVEL_THREE_SECBITS 128
62#define HITLS_SECURITY_LEVEL_FOUR_SECBITS 192
63#define HITLS_SECURITY_LEVEL_FIVE_SECBITS 256
67# define HITLS_SECURITY_SECOP_OTHER_TYPE 0xffff0000
68# define HITLS_SECURITY_SECOP_OTHER_NONE 0
69# define HITLS_SECURITY_SECOP_OTHER_CIPHER (1 << 16)
70# define HITLS_SECURITY_SECOP_OTHER_CURVE (2 << 16)
71# define HITLS_SECURITY_SECOP_OTHER_DH (3 << 16)
72# define HITLS_SECURITY_SECOP_OTHER_PKEY (4 << 16)
73# define HITLS_SECURITY_SECOP_OTHER_SIGALG (5 << 16)
74# define HITLS_SECURITY_SECOP_OTHER_CERT (6 << 16)
80# define HITLS_SECURITY_SECOP_PEER 0x1000
84# define HITLS_SECURITY_SECOP_CIPHER_SUPPORTED (1 | HITLS_SECURITY_SECOP_OTHER_CIPHER)
86# define HITLS_SECURITY_SECOP_CIPHER_SHARED (2 | HITLS_SECURITY_SECOP_OTHER_CIPHER)
88# define HITLS_SECURITY_SECOP_CIPHER_CHECK (3 | HITLS_SECURITY_SECOP_OTHER_CIPHER)
90# define HITLS_SECURITY_SECOP_CURVE_SUPPORTED (4 | HITLS_SECURITY_SECOP_OTHER_CURVE)
92# define HITLS_SECURITY_SECOP_CURVE_SHARED (5 | HITLS_SECURITY_SECOP_OTHER_CURVE)
94# define HITLS_SECURITY_SECOP_CURVE_CHECK (6 | HITLS_SECURITY_SECOP_OTHER_CURVE)
96# define HITLS_SECURITY_SECOP_TMP_DH (7 | HITLS_SECURITY_SECOP_OTHER_PKEY)
98# define HITLS_SECURITY_SECOP_VERSION (9 | HITLS_SECURITY_SECOP_OTHER_NONE)
100# define HITLS_SECURITY_SECOP_TICKET (10 | HITLS_SECURITY_SECOP_OTHER_NONE)
102# define HITLS_SECURITY_SECOP_SIGALG_SUPPORTED (11 | HITLS_SECURITY_SECOP_OTHER_SIGALG)
104# define HITLS_SECURITY_SECOP_SIGALG_SHARED (12 | HITLS_SECURITY_SECOP_OTHER_SIGALG)
106# define HITLS_SECURITY_SECOP_SIGALG_CHECK (13 | HITLS_SECURITY_SECOP_OTHER_SIGALG)
108# define HITLS_SECURITY_SECOP_SIGALG_MASK (14 | HITLS_SECURITY_SECOP_OTHER_SIGALG)
110# define HITLS_SECURITY_SECOP_COMPRESSION (15 | HITLS_SECURITY_SECOP_OTHER_NONE)
112# define HITLS_SECURITY_SECOP_EE_KEY (16 | HITLS_SECURITY_SECOP_OTHER_CERT)
114# define HITLS_SECURITY_SECOP_CA_KEY (17 | HITLS_SECURITY_SECOP_OTHER_CERT)
116# define HITLS_SECURITY_SECOP_CA_MD (18 | HITLS_SECURITY_SECOP_OTHER_CERT)
118# define HITLS_SECURITY_SECOP_PEER_EE_KEY (HITLS_SECURITY_SECOP_EE_KEY | HITLS_SECURITY_SECOP_PEER)
120# define HITLS_SECURITY_SECOP_PEER_CA_KEY (HITLS_SECURITY_SECOP_CA_KEY | HITLS_SECURITY_SECOP_PEER)
122# define HITLS_SECURITY_SECOP_PEER_CA_MD (HITLS_SECURITY_SECOP_CA_MD | HITLS_SECURITY_SECOP_PEER)
140 int32_t bits, int32_t id,
void *other,
void *exData);
int32_t HITLS_CFG_SetSecurityExData(HITLS_Config *config, void *securityExData)
Configuring the Security ExData
int32_t HITLS_SetSecurityCb(HITLS_Ctx *ctx, HITLS_SecurityCb securityCb)
Callback function for setting link security
HITLS_SecurityCb HITLS_CFG_GetSecurityCb(const HITLS_Config *config)
Obtain the configured security callback function
void * HITLS_GetSecurityExData(const HITLS_Ctx *ctx)
Obtains the configured Security ExData.
int32_t HITLS_SetSecurityExData(HITLS_Ctx *ctx, void *securityExData)
Setting Security ExData for the Link
int32_t HITLS_CFG_SetSecurityCb(HITLS_Config *config, HITLS_SecurityCb securityCb)
Configure the security callback function.
HITLS_SecurityCb HITLS_GetSecurityCb(const HITLS_Ctx *ctx)
Obtain the Security callback function of the link
int32_t HITLS_SetSecurityLevel(HITLS_Ctx *ctx, int32_t securityLevel)
Set the link security level
int32_t HITLS_CFG_SetSecurityLevel(HITLS_Config *config, int32_t securityLevel)
Configure the security level
void * HITLS_CFG_GetSecurityExData(const HITLS_Config *config)
Obtain the configured Security ExData
int32_t HITLS_GetSecurityLevel(const HITLS_Ctx *ctx, int32_t *securityLevel)
Obtain the link security level
int32_t(* HITLS_SecurityCb)(const HITLS_Ctx *ctx, const HITLS_Config *config, int32_t option, int32_t bits, int32_t id, void *other, void *exData)
Secure Callback Function Prototype
定义 hitls_security.h:139
int32_t HITLS_CFG_GetSecurityLevel(const HITLS_Config *config, int32_t *securityLevel)
Obtain the configured security level.
struct TlsCtx HITLS_Ctx
HITLS context
定义 hitls_type.h:35
struct TlsConfig HITLS_Config
config context
定义 hitls_type.h:41