mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-26 06:32:13 +00:00
REORG: ssl: move ckch_inst functions to src/ssl_ckch.c
Move ckch_inst_new() and ckch_inst_free() to src/ssl_ckch.c
This commit is contained in:
parent
03c331c80a
commit
fa1d8b4eaa
@ -871,3 +871,42 @@ end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/******************** ckch_inst functions ******************************/
|
||||
|
||||
/* unlink a ckch_inst, free all SNIs, free the ckch_inst */
|
||||
/* The caller must use the lock of the bind_conf if used with inserted SNIs */
|
||||
void ckch_inst_free(struct ckch_inst *inst)
|
||||
{
|
||||
struct sni_ctx *sni, *sni_s;
|
||||
|
||||
if (inst == NULL)
|
||||
return;
|
||||
|
||||
list_for_each_entry_safe(sni, sni_s, &inst->sni_ctx, by_ckch_inst) {
|
||||
SSL_CTX_free(sni->ctx);
|
||||
LIST_DEL(&sni->by_ckch_inst);
|
||||
ebmb_delete(&sni->name);
|
||||
free(sni);
|
||||
}
|
||||
LIST_DEL(&inst->by_ckchs);
|
||||
LIST_DEL(&inst->by_crtlist_entry);
|
||||
free(inst);
|
||||
}
|
||||
|
||||
/* Alloc and init a ckch_inst */
|
||||
struct ckch_inst *ckch_inst_new()
|
||||
{
|
||||
struct ckch_inst *ckch_inst;
|
||||
|
||||
ckch_inst = calloc(1, sizeof *ckch_inst);
|
||||
if (!ckch_inst)
|
||||
return NULL;
|
||||
|
||||
LIST_INIT(&ckch_inst->sni_ctx);
|
||||
LIST_INIT(&ckch_inst->by_ckchs);
|
||||
LIST_INIT(&ckch_inst->by_crtlist_entry);
|
||||
|
||||
return ckch_inst;
|
||||
}
|
||||
|
||||
|
@ -2692,43 +2692,6 @@ int ssl_sock_load_global_dh_param_from_file(const char *filename)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* unlink a ckch_inst, free all SNIs, free the ckch_inst */
|
||||
/* The caller must use the lock of the bind_conf if used with inserted SNIs */
|
||||
void ckch_inst_free(struct ckch_inst *inst)
|
||||
{
|
||||
struct sni_ctx *sni, *sni_s;
|
||||
|
||||
if (inst == NULL)
|
||||
return;
|
||||
|
||||
list_for_each_entry_safe(sni, sni_s, &inst->sni_ctx, by_ckch_inst) {
|
||||
SSL_CTX_free(sni->ctx);
|
||||
LIST_DEL(&sni->by_ckch_inst);
|
||||
ebmb_delete(&sni->name);
|
||||
free(sni);
|
||||
}
|
||||
LIST_DEL(&inst->by_ckchs);
|
||||
LIST_DEL(&inst->by_crtlist_entry);
|
||||
free(inst);
|
||||
}
|
||||
|
||||
/* Alloc and init a ckch_inst */
|
||||
struct ckch_inst *ckch_inst_new()
|
||||
{
|
||||
struct ckch_inst *ckch_inst;
|
||||
|
||||
ckch_inst = calloc(1, sizeof *ckch_inst);
|
||||
if (!ckch_inst)
|
||||
return NULL;
|
||||
|
||||
LIST_INIT(&ckch_inst->sni_ctx);
|
||||
LIST_INIT(&ckch_inst->by_ckchs);
|
||||
LIST_INIT(&ckch_inst->by_crtlist_entry);
|
||||
|
||||
return ckch_inst;
|
||||
}
|
||||
|
||||
|
||||
/* This function allocates a sni_ctx and adds it to the ckch_inst */
|
||||
static int ckch_inst_add_cert_sni(SSL_CTX *ctx, struct ckch_inst *ckch_inst,
|
||||
struct bind_conf *s, struct ssl_bind_conf *conf,
|
||||
|
Loading…
Reference in New Issue
Block a user