CLEANUP: ssl: add ckch prototypes in proto/ssl_ckch.h

Remove the static definitions of the ckch functions and add them to
ssl_ckch.h in order to use them outside ssl_sock.c.
This commit is contained in:
William Lallemand 2020-05-12 17:42:42 +02:00 committed by William Lallemand
parent d4632b2b6d
commit c69973f7eb
2 changed files with 43 additions and 4 deletions

38
include/proto/ssl_ckch.h Normal file
View File

@ -0,0 +1,38 @@
/*
* include/proto/ssl_ckch.h
* ckch function prototypes
*
* Copyright (C) 2020 HAProxy Technologies, William Lallemand <wlallemand@haproxy.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, version 2.1
* exclusively.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _PROTO_SSL_CKCH_H
#define _PROTO_SSL_CKCH_H
#ifdef USE_OPENSSL
#include <types/ssl_ckch.h>
/* ckch_store functions */
struct ckch_store *ckchs_load_cert_file(char *path, int multi, char **err);
struct ckch_store *ckchs_lookup(char *path);
/* ckch_inst functions */
void ckch_inst_free(struct ckch_inst *inst);
struct ckch_inst *ckch_inst_new();
#endif /* USE_OPENSSL */
#endif /* _PROTO_SSL_CRTLIST_H */

View File

@ -84,6 +84,7 @@
#include <proto/log.h>
#include <proto/proxy.h>
#include <proto/shctx.h>
#include <proto/ssl_ckch.h>
#include <proto/ssl_sock.h>
#include <proto/stream.h>
#include <proto/task.h>
@ -2908,7 +2909,7 @@ void ssl_sock_free_ssl_conf(struct ssl_bind_conf *conf)
/* 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 */
static void ckch_inst_free(struct ckch_inst *inst)
void ckch_inst_free(struct ckch_inst *inst)
{
struct sni_ctx *sni, *sni_s;
@ -2927,7 +2928,7 @@ static void ckch_inst_free(struct ckch_inst *inst)
}
/* Alloc and init a ckch_inst */
static struct ckch_inst *ckch_inst_new()
struct ckch_inst *ckch_inst_new()
{
struct ckch_inst *ckch_inst;
@ -4005,7 +4006,7 @@ error:
/*
* lookup a path into the ckchs tree.
*/
static inline struct ckch_store *ckchs_lookup(char *path)
struct ckch_store *ckchs_lookup(char *path)
{
struct ebmb_node *eb;
@ -4019,7 +4020,7 @@ static inline struct ckch_store *ckchs_lookup(char *path)
/*
* This function allocate a ckch_store and populate it with certificates from files.
*/
static struct ckch_store *ckchs_load_cert_file(char *path, int multi, char **err)
struct ckch_store *ckchs_load_cert_file(char *path, int multi, char **err)
{
struct ckch_store *ckchs;