[crypto] Allow passing a NULL certificate store to x509_find() et al

Allow passing a NULL value for the certificate list to all functions
used for identifying an X.509 certificate from an existing set of
certificates, and rename function parameters to indicate that this
certificate list represents an unordered certificate store (rather
than an ordered certificate chain).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2024-08-13 12:25:25 +01:00
parent d85590b658
commit 96fb7a0a93
4 changed files with 55 additions and 40 deletions

View File

@@ -204,10 +204,10 @@ struct x509_chain {
struct list_head links;
/** Mark certificate as found
*
* @v certs X.509 certificate list
* @v store Certificate store
* @v cert X.509 certificate
*/
void ( * found ) ( struct x509_chain *certs,
void ( * found ) ( struct x509_chain *store,
struct x509_certificate *cert );
};
@@ -432,19 +432,19 @@ extern int x509_append ( struct x509_chain *chain,
extern int x509_append_raw ( struct x509_chain *chain, const void *data,
size_t len );
extern void x509_truncate ( struct x509_chain *chain, struct x509_link *link );
extern struct x509_certificate * x509_find ( struct x509_chain *certs,
extern struct x509_certificate * x509_find ( struct x509_chain *store,
const struct asn1_cursor *raw );
extern struct x509_certificate *
x509_find_subject ( struct x509_chain *certs,
x509_find_subject ( struct x509_chain *store,
const struct asn1_cursor *subject );
extern struct x509_certificate *
x509_find_issuer_serial ( struct x509_chain *certs,
x509_find_issuer_serial ( struct x509_chain *store,
const struct asn1_cursor *issuer,
const struct asn1_cursor *serial );
extern struct x509_certificate * x509_find_key ( struct x509_chain *certs,
extern struct x509_certificate * x509_find_key ( struct x509_chain *store,
struct private_key *key );
extern int x509_auto_append ( struct x509_chain *chain,
struct x509_chain *certs );
struct x509_chain *store );
extern int x509_validate_chain ( struct x509_chain *chain, time_t time,
struct x509_chain *store,
struct x509_root *root );