the cert, gbr, mft, roa and tal file contents. No real functional change.
OK tb@
-# $OpenBSD: Makefile.inc,v 1.14 2021/10/11 17:32:27 job Exp $
+# $OpenBSD: Makefile.inc,v 1.15 2021/10/24 17:54:28 claudio Exp $
.PATH: ${.CURDIR}/../../../../usr.sbin/rpki-client
LDADD+= -lcrypto -lutil
DPADD+= ${LIBCRYPTO} ${LIBUTIL}
-SRCS_test-ip= test-ip.c ip.c io.c
+SRCS_test-ip= test-ip.c ip.c io.c encoding.c print.c
run-regress-test-ip: test-ip
./test-ip
TALARGS += ta/ripe-ncc-ta.cer tal/ripe.tal
SRCS_test-cert+= test-cert.c cert.c cms.c x509.c ip.c as.c io.c \
- log.c tal.c validate.c encoding.c
+ log.c tal.c validate.c encoding.c print.c
run-regress-test-cert: test-cert
./test-cert -v ${.CURDIR}/../cer/*.cer
./test-cert -vt ${TALARGS:S,,${.CURDIR}/../&,}
-SRCS_test-mft+= test-mft.c mft.c cms.c x509.c io.c log.c validate.c \
- encoding.c dummy.c
+SRCS_test-mft+= test-mft.c mft.c cms.c x509.c ip.c io.c log.c validate.c \
+ encoding.c print.c dummy.c
run-regress-test-mft: test-mft
./test-mft -v ${.CURDIR}/../mft/*.mft
-SRCS_test-roa+= test-roa.c roa.c cms.c x509.c ip.c as.c io.c log.c encoding.c
+SRCS_test-roa+= test-roa.c roa.c cms.c x509.c ip.c as.c io.c log.c \
+ encoding.c print.c
run-regress-test-roa: test-roa
./test-roa -v ${.CURDIR}/../roa/*.roa
-SRCS_test-gbr+= test-gbr.c gbr.c cms.c x509.c io.c log.c encoding.c
+SRCS_test-gbr+= test-gbr.c gbr.c cms.c x509.c ip.c io.c log.c \
+ encoding.c print.c
run-regress-test-gbr: test-gbr
./test-gbr -v ${.CURDIR}/../gbr/*.gbr
-SRCS_test-tal+= test-tal.c tal.c io.c log.c validate.c encoding.c dummy.c
+SRCS_test-tal+= test-tal.c tal.c ip.c io.c log.c validate.c \
+ encoding.c print.c dummy.c
run-regress-test-tal: test-tal
./test-tal -v ${.CURDIR}/../tal/*.tal
{
return -1;
}
-
-int
-ip_addr_check_covered(enum afi afi,
- const unsigned char *min, const unsigned char *max,
- const struct cert_ip *ips, size_t ipsz)
-{
- return -1;
-}
-
-void
-ip_addr_print(const struct ip_addr *addr,
- enum afi afi, char *buf, size_t bufsz)
-{
-}
-
-/* $Id: test-cert.c,v 1.13 2021/10/13 06:56:07 claudio Exp $ */
+/* $Id: test-cert.c,v 1.14 2021/10/24 17:54:28 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
#include "extern.h"
-#include "test-common.c"
-
int verbose;
-static void
-cert_print(const struct cert *p)
-{
- size_t i;
- char buf1[64], buf2[64];
- int sockt;
- char tbuf[21];
-
- assert(p != NULL);
-
- printf("Subject key identifier: %s\n", pretty_key_id(p->ski));
- if (p->aki != NULL)
- printf("Authority key identifier: %s\n", pretty_key_id(p->aki));
- if (p->aia != NULL)
- printf("Authority info access: %s\n", p->aia);
- if (p->mft != NULL)
- printf("Manifest: %s\n", p->mft);
- if (p->repo != NULL)
- printf("caRepository: %s\n", p->repo);
- if (p->notify != NULL)
- printf("Notify URL: %s\n", p->notify);
- if (p->pubkey != NULL)
- printf("BGPsec P-256 ECDSA public key: %s\n", p->pubkey);
- strftime(tbuf, sizeof(tbuf), "%FT%TZ", gmtime(&p->expires));
- printf("Valid until: %s\n", tbuf);
-
- printf("Subordinate Resources:\n");
-
- for (i = 0; i < p->asz; i++)
- switch (p->as[i].type) {
- case CERT_AS_ID:
- printf("%5zu: AS: %"
- PRIu32 "\n", i + 1, p->as[i].id);
- break;
- case CERT_AS_INHERIT:
- printf("%5zu: AS: inherit\n", i + 1);
- break;
- case CERT_AS_RANGE:
- printf("%5zu: AS: %"
- PRIu32 "--%" PRIu32 "\n", i + 1,
- p->as[i].range.min, p->as[i].range.max);
- break;
- }
-
- for (i = 0; i < p->ipsz; i++)
- switch (p->ips[i].type) {
- case CERT_IP_INHERIT:
- printf("%5zu: IP: inherit\n", i + 1);
- break;
- case CERT_IP_ADDR:
- ip_addr_print(&p->ips[i].ip,
- p->ips[i].afi, buf1, sizeof(buf1));
- printf("%5zu: IP: %s\n", i + 1, buf1);
- break;
- case CERT_IP_RANGE:
- sockt = (p->ips[i].afi == AFI_IPV4) ?
- AF_INET : AF_INET6;
- inet_ntop(sockt, p->ips[i].min, buf1, sizeof(buf1));
- inet_ntop(sockt, p->ips[i].max, buf2, sizeof(buf2));
- printf("%5zu: IP: %s--%s\n", i + 1, buf1, buf2);
- break;
- }
-
-}
-
int
main(int argc, char *argv[])
{
+++ /dev/null
-/* $OpenBSD: test-common.c,v 1.1 2021/03/29 15:47:34 claudio Exp $ */
-/*
- * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
- *
- * 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.
- */
-
-const char *
-pretty_key_id(char *hex)
-{
- static char buf[128]; /* bigger than SHA_DIGEST_LENGTH * 3 */
- size_t i;
-
- for (i = 0; i < sizeof(buf) && *hex != '\0'; i++) {
- if (i % 3 == 2 && *hex != '\0')
- buf[i] = ':';
- else
- buf[i] = *hex++;
- }
- if (i == sizeof(buf))
- memcpy(buf + sizeof(buf) - 4, "...", 4);
- return buf;
-}
-/* $Id: test-gbr.c,v 1.3 2021/03/29 15:47:34 claudio Exp $ */
+/* $Id: test-gbr.c,v 1.4 2021/10/24 17:54:28 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
#include "extern.h"
-#include "test-common.c"
-
int verbose;
-static void
-gbr_print(const struct gbr *p)
-{
- char buf[128];
- size_t i;
-
- assert(p != NULL);
-
- printf("Subject key identifier: %s\n", pretty_key_id(p->ski));
- printf("Authority key identifier: %s\n", pretty_key_id(p->aki));
- printf("Authority info access: %s\n", p->aia);
- printf("vcard:\n%s", p->vcard);
-}
-
int
main(int argc, char *argv[])
{
-/* $Id: test-mft.c,v 1.15 2021/10/09 18:43:49 deraadt Exp $ */
+/* $Id: test-mft.c,v 1.16 2021/10/24 17:54:28 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
#include "extern.h"
-#include "test-common.c"
-
int verbose;
-static void
-mft_print(const struct mft *p)
-{
- size_t i;
- char hash[256];
-
- assert(p != NULL);
-
- printf("Subject key identifier: %s\n", pretty_key_id(p->ski));
- printf("Authority key identifier: %s\n", pretty_key_id(p->aki));
- printf("Authority info access: %s\n", p->aia);
- printf("Manifest Number: %s\n", p->seqnum);
- for (i = 0; i < p->filesz; i++) {
- b64_ntop(p->files[i].hash, sizeof(p->files[i].hash),
- hash, sizeof(hash));
- printf("%5zu: %s\n", i + 1, p->files[i].file);
- printf("\thash %s\n", hash);
- }
-}
-
-
int
main(int argc, char *argv[])
{
-/* $Id: test-roa.c,v 1.12 2021/10/07 10:34:39 claudio Exp $ */
+/* $Id: test-roa.c,v 1.13 2021/10/24 17:54:28 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
#include "extern.h"
-#include "test-common.c"
-
int verbose;
-static void
-roa_print(const struct roa *p)
-{
- char buf[128];
- size_t i;
- char tbuf[21];
-
- assert(p != NULL);
-
- printf("Subject key identifier: %s\n", pretty_key_id(p->ski));
- printf("Authority key identifier: %s\n", pretty_key_id(p->aki));
- printf("Authority info access: %s\n", p->aia);
- strftime(tbuf, sizeof(tbuf), "%FT%TZ", gmtime(&p->expires));
- printf("ROA valid until: %s\n", tbuf);
-
- printf("asID: %" PRIu32 "\n", p->asid);
- for (i = 0; i < p->ipsz; i++) {
- ip_addr_print(&p->ips[i].addr,
- p->ips[i].afi, buf, sizeof(buf));
- printf("%5zu: %s (max: %zu)\n", i + 1,
- buf, p->ips[i].maxlength);
- }
-}
-
int
main(int argc, char *argv[])
{
-/* $Id: test-tal.c,v 1.6 2020/11/09 16:13:02 tb Exp $ */
+/* $Id: test-tal.c,v 1.7 2021/10/24 17:54:28 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
int verbose;
-static void
-tal_print(const struct tal *p)
-{
- size_t i;
-
- assert(p != NULL);
-
- for (i = 0; i < p->urisz; i++)
- printf("%5zu: URI: %s\n", i + 1, p->uri[i]);
-}
-
int
main(int argc, char *argv[])
{