hx509: add hx509_certs_destroy()

This commit is contained in:
Nicolas Williams
2019-07-11 21:31:41 -05:00
parent e4b35ba13f
commit 41fcafd20c
12 changed files with 154 additions and 5 deletions

View File

@@ -168,6 +168,33 @@ hx509_certs_init(hx509_context context,
return 0;
}
/**
* Destroys and frees a hx509 certificate store.
*
* @param context A hx509 context
* @param certs A store to destroy
*
* @return Returns an hx509 error code.
*
* @ingroup hx509_keyset
*/
HX509_LIB_FUNCTION int HX509_LIB_CALL
hx509_certs_destroy(hx509_context context,
hx509_certs *certs)
{
int ret = 0;
if (*certs) {
if ((*certs)->ops->destroy)
ret = ((*certs)->ops->destroy)(context, *certs, (*certs)->ops_data);
else
ret = ENOTSUP;
}
hx509_certs_free(certs);
return ret;
}
/**
* Write the certificate store to stable storage.
*