2024-12-02 06:55:02 -08:00
|
|
|
/* $OpenBSD: extern.h,v 1.234 2024/12/02 14:55:02 job Exp $ */
|
2019-06-17 07:31:30 -07:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
#ifndef EXTERN_H
|
|
|
|
#define EXTERN_H
|
|
|
|
|
2021-02-04 00:10:24 -08:00
|
|
|
#include <sys/queue.h>
|
2019-10-08 03:04:36 -07:00
|
|
|
#include <sys/tree.h>
|
2020-04-30 06:46:39 -07:00
|
|
|
#include <sys/time.h>
|
2019-10-08 03:04:36 -07:00
|
|
|
|
2020-09-12 08:46:48 -07:00
|
|
|
#include <openssl/x509.h>
|
2022-04-12 01:45:34 -07:00
|
|
|
#include <openssl/x509v3.h>
|
2020-09-12 08:46:48 -07:00
|
|
|
|
2024-05-20 08:51:43 -07:00
|
|
|
#define CTASSERT(x) extern char _ctassert[(x) ? 1 : -1 ] \
|
|
|
|
__attribute__((__unused__))
|
|
|
|
|
2024-11-21 05:32:27 -08:00
|
|
|
#define MAX_MSG_SIZE (50 * 1024 * 1024)
|
|
|
|
|
2019-11-26 20:32:09 -08:00
|
|
|
enum cert_as_type {
|
2019-06-17 07:31:30 -07:00
|
|
|
CERT_AS_ID, /* single identifier */
|
2024-03-18 22:04:13 -07:00
|
|
|
CERT_AS_INHERIT, /* inherit from issuer */
|
2019-06-17 07:31:30 -07:00
|
|
|
CERT_AS_RANGE, /* range of identifiers */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* An AS identifier range.
|
|
|
|
* The maximum AS identifier is an unsigned 32 bit integer (RFC 6793).
|
|
|
|
*/
|
2019-11-26 20:32:09 -08:00
|
|
|
struct cert_as_range {
|
2019-06-17 07:31:30 -07:00
|
|
|
uint32_t min; /* minimum non-zero */
|
|
|
|
uint32_t max; /* maximum */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* An autonomous system (AS) object.
|
|
|
|
* AS identifiers are unsigned 32 bit integers (RFC 6793).
|
|
|
|
*/
|
2019-11-26 20:32:09 -08:00
|
|
|
struct cert_as {
|
2019-06-17 07:31:30 -07:00
|
|
|
enum cert_as_type type; /* type of AS specification */
|
|
|
|
union {
|
|
|
|
uint32_t id; /* singular identifier */
|
|
|
|
struct cert_as_range range; /* range */
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* AFI values are assigned by IANA.
|
|
|
|
* In rpki-client, we only accept the IPV4 and IPV6 AFI values.
|
|
|
|
*/
|
2019-11-26 20:32:09 -08:00
|
|
|
enum afi {
|
2019-06-19 08:47:34 -07:00
|
|
|
AFI_IPV4 = 1,
|
|
|
|
AFI_IPV6 = 2
|
2019-06-17 07:31:30 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* An IP address as parsed from RFC 3779, section 2.2.3.8.
|
|
|
|
* This is either in a certificate or an ROA.
|
|
|
|
* It may either be IPv4 or IPv6.
|
|
|
|
*/
|
2019-11-26 20:32:09 -08:00
|
|
|
struct ip_addr {
|
2019-06-17 07:31:30 -07:00
|
|
|
unsigned char addr[16]; /* binary address prefix */
|
2019-06-19 08:47:34 -07:00
|
|
|
unsigned char prefixlen; /* number of valid bits in address */
|
2019-06-17 07:31:30 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* An IP address (IPv4 or IPv6) range starting at the minimum and making
|
|
|
|
* its way to the maximum.
|
|
|
|
*/
|
2019-11-26 20:32:09 -08:00
|
|
|
struct ip_addr_range {
|
2019-06-17 07:31:30 -07:00
|
|
|
struct ip_addr min; /* minimum ip */
|
|
|
|
struct ip_addr max; /* maximum ip */
|
|
|
|
};
|
|
|
|
|
2019-11-26 20:32:09 -08:00
|
|
|
enum cert_ip_type {
|
2019-06-17 07:31:30 -07:00
|
|
|
CERT_IP_ADDR, /* IP address range w/shared prefix */
|
|
|
|
CERT_IP_INHERIT, /* inherited IP address */
|
|
|
|
CERT_IP_RANGE /* range of IP addresses */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A single IP address family (AFI, address or range) as defined in RFC
|
|
|
|
* 3779, 2.2.3.2.
|
|
|
|
* The RFC specifies multiple address or ranges per AFI; this structure
|
|
|
|
* encodes both the AFI and a single address or range.
|
|
|
|
*/
|
2019-11-26 20:32:09 -08:00
|
|
|
struct cert_ip {
|
2019-06-18 21:21:43 -07:00
|
|
|
enum afi afi; /* AFI value */
|
|
|
|
enum cert_ip_type type; /* type of IP entry */
|
|
|
|
unsigned char min[16]; /* full range minimum */
|
|
|
|
unsigned char max[16]; /* full range maximum */
|
2019-06-17 07:31:30 -07:00
|
|
|
union {
|
|
|
|
struct ip_addr ip; /* singular address */
|
|
|
|
struct ip_addr_range range; /* range */
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-10-05 04:20:46 -07:00
|
|
|
enum cert_purpose {
|
2021-10-11 09:50:03 -07:00
|
|
|
CERT_PURPOSE_INVALID,
|
2024-06-08 06:29:54 -07:00
|
|
|
CERT_PURPOSE_TA,
|
2021-10-11 09:50:03 -07:00
|
|
|
CERT_PURPOSE_CA,
|
2024-06-08 06:29:54 -07:00
|
|
|
CERT_PURPOSE_EE,
|
|
|
|
CERT_PURPOSE_BGPSEC_ROUTER,
|
2021-10-05 04:20:46 -07:00
|
|
|
};
|
|
|
|
|
2019-06-17 07:31:30 -07:00
|
|
|
/*
|
|
|
|
* Parsed components of a validated X509 certificate stipulated by RFC
|
|
|
|
* 6847 and further (within) by RFC 3779.
|
|
|
|
* All AS numbers are guaranteed to be non-overlapping and properly
|
|
|
|
* inheriting.
|
|
|
|
*/
|
2019-11-26 20:32:09 -08:00
|
|
|
struct cert {
|
2024-11-12 01:23:07 -08:00
|
|
|
struct cert_ip *ips; /* list of IP address ranges */
|
|
|
|
size_t num_ips;
|
|
|
|
struct cert_as *ases; /* list of AS numbers and ranges */
|
|
|
|
size_t num_ases;
|
2021-11-04 04:32:55 -07:00
|
|
|
int talid; /* cert is covered by which TAL */
|
2024-05-20 08:51:43 -07:00
|
|
|
int certid;
|
2022-09-03 06:30:27 -07:00
|
|
|
unsigned int repoid; /* repository of this cert file */
|
2021-02-08 01:22:53 -08:00
|
|
|
char *repo; /* CA repository (rsync:// uri) */
|
2019-06-17 07:31:30 -07:00
|
|
|
char *mft; /* manifest (rsync:// uri) */
|
2020-07-28 00:35:04 -07:00
|
|
|
char *notify; /* RRDP notify (https:// uri) */
|
2019-06-17 07:31:30 -07:00
|
|
|
char *crl; /* CRL location (rsync:// or NULL) */
|
2021-02-15 23:58:30 -08:00
|
|
|
char *aia; /* AIA (or NULL, for trust anchor) */
|
2019-06-17 07:31:30 -07:00
|
|
|
char *aki; /* AKI (or NULL, for trust anchor) */
|
|
|
|
char *ski; /* SKI */
|
2021-11-04 04:32:55 -07:00
|
|
|
enum cert_purpose purpose; /* BGPSec or CA */
|
2021-10-12 08:16:45 -07:00
|
|
|
char *pubkey; /* Subject Public Key Info */
|
2019-11-26 20:32:09 -08:00
|
|
|
X509 *x509; /* the cert */
|
2023-03-10 04:02:11 -08:00
|
|
|
time_t notbefore; /* cert's Not Before */
|
2023-03-10 04:44:56 -08:00
|
|
|
time_t notafter; /* cert's Not After */
|
2023-03-13 12:51:49 -07:00
|
|
|
time_t expires; /* when the signature path expires */
|
2019-06-17 07:31:30 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The TAL file conforms to RFC 7730.
|
|
|
|
* It is the top-level structure of RPKI and defines where we can find
|
|
|
|
* certificates for TAs (trust anchors).
|
|
|
|
* It also includes the public key for verifying those trust anchor
|
|
|
|
* certificates.
|
|
|
|
*/
|
2019-11-26 20:32:09 -08:00
|
|
|
struct tal {
|
2019-06-17 07:31:30 -07:00
|
|
|
char **uri; /* well-formed rsync URIs */
|
2024-11-13 04:51:03 -08:00
|
|
|
size_t num_uris;
|
2019-06-18 21:21:43 -07:00
|
|
|
unsigned char *pkey; /* DER-encoded public key */
|
|
|
|
size_t pkeysz; /* length of pkey */
|
2019-10-08 03:04:36 -07:00
|
|
|
char *descr; /* basename of tal file */
|
2021-11-04 04:32:55 -07:00
|
|
|
int id; /* ID of this TAL */
|
2019-06-17 07:31:30 -07:00
|
|
|
};
|
|
|
|
|
2022-01-21 10:49:44 -08:00
|
|
|
/*
|
|
|
|
* Resource types specified by the RPKI profiles.
|
|
|
|
* There might be others we don't consider.
|
|
|
|
*/
|
|
|
|
enum rtype {
|
|
|
|
RTYPE_INVALID,
|
|
|
|
RTYPE_TAL,
|
|
|
|
RTYPE_MFT,
|
|
|
|
RTYPE_ROA,
|
|
|
|
RTYPE_CER,
|
|
|
|
RTYPE_CRL,
|
|
|
|
RTYPE_GBR,
|
|
|
|
RTYPE_REPO,
|
|
|
|
RTYPE_FILE,
|
2022-05-09 10:02:34 -07:00
|
|
|
RTYPE_RSC,
|
2022-08-30 11:56:49 -07:00
|
|
|
RTYPE_ASPA,
|
2022-11-02 05:43:02 -07:00
|
|
|
RTYPE_TAK,
|
2022-11-26 04:02:36 -08:00
|
|
|
RTYPE_GEOFEED,
|
2024-02-22 04:49:42 -08:00
|
|
|
RTYPE_SPL,
|
2022-01-21 10:49:44 -08:00
|
|
|
};
|
|
|
|
|
2022-01-28 07:30:23 -08:00
|
|
|
enum location {
|
|
|
|
DIR_UNKNOWN,
|
|
|
|
DIR_TEMP,
|
|
|
|
DIR_VALID,
|
|
|
|
};
|
|
|
|
|
2019-06-17 07:31:30 -07:00
|
|
|
/*
|
|
|
|
* Files specified in an MFT have their bodies hashed with SHA256.
|
|
|
|
*/
|
2019-11-26 20:32:09 -08:00
|
|
|
struct mftfile {
|
2019-06-17 07:31:30 -07:00
|
|
|
char *file; /* filename (CER/ROA/CRL, no path) */
|
2022-01-21 10:49:44 -08:00
|
|
|
enum rtype type; /* file type as determined by extension */
|
2022-01-28 07:30:23 -08:00
|
|
|
enum location location; /* temporary or valid directory */
|
2019-06-17 07:31:30 -07:00
|
|
|
unsigned char hash[SHA256_DIGEST_LENGTH]; /* sha256 of body */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A manifest, RFC 6486.
|
|
|
|
* This consists of a bunch of files found in the same directory as the
|
|
|
|
* manifest file.
|
|
|
|
*/
|
2019-11-26 20:32:09 -08:00
|
|
|
struct mft {
|
2022-01-11 05:06:07 -08:00
|
|
|
char *path; /* relative path to directory of the MFT */
|
2019-06-17 07:31:30 -07:00
|
|
|
struct mftfile *files; /* file and hash */
|
2021-03-28 09:22:17 -07:00
|
|
|
char *seqnum; /* manifestNumber */
|
2021-02-15 23:58:30 -08:00
|
|
|
char *aia; /* AIA */
|
2019-06-17 07:31:30 -07:00
|
|
|
char *aki; /* AKI */
|
2022-11-04 02:43:13 -07:00
|
|
|
char *sia; /* SIA signedObject */
|
2021-02-15 23:58:30 -08:00
|
|
|
char *ski; /* SKI */
|
2022-04-19 02:52:29 -07:00
|
|
|
char *crl; /* CRL file name */
|
2023-12-11 11:05:20 -08:00
|
|
|
unsigned char mfthash[SHA256_DIGEST_LENGTH];
|
2022-04-19 02:52:29 -07:00
|
|
|
unsigned char crlhash[SHA256_DIGEST_LENGTH];
|
2023-03-09 01:46:21 -08:00
|
|
|
time_t signtime; /* CMS signing-time attribute */
|
2023-03-13 02:24:37 -07:00
|
|
|
time_t thisupdate; /* from the eContent */
|
|
|
|
time_t nextupdate; /* from the eContent */
|
2023-03-13 12:51:49 -07:00
|
|
|
time_t expires; /* when the signature path expires */
|
2022-01-28 07:30:23 -08:00
|
|
|
size_t filesz; /* number of filenames */
|
2022-01-11 05:06:07 -08:00
|
|
|
unsigned int repoid;
|
2023-04-26 09:32:41 -07:00
|
|
|
int talid;
|
2024-05-20 08:51:43 -07:00
|
|
|
int certid;
|
2024-11-02 05:30:28 -07:00
|
|
|
int seqnum_gap; /* was there a gap compared to prev mft? */
|
2019-06-17 07:31:30 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* An IP address prefix for a given ROA.
|
|
|
|
* This encodes the maximum length, AFI (v6/v4), and address.
|
|
|
|
* FIXME: are the min/max necessary or just used in one place?
|
|
|
|
*/
|
2019-11-26 20:32:09 -08:00
|
|
|
struct roa_ip {
|
2019-06-17 07:31:30 -07:00
|
|
|
enum afi afi; /* AFI value */
|
2021-12-22 01:35:14 -08:00
|
|
|
struct ip_addr addr; /* the address prefix itself */
|
2019-06-17 07:31:30 -07:00
|
|
|
unsigned char min[16]; /* full range minimum */
|
|
|
|
unsigned char max[16]; /* full range maximum */
|
2021-12-22 01:35:14 -08:00
|
|
|
unsigned char maxlength; /* max length or zero */
|
2019-06-17 07:31:30 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* An ROA, RFC 6482.
|
|
|
|
* This consists of the concerned ASID and its IP prefixes.
|
|
|
|
*/
|
2019-11-26 20:32:09 -08:00
|
|
|
struct roa {
|
2019-06-17 07:31:30 -07:00
|
|
|
uint32_t asid; /* asID of ROA (if 0, RFC 6483 sec 4) */
|
2024-11-12 01:23:07 -08:00
|
|
|
struct roa_ip *ips; /* IP prefixes */
|
|
|
|
size_t num_ips;
|
2021-11-04 04:32:55 -07:00
|
|
|
int talid; /* ROAs are covered by which TAL */
|
2019-06-17 07:31:30 -07:00
|
|
|
int valid; /* validated resources */
|
2021-02-15 23:58:30 -08:00
|
|
|
char *aia; /* AIA */
|
2019-06-17 07:31:30 -07:00
|
|
|
char *aki; /* AKI */
|
2022-11-04 02:43:13 -07:00
|
|
|
char *sia; /* SIA signedObject */
|
2021-02-15 23:58:30 -08:00
|
|
|
char *ski; /* SKI */
|
2023-03-09 01:46:21 -08:00
|
|
|
time_t signtime; /* CMS signing-time attribute */
|
2023-03-10 04:02:11 -08:00
|
|
|
time_t notbefore; /* EE cert's Not Before */
|
2023-03-10 04:44:56 -08:00
|
|
|
time_t notafter; /* EE cert's Not After */
|
2023-03-13 12:51:49 -07:00
|
|
|
time_t expires; /* when the signature path expires */
|
2019-06-17 07:31:30 -07:00
|
|
|
};
|
|
|
|
|
2022-05-09 10:02:34 -07:00
|
|
|
struct rscfile {
|
|
|
|
char *filename; /* an optional filename on the checklist */
|
|
|
|
unsigned char hash[SHA256_DIGEST_LENGTH]; /* the digest */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A Signed Checklist (RSC)
|
|
|
|
*/
|
|
|
|
struct rsc {
|
|
|
|
int talid; /* RSC covered by what TAL */
|
|
|
|
int valid; /* eContent resources covered by EE's 3779? */
|
2024-11-12 01:23:07 -08:00
|
|
|
struct cert_ip *ips; /* IP prefixes */
|
|
|
|
size_t num_ips;
|
|
|
|
struct cert_as *ases; /* AS resources */
|
|
|
|
size_t num_ases;
|
2022-05-09 10:02:34 -07:00
|
|
|
struct rscfile *files; /* FileAndHashes in the RSC */
|
2024-11-13 04:51:03 -08:00
|
|
|
size_t num_files;
|
2022-05-09 10:02:34 -07:00
|
|
|
char *aia; /* AIA */
|
|
|
|
char *aki; /* AKI */
|
|
|
|
char *ski; /* SKI */
|
2023-03-09 01:46:21 -08:00
|
|
|
time_t signtime; /* CMS signing-time attribute */
|
2023-03-10 04:02:11 -08:00
|
|
|
time_t notbefore; /* EE cert's Not Before */
|
2023-03-10 04:44:56 -08:00
|
|
|
time_t notafter; /* Not After of the RSC EE */
|
2023-03-13 12:51:49 -07:00
|
|
|
time_t expires; /* when the signature path expires */
|
2022-05-09 10:02:34 -07:00
|
|
|
};
|
|
|
|
|
2024-02-22 04:49:42 -08:00
|
|
|
/*
|
|
|
|
* An IP address prefix in a given SignedPrefixList.
|
|
|
|
*/
|
|
|
|
struct spl_pfx {
|
|
|
|
enum afi afi;
|
|
|
|
struct ip_addr prefix;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* An SPL, draft-ietf-sidrops-rpki-prefixlist
|
|
|
|
* This consists of an ASID and its IP prefixes.
|
|
|
|
*/
|
|
|
|
struct spl {
|
|
|
|
uint32_t asid;
|
2024-11-13 04:51:03 -08:00
|
|
|
struct spl_pfx *prefixes;
|
|
|
|
size_t num_prefixes;
|
2024-02-22 04:49:42 -08:00
|
|
|
int talid;
|
|
|
|
char *aia;
|
|
|
|
char *aki;
|
|
|
|
char *sia;
|
|
|
|
char *ski;
|
|
|
|
time_t signtime; /* CMS signing-time attribute */
|
|
|
|
time_t notbefore; /* EE cert's Not Before */
|
|
|
|
time_t notafter; /* EE cert's Not After */
|
|
|
|
time_t expires; /* when the certification path expires */
|
|
|
|
int valid;
|
|
|
|
};
|
|
|
|
|
2022-11-02 05:43:02 -07:00
|
|
|
/*
|
|
|
|
* Datastructure representing the TAKey sequence inside TAKs.
|
|
|
|
*/
|
|
|
|
struct takey {
|
|
|
|
char **comments; /* Comments */
|
2024-11-13 04:51:03 -08:00
|
|
|
size_t num_comments;
|
2022-11-02 05:43:02 -07:00
|
|
|
char **uris; /* CertificateURI */
|
2024-11-13 04:51:03 -08:00
|
|
|
size_t num_uris;
|
2022-11-02 05:43:02 -07:00
|
|
|
unsigned char *pubkey; /* DER encoded SubjectPublicKeyInfo */
|
|
|
|
size_t pubkeysz;
|
|
|
|
char *ski; /* hex encoded SubjectKeyIdentifier of pubkey */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A Signed TAL (TAK) draft-ietf-sidrops-signed-tal-12
|
|
|
|
*/
|
|
|
|
struct tak {
|
|
|
|
int talid; /* TAK covered by what TAL */
|
|
|
|
struct takey *current;
|
|
|
|
struct takey *predecessor;
|
|
|
|
struct takey *successor;
|
|
|
|
char *aia; /* AIA */
|
|
|
|
char *aki; /* AKI */
|
2022-11-04 02:43:13 -07:00
|
|
|
char *sia; /* SIA signed Object */
|
2022-11-02 05:43:02 -07:00
|
|
|
char *ski; /* SKI */
|
2023-03-09 01:46:21 -08:00
|
|
|
time_t signtime; /* CMS signing-time attribute */
|
2023-03-10 04:02:11 -08:00
|
|
|
time_t notbefore; /* EE cert's Not Before */
|
2023-03-10 04:44:56 -08:00
|
|
|
time_t notafter; /* Not After of the TAK EE */
|
2023-03-13 12:51:49 -07:00
|
|
|
time_t expires; /* when the signature path expires */
|
2022-11-02 05:43:02 -07:00
|
|
|
};
|
|
|
|
|
2022-11-26 04:02:36 -08:00
|
|
|
/*
|
|
|
|
* A single geofeed record
|
|
|
|
*/
|
|
|
|
struct geoip {
|
|
|
|
struct cert_ip *ip;
|
|
|
|
char *loc;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A geofeed file
|
|
|
|
*/
|
|
|
|
struct geofeed {
|
|
|
|
struct geoip *geoips; /* Prefix + location entry in the CSV */
|
2024-11-12 01:23:07 -08:00
|
|
|
size_t num_geoips;
|
2022-11-26 04:02:36 -08:00
|
|
|
char *aia; /* AIA */
|
|
|
|
char *aki; /* AKI */
|
|
|
|
char *ski; /* SKI */
|
2023-03-09 01:46:21 -08:00
|
|
|
time_t signtime; /* CMS signing-time attribute */
|
2023-03-10 04:02:11 -08:00
|
|
|
time_t notbefore; /* EE cert's Not Before */
|
2023-03-10 04:44:56 -08:00
|
|
|
time_t notafter; /* Not After of the Geofeed EE */
|
2023-03-13 12:51:49 -07:00
|
|
|
time_t expires; /* when the signature path expires */
|
2022-11-26 04:02:36 -08:00
|
|
|
int valid; /* all resources covered */
|
|
|
|
};
|
|
|
|
|
2020-12-09 03:29:04 -08:00
|
|
|
/*
|
|
|
|
* A single Ghostbuster record
|
|
|
|
*/
|
|
|
|
struct gbr {
|
|
|
|
char *vcard;
|
2021-02-15 23:58:30 -08:00
|
|
|
char *aia; /* AIA */
|
2020-12-09 03:29:04 -08:00
|
|
|
char *aki; /* AKI */
|
2022-11-04 02:43:13 -07:00
|
|
|
char *sia; /* SIA signedObject */
|
2021-02-15 23:58:30 -08:00
|
|
|
char *ski; /* SKI */
|
2023-03-09 01:46:21 -08:00
|
|
|
time_t signtime; /* CMS signing-time attribute */
|
2023-03-10 04:02:11 -08:00
|
|
|
time_t notbefore; /* EE cert's Not Before */
|
2023-03-10 04:44:56 -08:00
|
|
|
time_t notafter; /* Not After of the GBR EE */
|
2023-03-13 12:51:49 -07:00
|
|
|
time_t expires; /* when the signature path expires */
|
Fixup file modification timestamps to optimize failover from RRDP to RSYNC
In the RSYNC protocol a file's last modification time and its size are
used to determine whether sending a (partial) copy over the wire is needed.
Previously, when RRDP data structures are serialized to disk, the mtime of
files in DIR_VALID ended up being UTIME_NOW.
Thus, the mtimes of files obtained through RRDP will never match the mtimes
of the same files available through RSYNC - causing each and every file to
be added to the file transfer list.
Instead, use the internal timestamps of RPKI files as the last modified
timestamp. Specifically, for Signed Objects (ROAs, MFTs, GBRs, TAKs, ASPAs)
the CMS signing-time, for .cer files the X.509 notBefore, and for .crl files
the CRL lastUpdate. This results in a surprising optimization for the number
files which have to be transfered.
OK claudio@
2023-05-30 09:02:28 -07:00
|
|
|
int talid; /* TAL the GBR is chained up to */
|
2020-12-09 03:29:04 -08:00
|
|
|
};
|
|
|
|
|
2022-08-30 11:56:49 -07:00
|
|
|
/*
|
|
|
|
* A single ASPA record
|
|
|
|
*/
|
|
|
|
struct aspa {
|
2024-03-18 22:04:13 -07:00
|
|
|
int valid; /* contained in issuer auth */
|
2022-08-30 11:56:49 -07:00
|
|
|
int talid; /* TAL the ASPA is chained up to */
|
|
|
|
char *aia; /* AIA */
|
|
|
|
char *aki; /* AKI */
|
2022-11-04 02:43:13 -07:00
|
|
|
char *sia; /* SIA signedObject */
|
2022-08-30 11:56:49 -07:00
|
|
|
char *ski; /* SKI */
|
2022-11-04 05:05:36 -07:00
|
|
|
uint32_t custasid; /* the customerASID */
|
2023-06-26 11:39:53 -07:00
|
|
|
uint32_t *providers; /* the providers */
|
2024-11-13 04:51:03 -08:00
|
|
|
size_t num_providers;
|
2023-03-09 01:46:21 -08:00
|
|
|
time_t signtime; /* CMS signing-time attribute */
|
2024-01-07 01:48:29 -08:00
|
|
|
time_t notbefore; /* EE cert's Not Before */
|
2023-03-10 04:44:56 -08:00
|
|
|
time_t notafter; /* notAfter of the ASPA EE cert */
|
2023-03-13 12:51:49 -07:00
|
|
|
time_t expires; /* when the signature path expires */
|
2022-08-30 11:56:49 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A Validated ASPA Payload (VAP) tree element.
|
2022-12-28 13:30:15 -08:00
|
|
|
* To ease transformation, this struct mimics ASPA RTR PDU structure.
|
2022-08-30 11:56:49 -07:00
|
|
|
*/
|
|
|
|
struct vap {
|
|
|
|
RB_ENTRY(vap) entry;
|
|
|
|
uint32_t custasid;
|
2023-06-26 11:39:53 -07:00
|
|
|
uint32_t *providers;
|
2024-11-13 04:51:03 -08:00
|
|
|
size_t num_providers;
|
2022-08-30 11:56:49 -07:00
|
|
|
time_t expires;
|
2023-04-26 09:32:41 -07:00
|
|
|
int talid;
|
|
|
|
unsigned int repoid;
|
2024-04-08 07:02:13 -07:00
|
|
|
int overflowed;
|
2022-08-30 11:56:49 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Tree of VAPs sorted by afi, custasid, and provideras.
|
|
|
|
*/
|
|
|
|
RB_HEAD(vap_tree, vap);
|
|
|
|
RB_PROTOTYPE(vap_tree, vap, entry, vapcmp);
|
|
|
|
|
2019-10-08 03:04:36 -07:00
|
|
|
/*
|
|
|
|
* A single VRP element (including ASID)
|
|
|
|
*/
|
|
|
|
struct vrp {
|
|
|
|
RB_ENTRY(vrp) entry;
|
|
|
|
struct ip_addr addr;
|
|
|
|
uint32_t asid;
|
|
|
|
enum afi afi;
|
|
|
|
unsigned char maxlength;
|
2021-05-06 10:03:57 -07:00
|
|
|
time_t expires; /* transitive expiry moment */
|
2023-04-26 09:32:41 -07:00
|
|
|
int talid; /* covered by which TAL */
|
|
|
|
unsigned int repoid;
|
2019-10-08 03:04:36 -07:00
|
|
|
};
|
|
|
|
/*
|
|
|
|
* Tree of VRP sorted by afi, addr, maxlength and asid
|
|
|
|
*/
|
|
|
|
RB_HEAD(vrp_tree, vrp);
|
|
|
|
RB_PROTOTYPE(vrp_tree, vrp, entry, vrpcmp);
|
|
|
|
|
2024-02-22 04:49:42 -08:00
|
|
|
/*
|
|
|
|
* Validated SignedPrefixList Payload
|
|
|
|
* A single VSP element (including ASID)
|
|
|
|
* draft-ietf-sidrops-rpki-prefixlist
|
|
|
|
*/
|
|
|
|
struct vsp {
|
|
|
|
RB_ENTRY(vsp) entry;
|
|
|
|
uint32_t asid;
|
|
|
|
struct spl_pfx *prefixes;
|
2024-11-13 04:51:03 -08:00
|
|
|
size_t num_prefixes;
|
2024-02-22 04:49:42 -08:00
|
|
|
time_t expires;
|
|
|
|
int talid;
|
|
|
|
unsigned int repoid;
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
* Tree of VSP sorted by asid
|
|
|
|
*/
|
|
|
|
RB_HEAD(vsp_tree, vsp);
|
|
|
|
RB_PROTOTYPE(vsp_tree, vsp, entry, vspcmp);
|
|
|
|
|
2021-10-11 09:50:03 -07:00
|
|
|
/*
|
|
|
|
* A single BGPsec Router Key (including ASID)
|
|
|
|
*/
|
|
|
|
struct brk {
|
|
|
|
RB_ENTRY(brk) entry;
|
|
|
|
uint32_t asid;
|
2021-11-04 04:32:55 -07:00
|
|
|
int talid; /* covered by which TAL */
|
2021-10-12 08:16:45 -07:00
|
|
|
char *ski; /* Subject Key Identifier */
|
|
|
|
char *pubkey; /* Subject Public Key Info */
|
2021-10-11 09:50:03 -07:00
|
|
|
time_t expires; /* transitive expiry moment */
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
* Tree of BRK sorted by asid
|
|
|
|
*/
|
|
|
|
RB_HEAD(brk_tree, brk);
|
|
|
|
RB_PROTOTYPE(brk_tree, brk, entry, brkcmp);
|
|
|
|
|
2019-11-27 19:22:59 -08:00
|
|
|
/*
|
|
|
|
* A single CRL
|
|
|
|
*/
|
|
|
|
struct crl {
|
|
|
|
RB_ENTRY(crl) entry;
|
2019-11-28 20:40:04 -08:00
|
|
|
char *aki;
|
2024-04-15 06:57:45 -07:00
|
|
|
char *mftpath;
|
2019-11-27 19:22:59 -08:00
|
|
|
X509_CRL *x509_crl;
|
2024-01-18 06:34:26 -08:00
|
|
|
time_t thisupdate; /* do not use before */
|
2023-03-10 04:44:56 -08:00
|
|
|
time_t nextupdate; /* do not use after */
|
2019-11-27 19:22:59 -08:00
|
|
|
};
|
|
|
|
/*
|
|
|
|
* Tree of CRLs sorted by uri
|
|
|
|
*/
|
|
|
|
RB_HEAD(crl_tree, crl);
|
|
|
|
|
2019-06-17 07:31:30 -07:00
|
|
|
/*
|
|
|
|
* An authentication tuple.
|
|
|
|
* This specifies a public key and a subject key identifier used to
|
|
|
|
* verify children nodes in the tree of entities.
|
|
|
|
*/
|
2019-11-26 20:32:09 -08:00
|
|
|
struct auth {
|
2019-11-28 12:36:17 -08:00
|
|
|
RB_ENTRY(auth) entry;
|
2019-06-17 07:31:30 -07:00
|
|
|
struct cert *cert; /* owner information */
|
2024-03-18 22:04:13 -07:00
|
|
|
struct auth *issuer; /* pointer to issuer or NULL for TA cert */
|
2023-05-09 03:34:32 -07:00
|
|
|
int any_inherits;
|
2024-05-20 08:51:43 -07:00
|
|
|
int depth;
|
2019-06-17 07:31:30 -07:00
|
|
|
};
|
2019-11-28 12:36:17 -08:00
|
|
|
/*
|
|
|
|
* Tree of auth sorted by ski
|
|
|
|
*/
|
|
|
|
RB_HEAD(auth_tree, auth);
|
|
|
|
|
2024-05-20 08:51:43 -07:00
|
|
|
struct auth *auth_find(struct auth_tree *, int);
|
|
|
|
struct auth *auth_insert(const char *, struct auth_tree *, struct cert *,
|
|
|
|
struct auth *);
|
2019-06-17 07:31:30 -07:00
|
|
|
|
2021-03-25 05:18:45 -07:00
|
|
|
enum http_result {
|
|
|
|
HTTP_FAILED, /* anything else */
|
|
|
|
HTTP_OK, /* 200 OK */
|
|
|
|
HTTP_NOT_MOD, /* 304 Not Modified */
|
|
|
|
};
|
|
|
|
|
2021-04-01 09:04:48 -07:00
|
|
|
/*
|
|
|
|
* Message types for communication with RRDP process.
|
|
|
|
*/
|
|
|
|
enum rrdp_msg {
|
|
|
|
RRDP_START,
|
|
|
|
RRDP_SESSION,
|
|
|
|
RRDP_FILE,
|
2022-01-13 05:18:41 -08:00
|
|
|
RRDP_CLEAR,
|
2021-04-01 09:04:48 -07:00
|
|
|
RRDP_END,
|
|
|
|
RRDP_HTTP_REQ,
|
|
|
|
RRDP_HTTP_INI,
|
2022-01-13 05:18:41 -08:00
|
|
|
RRDP_HTTP_FIN,
|
2022-09-02 11:37:17 -07:00
|
|
|
RRDP_ABORT,
|
2021-04-01 09:04:48 -07:00
|
|
|
};
|
|
|
|
|
2023-06-23 04:36:24 -07:00
|
|
|
/* Maximum number of delta files per RRDP notification file. */
|
|
|
|
#define MAX_RRDP_DELTAS 300
|
|
|
|
|
2021-04-01 09:04:48 -07:00
|
|
|
/*
|
|
|
|
* RRDP session state, needed to pickup at the right spot on next run.
|
|
|
|
*/
|
|
|
|
struct rrdp_session {
|
|
|
|
char *last_mod;
|
|
|
|
char *session_id;
|
|
|
|
long long serial;
|
2023-06-23 04:36:24 -07:00
|
|
|
char *deltas[MAX_RRDP_DELTAS];
|
2021-04-01 09:04:48 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* File types used in RRDP_FILE messages.
|
|
|
|
*/
|
|
|
|
enum publish_type {
|
|
|
|
PUB_ADD,
|
|
|
|
PUB_UPD,
|
|
|
|
PUB_DEL,
|
|
|
|
};
|
|
|
|
|
2021-02-04 00:10:24 -08:00
|
|
|
/*
|
|
|
|
* An entity (MFT, ROA, certificate, etc.) that needs to be downloaded
|
|
|
|
* and parsed.
|
|
|
|
*/
|
2021-10-10 14:57:43 -07:00
|
|
|
struct entity {
|
2021-12-29 03:37:57 -08:00
|
|
|
TAILQ_ENTRY(entity) entries;
|
2022-01-11 05:06:07 -08:00
|
|
|
char *path; /* path relative to repository */
|
2022-01-14 07:00:23 -08:00
|
|
|
char *file; /* filename or valid repo path */
|
2023-04-13 10:04:02 -07:00
|
|
|
char *mftaki; /* expected AKI (taken from Manifest) */
|
2021-10-26 09:12:54 -07:00
|
|
|
unsigned char *data; /* optional data blob */
|
2022-04-20 08:38:24 -07:00
|
|
|
size_t datasz; /* length of optional data blob */
|
2022-01-11 05:06:07 -08:00
|
|
|
unsigned int repoid; /* repository identifier */
|
2021-11-04 04:32:55 -07:00
|
|
|
int talid; /* tal identifier */
|
2024-05-20 08:51:43 -07:00
|
|
|
int certid;
|
2021-12-29 03:37:57 -08:00
|
|
|
enum rtype type; /* type of entity (not RTYPE_EOF) */
|
2022-12-28 13:30:15 -08:00
|
|
|
enum location location; /* which directory the file lives in */
|
2021-02-04 00:10:24 -08:00
|
|
|
};
|
|
|
|
TAILQ_HEAD(entityq, entity);
|
|
|
|
|
2022-12-15 04:02:29 -08:00
|
|
|
enum stype {
|
|
|
|
STYPE_OK,
|
|
|
|
STYPE_FAIL,
|
|
|
|
STYPE_INVALID,
|
|
|
|
STYPE_BGPSEC,
|
|
|
|
STYPE_TOTAL,
|
|
|
|
STYPE_UNIQUE,
|
|
|
|
STYPE_DEC_UNIQUE,
|
2023-06-29 07:33:35 -07:00
|
|
|
STYPE_PROVIDERS,
|
2024-04-08 07:02:13 -07:00
|
|
|
STYPE_OVERFLOW,
|
2024-11-02 05:30:28 -07:00
|
|
|
STYPE_SEQNUM_GAP,
|
2022-12-15 04:02:29 -08:00
|
|
|
};
|
|
|
|
|
2021-04-01 09:04:48 -07:00
|
|
|
struct repo;
|
|
|
|
struct filepath;
|
|
|
|
RB_HEAD(filepath_tree, filepath);
|
|
|
|
|
|
|
|
|
2020-04-28 06:41:35 -07:00
|
|
|
/*
|
|
|
|
* Statistics collected during run-time.
|
|
|
|
*/
|
2023-04-26 09:32:41 -07:00
|
|
|
struct repotalstats {
|
2022-12-15 04:02:29 -08:00
|
|
|
uint32_t certs; /* certificates */
|
|
|
|
uint32_t certs_fail; /* invalid certificate */
|
|
|
|
uint32_t mfts; /* total number of manifests */
|
2024-11-02 05:30:28 -07:00
|
|
|
uint32_t mfts_gap; /* manifests with sequence gaps */
|
2022-12-15 04:02:29 -08:00
|
|
|
uint32_t mfts_fail; /* failing syntactic parse */
|
|
|
|
uint32_t roas; /* route origin authorizations */
|
|
|
|
uint32_t roas_fail; /* failing syntactic parse */
|
|
|
|
uint32_t roas_invalid; /* invalid resources */
|
|
|
|
uint32_t aspas; /* ASPA objects */
|
|
|
|
uint32_t aspas_fail; /* ASPA objects failing syntactic parse */
|
|
|
|
uint32_t aspas_invalid; /* ASPAs with invalid customerASID */
|
|
|
|
uint32_t brks; /* number of BGPsec Router Key (BRK) certs */
|
|
|
|
uint32_t crls; /* revocation lists */
|
|
|
|
uint32_t gbrs; /* ghostbuster records */
|
|
|
|
uint32_t taks; /* signed TAL objects */
|
|
|
|
uint32_t vaps; /* total number of Validated ASPA Payloads */
|
|
|
|
uint32_t vaps_uniqs; /* total number of unique VAPs */
|
|
|
|
uint32_t vaps_pas; /* total number of providers */
|
2024-04-08 07:02:13 -07:00
|
|
|
uint32_t vaps_overflowed; /* VAPs with too many providers */
|
2022-12-15 04:02:29 -08:00
|
|
|
uint32_t vrps; /* total number of Validated ROA Payloads */
|
|
|
|
uint32_t vrps_uniqs; /* number of unique vrps */
|
2024-02-22 04:49:42 -08:00
|
|
|
uint32_t spls; /* signed prefix list */
|
|
|
|
uint32_t spls_fail; /* failing syntactic parse */
|
2024-02-22 13:00:26 -08:00
|
|
|
uint32_t spls_invalid; /* invalid spls */
|
2024-02-22 04:49:42 -08:00
|
|
|
uint32_t vsps; /* total number of Validated SPL Payloads */
|
|
|
|
uint32_t vsps_uniqs; /* number of unique vsps */
|
2023-04-26 09:32:41 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct repostats {
|
|
|
|
uint32_t del_files; /* number of files removed in cleanup */
|
|
|
|
uint32_t extra_files; /* number of superfluous files */
|
|
|
|
uint32_t del_extra_files;/* number of removed extra files */
|
|
|
|
uint32_t del_dirs; /* number of dirs removed in cleanup */
|
2024-02-26 07:40:33 -08:00
|
|
|
uint32_t new_files; /* moved from DIR_TEMP to DIR_VALID */
|
2022-12-15 04:02:29 -08:00
|
|
|
struct timespec sync_time; /* time to sync repo */
|
|
|
|
};
|
|
|
|
|
2021-10-10 14:57:43 -07:00
|
|
|
struct stats {
|
2022-12-15 04:02:29 -08:00
|
|
|
uint32_t tals; /* total number of locators */
|
|
|
|
uint32_t repos; /* repositories */
|
|
|
|
uint32_t rsync_repos; /* synced rsync repositories */
|
|
|
|
uint32_t rsync_fails; /* failed rsync repositories */
|
|
|
|
uint32_t http_repos; /* synced http repositories */
|
|
|
|
uint32_t http_fails; /* failed http repositories */
|
|
|
|
uint32_t rrdp_repos; /* synced rrdp repositories */
|
|
|
|
uint32_t rrdp_fails; /* failed rrdp repositories */
|
|
|
|
uint32_t skiplistentries; /* number of skiplist entries */
|
|
|
|
|
2023-04-26 09:32:41 -07:00
|
|
|
struct repotalstats repo_tal_stats;
|
2022-12-15 04:02:29 -08:00
|
|
|
struct repostats repo_stats;
|
|
|
|
struct timespec elapsed_time;
|
|
|
|
struct timespec user_time;
|
|
|
|
struct timespec system_time;
|
2020-04-28 06:41:35 -07:00
|
|
|
};
|
|
|
|
|
2021-01-08 00:09:07 -08:00
|
|
|
struct ibuf;
|
2021-10-22 04:13:06 -07:00
|
|
|
struct msgbuf;
|
2021-01-08 00:09:07 -08:00
|
|
|
|
2019-08-13 06:27:26 -07:00
|
|
|
/* global variables */
|
|
|
|
extern int verbose;
|
2024-04-21 12:27:44 -07:00
|
|
|
extern int noop;
|
2022-01-19 07:50:31 -08:00
|
|
|
extern int filemode;
|
2023-01-13 00:58:36 -08:00
|
|
|
extern int excludeaspa;
|
2024-04-21 12:27:44 -07:00
|
|
|
extern int experimental;
|
2024-12-02 06:55:02 -08:00
|
|
|
extern int excludeas0;
|
2021-11-04 04:32:55 -07:00
|
|
|
extern const char *tals[];
|
|
|
|
extern const char *taldescs[];
|
2021-11-09 03:03:39 -08:00
|
|
|
extern unsigned int talrepocnt[];
|
2023-04-26 09:32:41 -07:00
|
|
|
extern struct repotalstats talstats[];
|
2022-04-19 06:52:24 -07:00
|
|
|
extern int talsz;
|
2019-08-13 06:27:26 -07:00
|
|
|
|
2019-06-17 07:31:30 -07:00
|
|
|
/* Routines for RPKI entities. */
|
|
|
|
|
2021-01-08 00:09:07 -08:00
|
|
|
void tal_buffer(struct ibuf *, const struct tal *);
|
2019-06-17 07:31:30 -07:00
|
|
|
void tal_free(struct tal *);
|
2021-10-26 09:12:54 -07:00
|
|
|
struct tal *tal_parse(const char *, char *, size_t);
|
2021-10-23 09:06:04 -07:00
|
|
|
struct tal *tal_read(struct ibuf *);
|
2019-06-17 07:31:30 -07:00
|
|
|
|
2021-01-08 00:09:07 -08:00
|
|
|
void cert_buffer(struct ibuf *, const struct cert *);
|
2019-06-17 07:31:30 -07:00
|
|
|
void cert_free(struct cert *);
|
2022-09-03 14:24:02 -07:00
|
|
|
void auth_tree_free(struct auth_tree *);
|
2023-10-13 05:06:49 -07:00
|
|
|
struct cert *cert_parse_ee_cert(const char *, int, X509 *);
|
2022-04-02 05:17:53 -07:00
|
|
|
struct cert *cert_parse_pre(const char *, const unsigned char *, size_t);
|
|
|
|
struct cert *cert_parse(const char *, struct cert *);
|
|
|
|
struct cert *ta_parse(const char *, struct cert *, const unsigned char *,
|
|
|
|
size_t);
|
2021-10-23 09:06:04 -07:00
|
|
|
struct cert *cert_read(struct ibuf *);
|
2021-10-11 09:50:03 -07:00
|
|
|
void cert_insert_brks(struct brk_tree *, struct cert *);
|
2019-06-17 07:31:30 -07:00
|
|
|
|
2022-01-28 07:30:23 -08:00
|
|
|
enum rtype rtype_from_file_extension(const char *);
|
2021-01-08 00:09:07 -08:00
|
|
|
void mft_buffer(struct ibuf *, const struct mft *);
|
2019-06-17 07:31:30 -07:00
|
|
|
void mft_free(struct mft *);
|
2023-09-25 04:08:45 -07:00
|
|
|
struct mft *mft_parse(X509 **, const char *, int, const unsigned char *,
|
2021-10-26 03:52:49 -07:00
|
|
|
size_t);
|
2021-10-23 09:06:04 -07:00
|
|
|
struct mft *mft_read(struct ibuf *);
|
2024-01-30 22:57:21 -08:00
|
|
|
int mft_compare_issued(const struct mft *, const struct mft *);
|
2024-01-30 22:54:43 -08:00
|
|
|
int mft_compare_seqnum(const struct mft *, const struct mft *);
|
2024-11-02 05:30:28 -07:00
|
|
|
int mft_seqnum_gap_present(const struct mft *, const struct mft *);
|
2019-06-17 07:31:30 -07:00
|
|
|
|
2021-01-08 00:09:07 -08:00
|
|
|
void roa_buffer(struct ibuf *, const struct roa *);
|
2019-06-17 07:31:30 -07:00
|
|
|
void roa_free(struct roa *);
|
2023-09-25 04:08:45 -07:00
|
|
|
struct roa *roa_parse(X509 **, const char *, int, const unsigned char *,
|
2021-10-26 03:52:49 -07:00
|
|
|
size_t);
|
2021-10-23 09:06:04 -07:00
|
|
|
struct roa *roa_read(struct ibuf *);
|
2022-12-15 04:02:29 -08:00
|
|
|
void roa_insert_vrps(struct vrp_tree *, struct roa *,
|
|
|
|
struct repo *);
|
2019-06-17 07:31:30 -07:00
|
|
|
|
2024-02-22 04:49:42 -08:00
|
|
|
void spl_buffer(struct ibuf *, const struct spl *);
|
|
|
|
void spl_free(struct spl *);
|
|
|
|
struct spl *spl_parse(X509 **, const char *, int, const unsigned char *,
|
|
|
|
size_t);
|
|
|
|
struct spl *spl_read(struct ibuf *);
|
|
|
|
void spl_insert_vsps(struct vsp_tree *, struct spl *,
|
|
|
|
struct repo *);
|
|
|
|
|
2020-12-09 03:29:04 -08:00
|
|
|
void gbr_free(struct gbr *);
|
2023-09-25 04:08:45 -07:00
|
|
|
struct gbr *gbr_parse(X509 **, const char *, int, const unsigned char *,
|
2021-10-26 03:52:49 -07:00
|
|
|
size_t);
|
2020-12-09 03:29:04 -08:00
|
|
|
|
2022-11-26 04:02:36 -08:00
|
|
|
void geofeed_free(struct geofeed *);
|
2023-09-25 04:08:45 -07:00
|
|
|
struct geofeed *geofeed_parse(X509 **, const char *, int, char *, size_t);
|
2022-11-26 04:02:36 -08:00
|
|
|
|
2022-05-09 10:02:34 -07:00
|
|
|
void rsc_free(struct rsc *);
|
2023-09-25 04:08:45 -07:00
|
|
|
struct rsc *rsc_parse(X509 **, const char *, int, const unsigned char *,
|
2022-05-09 10:02:34 -07:00
|
|
|
size_t);
|
|
|
|
|
2022-11-02 05:43:02 -07:00
|
|
|
void takey_free(struct takey *);
|
|
|
|
void tak_free(struct tak *);
|
2023-09-25 04:08:45 -07:00
|
|
|
struct tak *tak_parse(X509 **, const char *, int, const unsigned char *,
|
2022-11-02 05:43:02 -07:00
|
|
|
size_t);
|
|
|
|
|
2022-08-30 11:56:49 -07:00
|
|
|
void aspa_buffer(struct ibuf *, const struct aspa *);
|
|
|
|
void aspa_free(struct aspa *);
|
2024-04-05 09:05:15 -07:00
|
|
|
void aspa_insert_vaps(char *, struct vap_tree *, struct aspa *,
|
2022-12-15 04:02:29 -08:00
|
|
|
struct repo *);
|
2023-09-25 04:08:45 -07:00
|
|
|
struct aspa *aspa_parse(X509 **, const char *, int, const unsigned char *,
|
2022-08-30 11:56:49 -07:00
|
|
|
size_t);
|
|
|
|
struct aspa *aspa_read(struct ibuf *);
|
|
|
|
|
2019-11-27 19:22:59 -08:00
|
|
|
/* crl.c */
|
2022-02-08 03:51:51 -08:00
|
|
|
struct crl *crl_parse(const char *, const unsigned char *, size_t);
|
2022-04-21 02:53:07 -07:00
|
|
|
struct crl *crl_get(struct crl_tree *, const struct auth *);
|
|
|
|
int crl_insert(struct crl_tree *, struct crl *);
|
2022-02-08 03:51:51 -08:00
|
|
|
void crl_free(struct crl *);
|
2022-09-03 14:24:02 -07:00
|
|
|
void crl_tree_free(struct crl_tree *);
|
2019-06-17 07:31:30 -07:00
|
|
|
|
|
|
|
/* Validation of our objects. */
|
|
|
|
|
2022-01-22 21:59:35 -08:00
|
|
|
int valid_cert(const char *, struct auth *, const struct cert *);
|
2022-08-19 05:45:53 -07:00
|
|
|
int valid_roa(const char *, struct cert *, struct roa *);
|
2022-01-13 05:46:03 -08:00
|
|
|
int valid_filehash(int, const char *, size_t);
|
2022-04-19 02:52:29 -07:00
|
|
|
int valid_hash(unsigned char *, size_t, const char *, size_t);
|
2022-05-10 00:41:37 -07:00
|
|
|
int valid_filename(const char *, size_t);
|
2021-03-05 09:15:19 -08:00
|
|
|
int valid_uri(const char *, size_t, const char *);
|
2021-10-29 02:27:36 -07:00
|
|
|
int valid_origin(const char *, const char *);
|
2022-04-21 02:53:07 -07:00
|
|
|
int valid_x509(char *, X509_STORE_CTX *, X509 *, struct auth *,
|
2022-11-29 02:33:09 -08:00
|
|
|
struct crl *, const char **);
|
2022-08-19 05:45:53 -07:00
|
|
|
int valid_rsc(const char *, struct cert *, struct rsc *);
|
2023-06-07 03:46:34 -07:00
|
|
|
int valid_econtent_version(const char *, const ASN1_INTEGER *,
|
|
|
|
uint64_t);
|
2022-08-30 11:56:49 -07:00
|
|
|
int valid_aspa(const char *, struct cert *, struct aspa *);
|
2022-11-26 04:02:36 -08:00
|
|
|
int valid_geofeed(const char *, struct cert *, struct geofeed *);
|
2023-01-04 06:22:43 -08:00
|
|
|
int valid_uuid(const char *);
|
2023-03-06 08:04:52 -08:00
|
|
|
int valid_ca_pkey(const char *, EVP_PKEY *);
|
2024-02-22 04:49:42 -08:00
|
|
|
int valid_spl(const char *, struct cert *, struct spl *);
|
2019-06-17 07:31:30 -07:00
|
|
|
|
2021-07-13 11:39:39 -07:00
|
|
|
/* Working with CMS. */
|
2019-06-17 07:31:30 -07:00
|
|
|
unsigned char *cms_parse_validate(X509 **, const char *,
|
2021-10-26 03:52:49 -07:00
|
|
|
const unsigned char *, size_t,
|
2023-03-09 01:46:21 -08:00
|
|
|
const ASN1_OBJECT *, size_t *, time_t *);
|
2022-11-26 04:02:36 -08:00
|
|
|
int cms_parse_validate_detached(X509 **, const char *,
|
|
|
|
const unsigned char *, size_t,
|
2023-03-09 01:46:21 -08:00
|
|
|
const ASN1_OBJECT *, BIO *, time_t *);
|
2019-06-17 07:31:30 -07:00
|
|
|
|
|
|
|
/* Work with RFC 3779 IP addresses, prefixes, ranges. */
|
|
|
|
|
2019-11-27 09:14:20 -08:00
|
|
|
int ip_addr_afi_parse(const char *, const ASN1_OCTET_STRING *,
|
2024-02-21 04:38:10 -08:00
|
|
|
enum afi *);
|
2019-06-17 07:31:30 -07:00
|
|
|
int ip_addr_parse(const ASN1_BIT_STRING *,
|
2024-02-21 04:38:10 -08:00
|
|
|
enum afi, const char *, struct ip_addr *);
|
2019-11-27 09:14:20 -08:00
|
|
|
void ip_addr_print(const struct ip_addr *, enum afi, char *,
|
2024-02-21 04:38:10 -08:00
|
|
|
size_t);
|
2019-06-17 07:31:30 -07:00
|
|
|
int ip_addr_check_overlap(const struct cert_ip *,
|
2024-02-21 04:38:10 -08:00
|
|
|
const char *, const struct cert_ip *, size_t, int);
|
2019-06-17 07:31:30 -07:00
|
|
|
int ip_addr_check_covered(enum afi, const unsigned char *,
|
2024-02-21 04:38:10 -08:00
|
|
|
const unsigned char *, const struct cert_ip *, size_t);
|
2019-06-17 07:31:30 -07:00
|
|
|
int ip_cert_compose_ranges(struct cert_ip *);
|
|
|
|
void ip_roa_compose_ranges(struct roa_ip *);
|
2023-12-26 23:15:55 -08:00
|
|
|
void ip_warn(const char *, const char *, const struct cert_ip *);
|
2019-06-17 07:31:30 -07:00
|
|
|
|
2022-05-31 11:33:16 -07:00
|
|
|
int sbgp_addr(const char *, struct cert_ip *, size_t *,
|
|
|
|
enum afi, const ASN1_BIT_STRING *);
|
|
|
|
int sbgp_addr_range(const char *, struct cert_ip *, size_t *,
|
|
|
|
enum afi, const IPAddressRange *);
|
|
|
|
|
2023-09-25 07:56:20 -07:00
|
|
|
int sbgp_parse_ipaddrblk(const char *, const IPAddrBlocks *,
|
|
|
|
struct cert_ip **, size_t *);
|
|
|
|
|
2019-06-17 07:31:30 -07:00
|
|
|
/* Work with RFC 3779 AS numbers, ranges. */
|
|
|
|
|
|
|
|
int as_id_parse(const ASN1_INTEGER *, uint32_t *);
|
|
|
|
int as_check_overlap(const struct cert_as *, const char *,
|
2024-02-21 04:38:10 -08:00
|
|
|
const struct cert_as *, size_t, int);
|
2019-06-17 07:31:30 -07:00
|
|
|
int as_check_covered(uint32_t, uint32_t,
|
2024-02-21 04:38:10 -08:00
|
|
|
const struct cert_as *, size_t);
|
2023-12-26 23:15:55 -08:00
|
|
|
void as_warn(const char *, const char *, const struct cert_as *);
|
2021-02-04 00:10:24 -08:00
|
|
|
|
2022-05-31 11:33:16 -07:00
|
|
|
int sbgp_as_id(const char *, struct cert_as *, size_t *,
|
|
|
|
const ASN1_INTEGER *);
|
|
|
|
int sbgp_as_range(const char *, struct cert_as *, size_t *,
|
|
|
|
const ASRange *);
|
|
|
|
|
2023-09-25 07:56:20 -07:00
|
|
|
int sbgp_parse_assysnum(const char *, const ASIdentifiers *,
|
|
|
|
struct cert_as **, size_t *);
|
|
|
|
|
2023-10-13 05:06:49 -07:00
|
|
|
/* Constraints-specific */
|
|
|
|
void constraints_load(void);
|
|
|
|
void constraints_unload(void);
|
|
|
|
void constraints_parse(void);
|
|
|
|
int constraints_validate(const char *, const struct cert *);
|
|
|
|
|
2021-02-04 00:10:24 -08:00
|
|
|
/* Parser-specific */
|
|
|
|
void entity_free(struct entity *);
|
2021-10-23 09:06:04 -07:00
|
|
|
void entity_read_req(struct ibuf *, struct entity *);
|
2021-04-01 09:04:48 -07:00
|
|
|
void entityq_flush(struct entityq *, struct repo *);
|
2021-02-04 00:10:24 -08:00
|
|
|
void proc_parser(int) __attribute__((noreturn));
|
2022-04-21 02:53:07 -07:00
|
|
|
void proc_filemode(int) __attribute__((noreturn));
|
2019-06-17 07:31:30 -07:00
|
|
|
|
|
|
|
/* Rsync-specific. */
|
|
|
|
|
2021-02-16 00:52:00 -08:00
|
|
|
char *rsync_base_uri(const char *);
|
2020-09-12 03:02:01 -07:00
|
|
|
void proc_rsync(char *, char *, int) __attribute__((noreturn));
|
2019-06-17 07:31:30 -07:00
|
|
|
|
2021-04-01 09:04:48 -07:00
|
|
|
/* HTTP and RRDP processes. */
|
2021-03-04 05:01:41 -08:00
|
|
|
|
2022-04-21 02:53:07 -07:00
|
|
|
void proc_http(char *, int) __attribute__((noreturn));
|
|
|
|
void proc_rrdp(int) __attribute__((noreturn));
|
2021-04-01 09:04:48 -07:00
|
|
|
|
|
|
|
/* Repository handling */
|
2024-07-12 02:27:32 -07:00
|
|
|
int filepath_add(struct filepath_tree *, char *, int, time_t, int);
|
|
|
|
int filepath_valid(struct filepath_tree *, char *, int);
|
2022-01-13 05:18:41 -08:00
|
|
|
void rrdp_clear(unsigned int);
|
2023-06-23 04:36:24 -07:00
|
|
|
void rrdp_session_save(unsigned int, struct rrdp_session *);
|
|
|
|
void rrdp_session_free(struct rrdp_session *);
|
|
|
|
void rrdp_session_buffer(struct ibuf *,
|
|
|
|
const struct rrdp_session *);
|
|
|
|
struct rrdp_session *rrdp_session_read(struct ibuf *);
|
2021-12-22 01:35:14 -08:00
|
|
|
int rrdp_handle_file(unsigned int, enum publish_type, char *,
|
2021-04-01 09:04:48 -07:00
|
|
|
char *, size_t, char *, size_t);
|
2022-01-14 07:00:23 -08:00
|
|
|
char *repo_basedir(const struct repo *, int);
|
2022-01-11 05:06:07 -08:00
|
|
|
unsigned int repo_id(const struct repo *);
|
|
|
|
const char *repo_uri(const struct repo *);
|
2022-12-15 04:02:29 -08:00
|
|
|
void repo_fetch_uris(const struct repo *, const char **,
|
|
|
|
const char **);
|
|
|
|
int repo_synced(const struct repo *);
|
2023-03-30 08:29:15 -07:00
|
|
|
const char *repo_proto(const struct repo *);
|
2022-12-15 04:02:29 -08:00
|
|
|
int repo_talid(const struct repo *);
|
2021-11-09 03:03:39 -08:00
|
|
|
struct repo *ta_lookup(int, struct tal *);
|
|
|
|
struct repo *repo_lookup(int, const char *, const char *);
|
2022-01-11 05:06:07 -08:00
|
|
|
struct repo *repo_byid(unsigned int);
|
2021-04-01 09:04:48 -07:00
|
|
|
int repo_queued(struct repo *, struct entity *);
|
2022-04-04 09:02:54 -07:00
|
|
|
void repo_cleanup(struct filepath_tree *, int);
|
2022-12-15 04:02:29 -08:00
|
|
|
int repo_check_timeout(int);
|
2024-02-26 07:40:33 -08:00
|
|
|
void repostats_new_files_inc(struct repo *, const char *);
|
2023-04-26 09:32:41 -07:00
|
|
|
void repo_stat_inc(struct repo *, int, enum rtype, enum stype);
|
|
|
|
void repo_tal_stats_collect(void (*)(const struct repo *,
|
|
|
|
const struct repotalstats *, void *), int, void *);
|
2022-12-15 04:02:29 -08:00
|
|
|
void repo_stats_collect(void (*)(const struct repo *,
|
|
|
|
const struct repostats *, void *), void *);
|
2021-04-01 09:04:48 -07:00
|
|
|
void repo_free(void);
|
|
|
|
|
2021-12-22 01:35:14 -08:00
|
|
|
void rsync_finish(unsigned int, int);
|
|
|
|
void http_finish(unsigned int, enum http_result, const char *);
|
|
|
|
void rrdp_finish(unsigned int, int);
|
2021-04-01 09:04:48 -07:00
|
|
|
|
2022-01-14 07:00:23 -08:00
|
|
|
void rsync_fetch(unsigned int, const char *, const char *,
|
|
|
|
const char *);
|
2022-09-02 12:10:36 -07:00
|
|
|
void rsync_abort(unsigned int);
|
2021-12-22 01:35:14 -08:00
|
|
|
void http_fetch(unsigned int, const char *, const char *, int);
|
|
|
|
void rrdp_fetch(unsigned int, const char *, const char *,
|
2021-04-01 09:04:48 -07:00
|
|
|
struct rrdp_session *);
|
2022-09-02 12:10:36 -07:00
|
|
|
void rrdp_abort(unsigned int);
|
2021-12-22 01:35:14 -08:00
|
|
|
void rrdp_http_done(unsigned int, enum http_result, const char *);
|
2021-03-04 05:01:41 -08:00
|
|
|
|
2021-03-31 23:43:23 -07:00
|
|
|
/* Encoding functions for hex and base64. */
|
|
|
|
|
2021-10-26 09:59:19 -07:00
|
|
|
unsigned char *load_file(const char *, size_t *);
|
2021-10-28 04:57:00 -07:00
|
|
|
int base64_decode_len(size_t, size_t *);
|
2021-10-26 09:12:54 -07:00
|
|
|
int base64_decode(const unsigned char *, size_t,
|
|
|
|
unsigned char **, size_t *);
|
2021-10-28 04:57:00 -07:00
|
|
|
int base64_encode_len(size_t, size_t *);
|
2021-09-01 01:09:41 -07:00
|
|
|
int base64_encode(const unsigned char *, size_t, char **);
|
2021-03-31 23:43:23 -07:00
|
|
|
char *hex_encode(const unsigned char *, size_t);
|
2021-11-24 07:24:16 -08:00
|
|
|
int hex_decode(const char *, char *, size_t);
|
2021-03-31 23:43:23 -07:00
|
|
|
|
|
|
|
|
2019-06-17 07:31:30 -07:00
|
|
|
/* Functions for moving data between processes. */
|
|
|
|
|
2021-10-23 13:01:16 -07:00
|
|
|
struct ibuf *io_new_buffer(void);
|
2021-01-08 00:09:07 -08:00
|
|
|
void io_simple_buffer(struct ibuf *, const void *, size_t);
|
|
|
|
void io_buf_buffer(struct ibuf *, const void *, size_t);
|
|
|
|
void io_str_buffer(struct ibuf *, const char *);
|
2021-10-23 13:01:16 -07:00
|
|
|
void io_close_buffer(struct msgbuf *, struct ibuf *);
|
2021-10-23 09:06:04 -07:00
|
|
|
void io_read_buf(struct ibuf *, void *, size_t);
|
|
|
|
void io_read_str(struct ibuf *, char **);
|
|
|
|
void io_read_buf_alloc(struct ibuf *, void **, size_t *);
|
2024-11-26 05:59:09 -08:00
|
|
|
struct ibuf *io_parse_hdr(struct ibuf *, void *, int *);
|
2024-11-21 05:32:27 -08:00
|
|
|
struct ibuf *io_buf_get(struct msgbuf *);
|
2019-06-17 07:31:30 -07:00
|
|
|
|
|
|
|
/* X509 helpers. */
|
|
|
|
|
2022-01-18 05:06:43 -08:00
|
|
|
void x509_init_oid(void);
|
2024-06-08 06:28:35 -07:00
|
|
|
int x509_cache_extensions(X509 *, const char *);
|
2022-04-01 10:22:07 -07:00
|
|
|
int x509_get_aia(X509 *, const char *, char **);
|
|
|
|
int x509_get_aki(X509 *, const char *, char **);
|
2022-11-04 02:43:13 -07:00
|
|
|
int x509_get_sia(X509 *, const char *, char **);
|
2022-04-01 10:22:07 -07:00
|
|
|
int x509_get_ski(X509 *, const char *, char **);
|
2023-03-10 04:02:11 -08:00
|
|
|
int x509_get_notbefore(X509 *, const char *, time_t *);
|
2023-03-10 04:44:56 -08:00
|
|
|
int x509_get_notafter(X509 *, const char *, time_t *);
|
2022-04-01 10:22:07 -07:00
|
|
|
int x509_get_crl(X509 *, const char *, char **);
|
2021-10-12 08:16:45 -07:00
|
|
|
char *x509_get_pubkey(X509 *, const char *);
|
2024-02-15 21:18:29 -08:00
|
|
|
char *x509_pubkey_get_ski(X509_PUBKEY *, const char *);
|
2021-10-05 04:20:46 -07:00
|
|
|
enum cert_purpose x509_get_purpose(X509 *, const char *);
|
2022-02-10 07:33:47 -08:00
|
|
|
int x509_get_time(const ASN1_TIME *, time_t *);
|
2024-09-12 03:33:25 -07:00
|
|
|
char *x509_convert_seqnum(const char *, const char *,
|
|
|
|
const ASN1_INTEGER *);
|
|
|
|
int x509_valid_seqnum(const char *, const char *,
|
|
|
|
const ASN1_INTEGER *);
|
2024-06-03 21:17:18 -07:00
|
|
|
int x509_location(const char *, const char *, GENERAL_NAME *,
|
|
|
|
char **);
|
2022-05-11 14:19:06 -07:00
|
|
|
int x509_inherits(X509 *);
|
2022-11-04 05:05:36 -07:00
|
|
|
int x509_any_inherits(X509 *);
|
2024-05-30 19:45:15 -07:00
|
|
|
int x509_valid_name(const char *, const char *, const X509_NAME *);
|
2023-03-12 04:54:56 -07:00
|
|
|
time_t x509_find_expires(time_t, struct auth *, struct crl_tree *);
|
2019-06-17 07:31:30 -07:00
|
|
|
|
2021-10-24 10:53:07 -07:00
|
|
|
/* printers */
|
2024-02-01 07:11:38 -08:00
|
|
|
char *nid2str(int);
|
2024-06-08 06:30:35 -07:00
|
|
|
const char *purpose2str(enum cert_purpose);
|
2022-02-10 07:33:47 -08:00
|
|
|
char *time2str(time_t);
|
2022-04-20 03:46:20 -07:00
|
|
|
void x509_print(const X509 *);
|
2022-02-10 07:33:47 -08:00
|
|
|
void tal_print(const struct tal *);
|
|
|
|
void cert_print(const struct cert *);
|
|
|
|
void crl_print(const struct crl *);
|
2022-04-20 03:46:20 -07:00
|
|
|
void mft_print(const X509 *, const struct mft *);
|
|
|
|
void roa_print(const X509 *, const struct roa *);
|
|
|
|
void gbr_print(const X509 *, const struct gbr *);
|
2022-05-09 10:02:34 -07:00
|
|
|
void rsc_print(const X509 *, const struct rsc *);
|
2022-08-30 11:56:49 -07:00
|
|
|
void aspa_print(const X509 *, const struct aspa *);
|
2022-11-02 05:43:02 -07:00
|
|
|
void tak_print(const X509 *, const struct tak *);
|
2022-11-26 04:02:36 -08:00
|
|
|
void geofeed_print(const X509 *, const struct geofeed *);
|
2024-02-22 04:49:42 -08:00
|
|
|
void spl_print(const X509 *, const struct spl *);
|
2021-10-24 10:53:07 -07:00
|
|
|
|
2023-10-13 05:06:49 -07:00
|
|
|
/* Missing RFC 3779 API */
|
|
|
|
IPAddrBlocks *IPAddrBlocks_new(void);
|
|
|
|
void IPAddrBlocks_free(IPAddrBlocks *);
|
|
|
|
|
2019-06-17 07:31:30 -07:00
|
|
|
/* Output! */
|
|
|
|
|
2019-12-04 04:40:17 -08:00
|
|
|
extern int outformats;
|
|
|
|
#define FORMAT_OPENBGPD 0x01
|
|
|
|
#define FORMAT_BIRD 0x02
|
|
|
|
#define FORMAT_CSV 0x04
|
|
|
|
#define FORMAT_JSON 0x08
|
2022-12-15 04:02:29 -08:00
|
|
|
#define FORMAT_OMETRIC 0x10
|
2019-12-04 04:40:17 -08:00
|
|
|
|
2021-10-11 09:50:03 -07:00
|
|
|
int outputfiles(struct vrp_tree *v, struct brk_tree *b,
|
2024-02-22 04:49:42 -08:00
|
|
|
struct vap_tree *, struct vsp_tree *, struct stats *);
|
2020-04-28 06:41:35 -07:00
|
|
|
int outputheader(FILE *, struct stats *);
|
2021-10-11 09:50:03 -07:00
|
|
|
int output_bgpd(FILE *, struct vrp_tree *, struct brk_tree *,
|
2024-02-22 04:49:42 -08:00
|
|
|
struct vap_tree *, struct vsp_tree *, struct stats *);
|
2021-10-11 09:50:03 -07:00
|
|
|
int output_bird1v4(FILE *, struct vrp_tree *, struct brk_tree *,
|
2024-02-22 04:49:42 -08:00
|
|
|
struct vap_tree *, struct vsp_tree *, struct stats *);
|
2021-10-11 09:50:03 -07:00
|
|
|
int output_bird1v6(FILE *, struct vrp_tree *, struct brk_tree *,
|
2024-02-22 04:49:42 -08:00
|
|
|
struct vap_tree *, struct vsp_tree *, struct stats *);
|
2021-10-11 09:50:03 -07:00
|
|
|
int output_bird2(FILE *, struct vrp_tree *, struct brk_tree *,
|
2024-02-22 04:49:42 -08:00
|
|
|
struct vap_tree *, struct vsp_tree *, struct stats *);
|
2021-10-11 09:50:03 -07:00
|
|
|
int output_csv(FILE *, struct vrp_tree *, struct brk_tree *,
|
2024-02-22 04:49:42 -08:00
|
|
|
struct vap_tree *, struct vsp_tree *, struct stats *);
|
2021-10-11 09:50:03 -07:00
|
|
|
int output_json(FILE *, struct vrp_tree *, struct brk_tree *,
|
2024-02-22 04:49:42 -08:00
|
|
|
struct vap_tree *, struct vsp_tree *, struct stats *);
|
2022-12-15 04:02:29 -08:00
|
|
|
int output_ometric(FILE *, struct vrp_tree *, struct brk_tree *,
|
2024-02-22 04:49:42 -08:00
|
|
|
struct vap_tree *, struct vsp_tree *, struct stats *);
|
2019-12-04 04:40:17 -08:00
|
|
|
|
2024-02-21 04:48:25 -08:00
|
|
|
void logx(const char *fmt, ...)
|
2019-12-04 04:40:17 -08:00
|
|
|
__attribute__((format(printf, 1, 2)));
|
2024-02-21 04:48:25 -08:00
|
|
|
time_t getmonotime(void);
|
|
|
|
time_t get_current_time(void);
|
2019-06-17 07:31:30 -07:00
|
|
|
|
2021-03-02 01:23:59 -08:00
|
|
|
int mkpath(const char *);
|
2022-04-04 09:02:54 -07:00
|
|
|
int mkpathat(int, const char *);
|
2021-02-02 10:33:11 -08:00
|
|
|
|
2021-11-04 07:21:19 -07:00
|
|
|
#define RPKI_PATH_OUT_DIR "/var/db/rpki-client"
|
|
|
|
#define RPKI_PATH_BASE_DIR "/var/cache/rpki-client"
|
2019-11-28 20:04:08 -08:00
|
|
|
|
2022-06-27 03:18:27 -07:00
|
|
|
#define DEFAULT_SKIPLIST_FILE "/etc/rpki/skiplist"
|
|
|
|
|
2024-08-29 02:53:04 -07:00
|
|
|
/* Interval in which random reinitialization to an RRDP snapshot happens. */
|
|
|
|
#define RRDP_RANDOM_REINIT_MAX 12 /* weeks */
|
|
|
|
|
2022-04-02 05:17:53 -07:00
|
|
|
/* Maximum number of TAL files we'll load. */
|
2022-08-17 04:57:46 -07:00
|
|
|
#define TALSZ_MAX 8
|
2024-05-20 08:51:43 -07:00
|
|
|
#define CERTID_MAX 1000000
|
2022-04-02 05:17:53 -07:00
|
|
|
|
2022-08-17 04:57:46 -07:00
|
|
|
/*
|
|
|
|
* Maximum number of elements in the sbgp-ipAddrBlock (IP) and
|
|
|
|
* sbgp-autonomousSysNum (AS) X.509v3 extension of CA/EE certificates.
|
|
|
|
*/
|
2021-11-04 07:21:19 -07:00
|
|
|
#define MAX_IP_SIZE 200000
|
|
|
|
#define MAX_AS_SIZE 200000
|
2021-10-27 14:56:58 -07:00
|
|
|
|
2021-11-03 03:50:18 -07:00
|
|
|
/* Maximum acceptable URI length */
|
2021-11-04 07:21:19 -07:00
|
|
|
#define MAX_URI_LENGTH 2048
|
2021-10-27 14:56:58 -07:00
|
|
|
|
2023-11-24 06:05:47 -08:00
|
|
|
/* Min/Max acceptable file size */
|
|
|
|
#define MIN_FILE_SIZE 100
|
2024-08-21 12:35:31 -07:00
|
|
|
#define MAX_FILE_SIZE 8000000
|
2021-10-27 14:56:58 -07:00
|
|
|
|
2022-06-01 03:59:21 -07:00
|
|
|
/* Maximum number of FileNameAndHash entries per RSC checklist. */
|
|
|
|
#define MAX_CHECKLIST_ENTRIES 100000
|
|
|
|
|
2021-11-03 03:50:18 -07:00
|
|
|
/* Maximum number of FileAndHash entries per manifest. */
|
2021-11-04 07:21:19 -07:00
|
|
|
#define MAX_MANIFEST_ENTRIES 100000
|
2021-10-28 06:51:42 -07:00
|
|
|
|
2022-08-30 11:56:49 -07:00
|
|
|
/* Maximum number of Providers per ASPA object. */
|
|
|
|
#define MAX_ASPA_PROVIDERS 10000
|
|
|
|
|
2021-11-03 03:50:18 -07:00
|
|
|
/* Maximum depth of the RPKI tree. */
|
2021-11-04 07:21:19 -07:00
|
|
|
#define MAX_CERT_DEPTH 12
|
2021-11-03 03:50:18 -07:00
|
|
|
|
2022-05-24 02:20:49 -07:00
|
|
|
/* Maximum number of concurrent http and rsync requests. */
|
|
|
|
#define MAX_HTTP_REQUESTS 64
|
|
|
|
#define MAX_RSYNC_REQUESTS 16
|
2021-11-03 07:59:37 -07:00
|
|
|
|
2022-08-08 07:10:10 -07:00
|
|
|
/* How many seconds to wait for a connection to succeed. */
|
2022-08-09 02:02:26 -07:00
|
|
|
#define MAX_CONN_TIMEOUT 15
|
2022-08-08 07:10:10 -07:00
|
|
|
|
2022-08-17 04:57:46 -07:00
|
|
|
/* How many seconds to wait for IO from a remote server. */
|
2022-08-10 03:27:03 -07:00
|
|
|
#define MAX_IO_TIMEOUT 30
|
2022-08-08 08:22:31 -07:00
|
|
|
|
2022-08-17 04:57:46 -07:00
|
|
|
/* Maximum number of delegated hosting locations (repositories) for each TAL. */
|
2021-11-09 03:03:39 -08:00
|
|
|
#define MAX_REPO_PER_TAL 1000
|
|
|
|
|
2024-03-21 20:38:12 -07:00
|
|
|
#define HTTP_PROTO "http://"
|
|
|
|
#define HTTP_PROTO_LEN (sizeof(HTTP_PROTO) - 1)
|
|
|
|
#define HTTPS_PROTO "https://"
|
|
|
|
#define HTTPS_PROTO_LEN (sizeof(HTTPS_PROTO) - 1)
|
|
|
|
#define RSYNC_PROTO "rsync://"
|
|
|
|
#define RSYNC_PROTO_LEN (sizeof(RSYNC_PROTO) - 1)
|
|
|
|
|
2019-06-17 07:31:30 -07:00
|
|
|
#endif /* ! EXTERN_H */
|