shithub: pki

ref: a7d243ef71a1b27166c158ba148da2363402f328
dir: /pki.h/

View raw version
typedef struct Vrf Vrf;
typedef struct CertTab	CertTab;
typedef struct CertEnt	CertEnt;
typedef struct Issuer	Issuer;


enum State {
	Snone,
	Srspec,
	Scsize,
	Scdata,
	Saccept,
	Sreject,
	Serror,
};

enum {
	CFnone,
	CFder,
	CFpem,
};

enum {
	CRnone,
	CRhost,
};

struct CertEnt {
	CertEnt		*next;
	CertX509	*c;
	int		isroot;
	int		thumbok;
};

struct Issuer {
	Issuer	*next;
	CertEnt *certs;
	char	*name;
};

struct CertTab {
	CertTab	*up;
	Issuer	**ent;
	int	nent;
};

struct Vrf {
	Ref;
	Qid		qid;
	int		phase;
	int		ntype;
	char		*name;
	int		cfmt;

	int		rfmt;
	int		rbufsz;
	int		nrbuf;
	uchar		*rbuf;
	int		ncrt;
	int		icert;
	CertTab		*tab;
	CertX509	*vrf;
};

extern	CertTab	*roottab;
void	loadroots(char*);
void	loadthumbs(char*);
int	addcert(CertTab*, CertX509*, int);
CertTab* mktab(CertTab*, int);
int	vfcert(CertTab*, CertX509*);