45 #define CERT( _index, _path ) \ 46 extern char stored_cert_ ## _index ## _data[]; \ 47 extern char stored_cert_ ## _index ## _len[]; \ 48 __asm__ ( ".section \".rodata\", \"a\", " PROGBITS "\n\t" \ 49 "\nstored_cert_" #_index "_data:\n\t" \ 50 ".incbin \"" _path "\"\n\t" \ 51 "\nstored_cert_" #_index "_end:\n\t" \ 52 ".equ stored_cert_" #_index "_len, " \ 53 "( stored_cert_" #_index "_end - " \ 54 " stored_cert_" #_index "_data )\n\t" \ 60 #define CERT( _index, _path ) { \ 61 .data = stored_cert_ ## _index ## _data, \ 62 .len = ( size_t ) stored_cert_ ## _index ## _len, \ 84 DBGC2 (
store,
"CERTSTORE found certificate %s\n",
186 "is a duplicate of %s\n", i,
x509_name ( cert ));
195 "permanent certificate %d: %s\n",
206 DBGC ( &
certstore,
"CERTSTORE permanent certificate %d is %s\n",
219 .description =
"Certificate",
221 .type = &setting_type_hex,
242 &cert_data ) ) >= 0 ) {
245 "certificate %s\n",
x509_name ( cert ) );
248 "additional certificate: %s\n",
struct arbelprm_rc_send_wqe rc
Dynamic Host Configuration Protocol.
struct x509_chain certstore
Certificate store.
static struct x509_certificate * x509_get(struct x509_certificate *cert)
Get reference to X.509 certificate.
struct refcnt refcnt
Reference count.
#define list_add(new, head)
Add a new entry to the head of a list.
int fetch_raw_setting_copy(struct settings *settings, const struct setting *setting, void **data)
Fetch value of setting.
struct list_head links
List of links.
#define ref_init(refcnt, free)
Initialise a reference counter.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static struct asn1_cursor certstore_raw[]
struct list_head list
List of links.
void certstore_add(struct x509_certificate *cert)
Add certificate to store.
struct x509_certificate * cert
Certificate.
void certstore_del(struct x509_certificate *cert)
Remove certificate from store.
Dynamic memory allocation.
struct init_fn certstore_init_fn __init_fn(INIT_LATE)
Certificate store initialisation function.
#define list_del(list)
Delete an entry from a list.
An X.509 certificate chain.
int count
Current reference count.
An initialisation function.
static int certstore_apply_settings(void)
Apply certificate store configuration settings.
unsigned int(* discard)(void)
Discard some cached data.
#define list_for_each_entry_reverse(pos, head, member)
Iterate over entries in a list in reverse order.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
struct x509_certificate * x509_find(struct x509_chain *store, const struct asn1_cursor *raw)
Identify X.509 certificate by raw certificate data.
static void certstore_found(struct x509_chain *store, struct x509_certificate *cert)
Mark stored certificate as most recently used.
struct cache_discarder certstore_discarder __cache_discarder(CACHE_NORMAL)
Certificate store cache discarder.
#define CACHE_NORMAL
Items with a normal replacement cost.
Certificate was added at build time.
static unsigned int certstore_discard(void)
Discard a stored certificate.
const char * x509_name(struct x509_certificate *cert)
Get X.509 certificate display name.
#define DHCP_EB_CERT
Client certficate.
static void x509_put(struct x509_certificate *cert)
Drop reference to X.509 certificate.
static struct x509_certificate certstore_certs[sizeof(certstore_raw)/sizeof(certstore_raw[0])]
X.509 certificate structures for all permanent stored certificates.
struct x509_link store
Link in certificate store.
#define REF_INIT(free_fn)
Initialise a static reference counter.
int(* apply)(void)
Apply updated settings.
#define SETTING_CRYPTO
Cryptography settings.
#define INIT_LATE
Late initialisation.
#define LIST_HEAD_INIT(list)
Initialise a static list head.
struct settings_applicator certstore_applicator __settings_applicator
Certificate store settings applicator.
static void certstore_init(void)
Construct permanent certificate store.
void ref_no_free(struct refcnt *refcnt __unused)
Do not free reference-counted object.
#define NULL
NULL pointer (VOID *)
Certificate was added explicitly at run time.
int x509_parse(struct x509_certificate *cert, const struct asn1_cursor *raw)
Parse X.509 certificate from ASN.1 data.
struct refcnt refcnt
Reference count.
static struct setting cert_setting __setting(SETTING_CRYPTO, cert)
Additional certificate setting.