iPXE
certstore.h File Reference

Certificate store. More...

#include <ipxe/x509.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
void certstore_add (struct x509_certificate *cert)
 Add certificate to store.
void certstore_del (struct x509_certificate *cert)
 Remove certificate from store.

Variables

struct x509_chain certstore
 Certificate store.

Detailed Description

Certificate store.

Definition in file certstore.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

References certstore.

◆ certstore_add()

void certstore_add ( struct x509_certificate * cert)
extern

Add certificate to store.

Parameters
certX.509 certificate

Definition at line 101 of file certstore.c.

101 {
102
103 /* Add certificate to store */
104 cert->store.cert = cert;
105 x509_get ( cert );
106 list_add ( &cert->store.list, &certstore.links );
107 DBGC ( &certstore, "CERTSTORE added certificate %s\n",
108 x509_name ( cert ) );
109}
struct x509_chain certstore
Certificate store.
Definition certstore.c:90
#define DBGC(...)
Definition compiler.h:505
#define list_add(new, head)
Add a new entry to the head of a list.
Definition list.h:70
struct x509_link store
Link in certificate store.
Definition x509.h:221
const char * x509_name(struct x509_certificate *cert)
Get X.509 certificate display name.
Definition x509.c:147
static struct x509_certificate * x509_get(struct x509_certificate *cert)
Get reference to X.509 certificate.
Definition x509.h:267

References x509_link::cert, certstore, DBGC, x509_link::list, list_add, x509_certificate::store, x509_get(), and x509_name().

Referenced by certstore_init(), and x509_certificate().

◆ certstore_del()

void certstore_del ( struct x509_certificate * cert)
extern

Remove certificate from store.

Parameters
certX.509 certificate

Definition at line 116 of file certstore.c.

116 {
117
118 /* Ignore attempts to remove permanent certificates */
119 if ( cert->flags & X509_FL_PERMANENT )
120 return;
121
122 /* Remove certificate from store */
123 DBGC ( &certstore, "CERTSTORE removed certificate %s\n",
124 x509_name ( cert ) );
125 list_del ( &cert->store.list );
126 x509_put ( cert );
127}
#define list_del(list)
Delete an entry from a list.
Definition list.h:120
unsigned int flags
Flags.
Definition x509.h:224
static void x509_put(struct x509_certificate *cert)
Drop reference to X.509 certificate.
Definition x509.h:278
@ X509_FL_PERMANENT
Certificate was added at build time.
Definition x509.h:255

References certstore, DBGC, x509_certificate::flags, x509_link::list, list_del, x509_certificate::store, X509_FL_PERMANENT, x509_name(), and x509_put().

Referenced by certfree_payload(), and certstore_discard().

Variable Documentation

◆ certstore

struct x509_chain certstore
extern

Certificate store.

Definition at line 90 of file certstore.c.

90 {
91 .refcnt = REF_INIT ( ref_no_free ),
92 .links = LIST_HEAD_INIT ( certstore.links ),
93 .found = certstore_found,
94};
static void certstore_found(struct x509_chain *store, struct x509_certificate *cert)
Mark stored certificate as most recently used.
Definition certstore.c:79
#define LIST_HEAD_INIT(list)
Initialise a static list head.
Definition list.h:31
void ref_no_free(struct refcnt *refcnt __unused)
Do not free reference-counted object.
Definition refcnt.c:102
#define REF_INIT(free_fn)
Initialise a static reference counter.
Definition refcnt.h:78

Referenced by cert_exec(), certstore_add(), certstore_apply_settings(), certstore_del(), certstore_discard(), certstore_init(), COMMAND(), FILE_SECBOOT(), REQUIRE_OBJECT(), REQUIRING_SYMBOL(), tls_new_certificate_request(), x509_find(), x509_find_issuer_serial(), x509_find_key(), and x509_find_subject().