summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--regress/usr.sbin/rpki-client/test-cert.c8
-rw-r--r--regress/usr.sbin/rpki-client/test-common.c33
-rw-r--r--regress/usr.sbin/rpki-client/test-gbr.c8
-rw-r--r--regress/usr.sbin/rpki-client/test-mft.c8
-rw-r--r--regress/usr.sbin/rpki-client/test-roa.c8
5 files changed, 53 insertions, 12 deletions
diff --git a/regress/usr.sbin/rpki-client/test-cert.c b/regress/usr.sbin/rpki-client/test-cert.c
index 37018737c25..681a13538f4 100644
--- a/regress/usr.sbin/rpki-client/test-cert.c
+++ b/regress/usr.sbin/rpki-client/test-cert.c
@@ -1,4 +1,4 @@
-/* $Id: test-cert.c,v 1.9 2021/02/16 08:53:53 job Exp $ */
+/* $Id: test-cert.c,v 1.10 2021/03/29 15:47:34 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -32,6 +32,8 @@
#include "extern.h"
+#include "test-common.c"
+
int verbose;
static void
@@ -49,9 +51,9 @@ cert_print(const struct cert *p)
printf("Notify URL: %s\n", p->notify);
if (p->crl != NULL)
printf("Revocation list: %s\n", p->crl);
- printf("Subject key identifier: %s\n", p->ski);
+ printf("Subject key identifier: %s\n", pretty_key_id(p->ski));
if (p->aki != NULL)
- printf("Authority key identifier: %s\n", p->aki);
+ printf("Authority key identifier: %s\n", pretty_key_id(p->aki));
if (p->aia != NULL)
printf("Authority info access: %s\n", p->aia);
diff --git a/regress/usr.sbin/rpki-client/test-common.c b/regress/usr.sbin/rpki-client/test-common.c
new file mode 100644
index 00000000000..8e08fc2efe4
--- /dev/null
+++ b/regress/usr.sbin/rpki-client/test-common.c
@@ -0,0 +1,33 @@
+/* $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;
+}
diff --git a/regress/usr.sbin/rpki-client/test-gbr.c b/regress/usr.sbin/rpki-client/test-gbr.c
index 39c371e54c3..a97e6ad8a7d 100644
--- a/regress/usr.sbin/rpki-client/test-gbr.c
+++ b/regress/usr.sbin/rpki-client/test-gbr.c
@@ -1,4 +1,4 @@
-/* $Id: test-gbr.c,v 1.2 2021/02/16 08:53:53 job Exp $ */
+/* $Id: test-gbr.c,v 1.3 2021/03/29 15:47:34 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -30,6 +30,8 @@
#include "extern.h"
+#include "test-common.c"
+
int verbose;
static void
@@ -40,8 +42,8 @@ gbr_print(const struct gbr *p)
assert(p != NULL);
- printf("Subject key identifier: %s\n", p->ski);
- printf("Authority key identifier: %s\n", p->aki);
+ 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);
}
diff --git a/regress/usr.sbin/rpki-client/test-mft.c b/regress/usr.sbin/rpki-client/test-mft.c
index 6e48d1a66f6..0f17bcf10f3 100644
--- a/regress/usr.sbin/rpki-client/test-mft.c
+++ b/regress/usr.sbin/rpki-client/test-mft.c
@@ -1,4 +1,4 @@
-/* $Id: test-mft.c,v 1.12 2021/03/28 16:22:17 job Exp $ */
+/* $Id: test-mft.c,v 1.13 2021/03/29 15:47:34 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -34,6 +34,8 @@
#include "extern.h"
+#include "test-common.c"
+
#ifndef ASN1error
void
ASN1error(int err)
@@ -52,8 +54,8 @@ mft_print(const struct mft *p)
assert(p != NULL);
- printf("Subject key identifier: %s\n", p->ski);
- printf("Authority key identifier: %s\n", p->aki);
+ 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++) {
diff --git a/regress/usr.sbin/rpki-client/test-roa.c b/regress/usr.sbin/rpki-client/test-roa.c
index 2e479ebf55f..2f3c77b0f8b 100644
--- a/regress/usr.sbin/rpki-client/test-roa.c
+++ b/regress/usr.sbin/rpki-client/test-roa.c
@@ -1,4 +1,4 @@
-/* $Id: test-roa.c,v 1.9 2021/02/16 08:53:53 job Exp $ */
+/* $Id: test-roa.c,v 1.10 2021/03/29 15:47:34 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -30,6 +30,8 @@
#include "extern.h"
+#include "test-common.c"
+
int verbose;
static void
@@ -40,8 +42,8 @@ roa_print(const struct roa *p)
assert(p != NULL);
- printf("Subject key identifier: %s\n", p->ski);
- printf("Authority key identifier: %s\n", p->aki);
+ 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("asID: %" PRIu32 "\n", p->asid);
for (i = 0; i < p->ipsz; i++) {