vici: Keep track of all CA certificates in vici_authority_t

This way we only have one reference for each CA certificate, whether it
is loaded in an authority section, a connection or via load-certs() command.
It also avoids enumerating CA certificates multiple times if they are
loaded in different ways.
This commit is contained in:
Tobias Brunner
2020-07-20 14:05:39 +02:00
parent 3d3d5235aa
commit 3c5e7eaa88
6 changed files with 193 additions and 29 deletions
+15 -1
View File
@@ -1,4 +1,5 @@
/*
* Copyright (C) 2020 Tobias Brunner
* Copyright (C) 2015 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
@@ -22,7 +23,6 @@
#define VICI_AUTHORITY_H_
#include "vici_dispatcher.h"
#include "vici_cred.h"
typedef struct vici_authority_t vici_authority_t;
@@ -36,6 +36,20 @@ struct vici_authority_t {
*/
credential_set_t set;
/**
* Add a CA certificate and return a reference if it is already stored,
* otherwise returns the same certificate.
*
* @param cert certificate to check
* @return reference to stored CA certificate, or original
*/
certificate_t *(*add_ca_cert)(vici_authority_t *this, certificate_t *cert);
/**
* Remove CA certificates added via add_ca_cert().
*/
void (*clear_ca_certs)(vici_authority_t *this);
/**
* Destroy a vici_authority_t.
*/