15#ifndef HITLS_SECURITY_H
16#define HITLS_SECURITY_H
31#ifndef HITLS_DEFAULT_SECURITY_LEVEL
32#define HITLS_DEFAULT_SECURITY_LEVEL 0
36#define HITLS_SECURITY_LEVEL_ZERO 0
37#define HITLS_SECURITY_LEVEL_ONE 1
38#define HITLS_SECURITY_LEVEL_TWO 2
39#define HITLS_SECURITY_LEVEL_THREE 3
40#define HITLS_SECURITY_LEVEL_FOUR 4
41#define HITLS_SECURITY_LEVEL_FIVE 5
42#define HITLS_SECURITY_LEVEL_MIN HITLS_SECURITY_LEVEL_ZERO
43#define HITLS_SECURITY_LEVEL_MAX HITLS_SECURITY_LEVEL_FIVE
46#define HITLS_SECURITY_LEVEL_ONE_SECBITS 80
47#define HITLS_SECURITY_LEVEL_TWO_SECBITS 112
48#define HITLS_SECURITY_LEVEL_THREE_SECBITS 128
49#define HITLS_SECURITY_LEVEL_FOUR_SECBITS 192
50#define HITLS_SECURITY_LEVEL_FIVE_SECBITS 256
54# define HITLS_SECURITY_SECOP_OTHER_TYPE 0xffff0000
55# define HITLS_SECURITY_SECOP_OTHER_NONE 0
56# define HITLS_SECURITY_SECOP_OTHER_CIPHER (1 << 16)
57# define HITLS_SECURITY_SECOP_OTHER_CURVE (2 << 16)
58# define HITLS_SECURITY_SECOP_OTHER_DH (3 << 16)
59# define HITLS_SECURITY_SECOP_OTHER_PKEY (4 << 16)
60# define HITLS_SECURITY_SECOP_OTHER_SIGALG (5 << 16)
61# define HITLS_SECURITY_SECOP_OTHER_CERT (6 << 16)
64# define HITLS_SECURITY_SECOP_PEER 0x1000
68# define HITLS_SECURITY_SECOP_CIPHER_SUPPORTED (1 | HITLS_SECURITY_SECOP_OTHER_CIPHER)
70# define HITLS_SECURITY_SECOP_CIPHER_SHARED (2 | HITLS_SECURITY_SECOP_OTHER_CIPHER)
72# define HITLS_SECURITY_SECOP_CIPHER_CHECK (3 | HITLS_SECURITY_SECOP_OTHER_CIPHER)
74# define HITLS_SECURITY_SECOP_CURVE_SUPPORTED (4 | HITLS_SECURITY_SECOP_OTHER_CURVE)
76# define HITLS_SECURITY_SECOP_CURVE_SHARED (5 | HITLS_SECURITY_SECOP_OTHER_CURVE)
78# define HITLS_SECURITY_SECOP_CURVE_CHECK (6 | HITLS_SECURITY_SECOP_OTHER_CURVE)
80# define HITLS_SECURITY_SECOP_TMP_DH (7 | HITLS_SECURITY_SECOP_OTHER_PKEY)
82# define HITLS_SECURITY_SECOP_VERSION (9 | HITLS_SECURITY_SECOP_OTHER_NONE)
84# define HITLS_SECURITY_SECOP_TICKET (10 | HITLS_SECURITY_SECOP_OTHER_NONE)
86# define HITLS_SECURITY_SECOP_SIGALG_SUPPORTED (11 | HITLS_SECURITY_SECOP_OTHER_SIGALG)
88# define HITLS_SECURITY_SECOP_SIGALG_SHARED (12 | HITLS_SECURITY_SECOP_OTHER_SIGALG)
90# define HITLS_SECURITY_SECOP_SIGALG_CHECK (13 | HITLS_SECURITY_SECOP_OTHER_SIGALG)
92# define HITLS_SECURITY_SECOP_SIGALG_MASK (14 | HITLS_SECURITY_SECOP_OTHER_SIGALG)
94# define HITLS_SECURITY_SECOP_COMPRESSION (15 | HITLS_SECURITY_SECOP_OTHER_NONE)
96# define HITLS_SECURITY_SECOP_EE_KEY (16 | HITLS_SECURITY_SECOP_OTHER_CERT)
98# define HITLS_SECURITY_SECOP_CA_KEY (17 | HITLS_SECURITY_SECOP_OTHER_CERT)
100# define HITLS_SECURITY_SECOP_CA_MD (18 | HITLS_SECURITY_SECOP_OTHER_CERT)
102# define HITLS_SECURITY_SECOP_PEER_EE_KEY (HITLS_SECURITY_SECOP_EE_KEY | HITLS_SECURITY_SECOP_PEER)
104# define HITLS_SECURITY_SECOP_PEER_CA_KEY (HITLS_SECURITY_SECOP_CA_KEY | HITLS_SECURITY_SECOP_PEER)
106# define HITLS_SECURITY_SECOP_PEER_CA_MD (HITLS_SECURITY_SECOP_CA_MD | HITLS_SECURITY_SECOP_PEER)
125 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
Definition hitls_security.h:124
int32_t HITLS_CFG_GetSecurityLevel(const HITLS_Config *config, int32_t *securityLevel)
Obtain the configured security level.
struct TlsCtx HITLS_Ctx
HITLS context
Definition hitls_type.h:28
struct TlsConfig HITLS_Config
config context
Definition hitls_type.h:34