mem-cred: Add a method to unify certificate references, without adding it

In contrast to add_cert_ref(), get_cert_ref() does not add the certificate to
the set, but only finds a reference to the same certificate, if found.
This commit is contained in:
Martin Willi
2015-03-03 13:50:26 +01:00
parent aba46b104e
commit ef2c61bc92
2 changed files with 31 additions and 0 deletions
@@ -58,6 +58,18 @@ struct mem_cred_t {
certificate_t *(*add_cert_ref)(mem_cred_t *this, bool trusted,
certificate_t *cert);
/**
* Get an existing reference to the same certificate.
*
* Searches for the same certficate in the set, and returns a reference
* to it, destroying the passed certificate. If the passed certificate
* is not found, it is just returned.
*
* @param cert certificate to look up
* @return the same certificate, potentially different instance
*/
certificate_t* (*get_cert_ref)(mem_cred_t *this, certificate_t *cert);
/**
* Add an X.509 CRL to the credential set.
*