validator.h File Reference

Certificate validator. More...

#include <ipxe/interface.h>
#include <ipxe/x509.h>

Go to the source code of this file.


int create_validator (struct interface *job, struct x509_chain *chain)
 Instantiate a certificate validator. More...

Detailed Description

Certificate validator.

Definition in file validator.h.

Function Documentation



◆ create_validator()

int create_validator ( struct interface job,
struct x509_chain chain 

Instantiate a certificate validator.

jobJob control interface
chainX.509 certificate chain
Return values
rcReturn status code

Definition at line 626 of file validator.c.

626  {
627  struct validator *validator;
628  int rc;
630  /* Sanity check */
631  if ( ! chain ) {
632  rc = -EINVAL;
633  goto err_sanity;
634  }
636  /* Allocate and initialise structure */
637  validator = zalloc ( sizeof ( *validator ) );
638  if ( ! validator ) {
639  rc = -ENOMEM;
640  goto err_alloc;
641  }
644  &validator->refcnt );
646  &validator->refcnt );
648  &validator->refcnt );
650  xferbuf_malloc_init ( &validator->buffer );
652  /* Attach parent interface, mortalise self, and return */
654  ref_put ( &validator->refcnt );
655  DBGC2 ( validator, "VALIDATOR %p \"%s\" validating X509 chain %p\n",
657  return 0;
660  ref_put ( &validator->refcnt );
661  err_alloc:
662  err_sanity:
663  return rc;
664 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static struct x509_chain * x509_chain_get(struct x509_chain *chain)
Get reference to X.509 certificate chain.
Definition: x509.h:258
struct process process
Definition: validator.c:74
struct refcnt refcnt
Reference count.
Definition: validator.c:67
#define ref_init(refcnt, free)
Initialise a reference counter.
Definition: refcnt.h:64
static void process_init(struct process *process, struct process_descriptor *desc, struct refcnt *refcnt)
Initialise process and add to process list.
Definition: process.h:161
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
Definition: interface.c:102
struct x509_chain * chain
X.509 certificate chain.
Definition: validator.c:77
A certificate validator.
Definition: validator.c:65
struct interface xfer
Data transfer interface.
Definition: validator.c:71
#define ENOMEM
Not enough space.
Definition: errno.h:534
static struct interface_descriptor validator_xfer_desc
Certificate validator data transfer interface descriptor.
Definition: validator.c:529
static struct process_descriptor validator_process_desc
Certificate validator process descriptor.
Definition: validator.c:610
static void validator_free(struct refcnt *refcnt)
Free certificate validator.
Definition: validator.c:111
struct xfer_buffer buffer
Data buffer.
Definition: validator.c:81
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
static struct interface_descriptor validator_job_desc
Certificate validator job control interface descriptor.
Definition: validator.c:172
#define DBGC2(...)
Definition: compiler.h:522
struct interface job
Job control interface.
Definition: validator.c:69
static void validator_finished(struct validator *validator, int rc)
Mark certificate validation as finished.
Definition: validator.c:129
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
Definition: interface.h:173
#define ref_put(refcnt)
Drop reference to object.
Definition: refcnt.h:106
static const char * validator_name(struct validator *validator)
Get validator name (for debug messages)
Definition: validator.c:100

References validator::buffer, validator::chain, DBGC2, EINVAL, ENOMEM, intf_init(), intf_plug_plug(), validator::job, validator::process, process_init(), rc, ref_init, ref_put, validator::refcnt, validator_finished(), validator_free(), validator_job_desc, validator_name(), validator_process_desc, validator_xfer_desc, x509_chain_get(), validator::xfer, and zalloc().

Referenced by imgverify(), and tls_new_server_hello_done().