summaryrefslogtreecommitdiff
path: root/regress/usr.sbin/rpki-client
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2021-10-26 16:59:55 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2021-10-26 16:59:55 +0000
commit4424b4f8e6a4e62d023c5653c106f3486b412b1e (patch)
treea56b4732a2dc23678b8f5e349771ae79c3368b5c /regress/usr.sbin/rpki-client
parent6160d8fff59923bdd164d4fd84b7b024ead9aa0b (diff)
Adjust regress to the new BIO-free world order.
Diffstat (limited to 'regress/usr.sbin/rpki-client')
-rw-r--r--regress/usr.sbin/rpki-client/test-cert.c19
-rw-r--r--regress/usr.sbin/rpki-client/test-gbr.c12
-rw-r--r--regress/usr.sbin/rpki-client/test-mft.c12
-rw-r--r--regress/usr.sbin/rpki-client/test-roa.c13
-rw-r--r--regress/usr.sbin/rpki-client/test-tal.c7
5 files changed, 45 insertions, 18 deletions
diff --git a/regress/usr.sbin/rpki-client/test-cert.c b/regress/usr.sbin/rpki-client/test-cert.c
index 1a56eedd4e3..50cba22e53b 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.14 2021/10/24 17:54:28 claudio Exp $ */
+/* $Id: test-cert.c,v 1.15 2021/10/26 16:59:54 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -71,15 +71,19 @@ main(int argc, char *argv[])
const char *cert_path = argv[i];
const char *tal_path = argv[i + 1];
char *buf;
+ size_t len;
struct tal *tal;
- buf = tal_read_file(tal_path);
- tal = tal_parse(tal_path, buf);
+ buf = load_file(tal_path, &len);
+ tal = tal_parse(tal_path, buf, len);
free(buf);
if (tal == NULL)
break;
- p = ta_parse(&xp, cert_path, tal->pkey, tal->pkeysz);
+ buf = load_file(cert_path, &len);
+ p = ta_parse(&xp, cert_path, buf, len,
+ tal->pkey, tal->pkeysz);
+ free(buf);
tal_free(tal);
if (p == NULL)
break;
@@ -91,11 +95,16 @@ main(int argc, char *argv[])
}
} else {
for (i = 0; i < argc; i++) {
- p = cert_parse(&xp, argv[i]);
+ char *buf;
+ size_t len;
+
+ buf = load_file(argv[i], &len);
+ p = cert_parse(&xp, argv[i], buf, len);
if (p == NULL)
break;
if (verb)
cert_print(p);
+ free(buf);
cert_free(p);
X509_free(xp);
}
diff --git a/regress/usr.sbin/rpki-client/test-gbr.c b/regress/usr.sbin/rpki-client/test-gbr.c
index cca4977384b..b7310516d56 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.4 2021/10/24 17:54:28 claudio Exp $ */
+/* $Id: test-gbr.c,v 1.5 2021/10/26 16:59:54 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -39,6 +39,8 @@ main(int argc, char *argv[])
BIO *bio_out = NULL;
X509 *xp = NULL;
struct gbr *p;
+ unsigned char *buf;
+ size_t len;
ERR_load_crypto_strings();
@@ -68,8 +70,11 @@ main(int argc, char *argv[])
errx(1, "argument missing");
for (i = 0; i < argc; i++) {
- if ((p = gbr_parse(&xp, argv[i])) == NULL)
- break;
+ buf = load_file(argv[1], &len);
+ if ((p = gbr_parse(&xp, argv[i], buf, len)) == NULL) {
+ free(buf);
+ continue;
+ }
if (verb)
gbr_print(p);
if (ppem) {
@@ -77,6 +82,7 @@ main(int argc, char *argv[])
errx(1,
"PEM_write_bio_X509: unable to write cert");
}
+ free(buf);
gbr_free(p);
X509_free(xp);
}
diff --git a/regress/usr.sbin/rpki-client/test-mft.c b/regress/usr.sbin/rpki-client/test-mft.c
index 7d0343907f8..fe7a08b0e09 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.16 2021/10/24 17:54:28 claudio Exp $ */
+/* $Id: test-mft.c,v 1.17 2021/10/26 16:59:54 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -42,6 +42,8 @@ main(int argc, char *argv[])
struct mft *p;
BIO *bio_out = NULL;
X509 *xp = NULL;
+ unsigned char *buf;
+ size_t len;
ERR_load_crypto_strings();
OpenSSL_add_all_ciphers();
@@ -70,8 +72,11 @@ main(int argc, char *argv[])
errx(1, "argument missing");
for (i = 0; i < argc; i++) {
- if ((p = mft_parse(&xp, argv[i])) == NULL)
- break;
+ buf = load_file(argv[i], &len);
+ if ((p = mft_parse(&xp, argv[i], buf, len)) == NULL) {
+ free(buf);
+ continue;
+ }
if (verb)
mft_print(p);
if (ppem) {
@@ -79,6 +84,7 @@ main(int argc, char *argv[])
errx(1,
"PEM_write_bio_X509: unable to write cert");
}
+ free(buf);
mft_free(p);
X509_free(xp);
}
diff --git a/regress/usr.sbin/rpki-client/test-roa.c b/regress/usr.sbin/rpki-client/test-roa.c
index 4824e028d80..ff71bcf1a9e 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.13 2021/10/24 17:54:28 claudio Exp $ */
+/* $Id: test-roa.c,v 1.14 2021/10/26 16:59:54 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -39,7 +39,8 @@ main(int argc, char *argv[])
BIO *bio_out = NULL;
X509 *xp = NULL;
struct roa *p;
-
+ unsigned char *buf;
+ size_t len;
ERR_load_crypto_strings();
OpenSSL_add_all_ciphers();
@@ -68,8 +69,11 @@ main(int argc, char *argv[])
errx(1, "argument missing");
for (i = 0; i < argc; i++) {
- if ((p = roa_parse(&xp, argv[i])) == NULL)
- break;
+ buf = load_file(argv[i], &len);
+ if ((p = roa_parse(&xp, argv[i], buf, len)) == NULL) {
+ free(buf);
+ continue;
+ }
if (verb)
roa_print(p);
if (ppem) {
@@ -77,6 +81,7 @@ main(int argc, char *argv[])
errx(1,
"PEM_write_bio_X509: unable to write cert");
}
+ free(buf);
roa_free(p);
X509_free(xp);
}
diff --git a/regress/usr.sbin/rpki-client/test-tal.c b/regress/usr.sbin/rpki-client/test-tal.c
index dedd329f08a..965813ba5b4 100644
--- a/regress/usr.sbin/rpki-client/test-tal.c
+++ b/regress/usr.sbin/rpki-client/test-tal.c
@@ -1,4 +1,4 @@
-/* $Id: test-tal.c,v 1.7 2021/10/24 17:54:28 claudio Exp $ */
+/* $Id: test-tal.c,v 1.8 2021/10/26 16:59:54 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -36,6 +36,7 @@ main(int argc, char *argv[])
{
int c, i, verb = 0;
char *buf;
+ size_t len;
struct tal *tal;
ERR_load_crypto_strings();
@@ -58,8 +59,8 @@ main(int argc, char *argv[])
errx(1, "argument missing");
for (i = 0; i < argc; i++) {
- buf = tal_read_file(argv[i]);
- tal = tal_parse(argv[i], buf);
+ buf = load_file(argv[i], &len);
+ tal = tal_parse(argv[i], buf, len);
free(buf);
if (tal == NULL)
break;