]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: ssl: move ckch_inst functions to src/ssl_ckch.c
authorWilliam Lallemand <wlallemand@haproxy.com>
Wed, 13 May 2020 13:46:10 +0000 (15:46 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Fri, 15 May 2020 12:11:54 +0000 (14:11 +0200)
Move ckch_inst_new() and ckch_inst_free() to src/ssl_ckch.c

src/ssl_ckch.c
src/ssl_sock.c

index 1a5de31acf80883eaaa2af5aeefa03dcc19a366b..072cd3c18ec7f3c153d5f9d6d2b6aff9804019cb 100644 (file)
@@ -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;
+}
+
index 792fca860a70970d6d62b2393344c7b292821488..43ba750aef73e7ba0a3e5001ddb3fc617d7c3edb 100644 (file)
@@ -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,