iPXE
|
Certificate store. More...
#include <string.h>
#include <stdlib.h>
#include <ipxe/init.h>
#include <ipxe/dhcp.h>
#include <ipxe/settings.h>
#include <ipxe/malloc.h>
#include <ipxe/crypto.h>
#include <ipxe/asn1.h>
#include <ipxe/x509.h>
#include <ipxe/certstore.h>
Go to the source code of this file.
Macros | |
#define | CERT(_index, _path) |
Raw certificate data for all permanent stored certificates. More... | |
#define | CERT(_index, _path) |
Raw certificate data for all permanent stored certificates. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static struct x509_certificate * | certstore_found (struct x509_certificate *cert) |
Mark stored certificate as most recently used. More... | |
struct x509_certificate * | certstore_find (struct asn1_cursor *raw) |
Find certificate in store. More... | |
struct x509_certificate * | certstore_find_key (struct private_key *key) |
Find certificate in store corresponding to a private key. More... | |
void | certstore_add (struct x509_certificate *cert) |
Add certificate to store. More... | |
void | certstore_del (struct x509_certificate *cert) |
Remove certificate from store. More... | |
static unsigned int | certstore_discard (void) |
Discard a stored certificate. More... | |
struct cache_discarder certstore_discarder | __cache_discarder (CACHE_NORMAL) |
Certificate store cache discarder. More... | |
static void | certstore_init (void) |
Construct permanent certificate store. More... | |
struct init_fn certstore_init_fn | __init_fn (INIT_LATE) |
Certificate store initialisation function. More... | |
static struct setting cert_setting | __setting (SETTING_CRYPTO, cert) |
Additional certificate setting. More... | |
static int | certstore_apply_settings (void) |
Apply certificate store configuration settings. More... | |
Variables | |
static struct asn1_cursor | certstore_raw [] |
static struct x509_certificate | certstore_certs [sizeof(certstore_raw)/sizeof(certstore_raw[0])] |
X.509 certificate structures for all permanent stored certificates. More... | |
struct x509_chain | certstore |
Certificate store. More... | |
struct settings_applicator certstore_applicator | __settings_applicator |
Certificate store settings applicator. More... | |
Certificate store.
Definition in file certstore.c.
#define CERT | ( | _index, | |
_path | |||
) |
Raw certificate data for all permanent stored certificates.
Raw certificate cursors for all permanent stored certificates.
Definition at line 60 of file certstore.c.
#define CERT | ( | _index, | |
_path | |||
) |
Raw certificate data for all permanent stored certificates.
Raw certificate cursors for all permanent stored certificates.
Definition at line 60 of file certstore.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Mark stored certificate as most recently used.
cert | X.509 certificate |
cert | X.509 certificate |
Definition at line 85 of file certstore.c.
References certstore, DBGC2, x509_chain::links, x509_link::list, list_add, list_del, x509_certificate::store, and x509_name().
Referenced by certstore_find(), and certstore_find_key().
struct x509_certificate* certstore_find | ( | struct asn1_cursor * | raw | ) |
Find certificate in store.
raw | Raw certificate data |
cert | X.509 certificate, or NULL if not found |
Definition at line 102 of file certstore.c.
References asn1_compare(), certstore, certstore_found(), x509_chain::links, x509_link::list, list_for_each_entry, NULL, raw, x509_certificate::raw, and x509_certificate::store.
Referenced by certstore_init(), and x509_certificate().
struct x509_certificate* certstore_find_key | ( | struct private_key * | key | ) |
Find certificate in store corresponding to a private key.
key | Private key |
cert | X.509 certificate, or NULL if not found |
Definition at line 119 of file certstore.c.
References certstore, certstore_found(), asn1_cursor::data, key, asn1_cursor::len, x509_chain::links, x509_link::list, list_for_each_entry, NULL, asn1_algorithm::pubkey, pubkey_match(), x509_subject::public_key, x509_public_key::raw, x509_certificate::signature_algorithm, x509_certificate::store, and x509_certificate::subject.
Referenced by tls_new_certificate_request().
void certstore_add | ( | struct x509_certificate * | cert | ) |
Add certificate to store.
cert | X.509 certificate |
Definition at line 138 of file certstore.c.
References x509_link::cert, certstore, DBGC, x509_chain::links, x509_link::list, list_add, x509_certificate::store, x509_get(), and x509_name().
Referenced by certstore_init(), and x509_certificate().
void certstore_del | ( | struct x509_certificate * | cert | ) |
Remove certificate from store.
cert | X.509 certificate |
Definition at line 153 of file certstore.c.
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().
|
static |
Discard a stored certificate.
discarded | Number of cached items discarded |
Definition at line 171 of file certstore.c.
References certstore, certstore_del(), refcnt::count, x509_certificate::flags, x509_chain::links, x509_link::list, list_for_each_entry_reverse, x509_certificate::refcnt, x509_certificate::store, X509_FL_EXPLICIT, and X509_FL_PERMANENT.
struct cache_discarder certstore_discarder __cache_discarder | ( | CACHE_NORMAL | ) |
Certificate store cache discarder.
|
static |
Construct permanent certificate store.
Definition at line 206 of file certstore.c.
References certstore, certstore_add(), certstore_certs, certstore_find(), certstore_raw, DBGC, x509_certificate::flags, NULL, raw, rc, ref_init, ref_no_free(), x509_certificate::refcnt, strerror(), X509_FL_PERMANENT, x509_name(), and x509_parse().
|
static |
Additional certificate setting.
|
static |
Apply certificate store configuration settings.
rc | Return status code |
Definition at line 267 of file certstore.c.
References certstore, DBGC, fetch_raw_setting_copy(), free, len, NULL, rc, strerror(), x509_name(), and x509_put().
|
static |
Definition at line 64 of file certstore.c.
Referenced by certstore_init().
|
static |
X.509 certificate structures for all permanent stored certificates.
Definition at line 69 of file certstore.c.
Referenced by certstore_init().
struct x509_chain certstore |
Certificate store.
Definition at line 73 of file certstore.c.
Referenced by certstore_add(), certstore_apply_settings(), certstore_del(), certstore_discard(), certstore_find(), certstore_find_key(), certstore_found(), certstore_init(), tls_new_certificate_request(), and x509_validate_chain().
struct settings_applicator certstore_applicator __settings_applicator |
Certificate store settings applicator.
Definition at line 304 of file certstore.c.