From a5e3d3ca92c103f29c3521e4435e016069100a15 Mon Sep 17 00:00:00 2001 From: tb Date: Fri, 26 Aug 2022 06:28:41 +0000 Subject: [PATCH] Remove unnecessary BIO dances and use stdout directly. --- regress/usr.sbin/rpki-client/test-gbr.c | 8 ++------ regress/usr.sbin/rpki-client/test-mft.c | 8 ++------ regress/usr.sbin/rpki-client/test-roa.c | 8 ++------ regress/usr.sbin/rpki-client/test-rsc.c | 8 ++------ 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/regress/usr.sbin/rpki-client/test-gbr.c b/regress/usr.sbin/rpki-client/test-gbr.c index 167b9713249..cd72697c000 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.9 2022/05/31 21:35:46 tb Exp $ */ +/* $Id: test-gbr.c,v 1.10 2022/08/26 06:28:41 tb Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -37,7 +37,6 @@ int main(int argc, char *argv[]) { int c, i, ppem = 0, verb = 0; - BIO *bio_out = NULL; X509 *xp = NULL; struct gbr *p; unsigned char *buf; @@ -55,8 +54,6 @@ main(int argc, char *argv[]) if (ppem) break; ppem = 1; - if ((bio_out = BIO_new_fp(stdout, BIO_NOCLOSE)) == NULL) - errx(1, "BIO_new_fp"); break; case 'v': verb++; @@ -80,7 +77,7 @@ main(int argc, char *argv[]) if (verb) gbr_print(xp, p); if (ppem) { - if (!PEM_write_bio_X509(bio_out, xp)) + if (!PEM_write_X509(stdout, xp)) errx(1, "PEM_write_bio_X509: unable to write cert"); } @@ -89,7 +86,6 @@ main(int argc, char *argv[]) X509_free(xp); } - BIO_free(bio_out); EVP_cleanup(); CRYPTO_cleanup_all_ex_data(); ERR_free_strings(); diff --git a/regress/usr.sbin/rpki-client/test-mft.c b/regress/usr.sbin/rpki-client/test-mft.c index 5c17ad90fc8..1af4c68a379 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.20 2022/05/31 21:35:46 tb Exp $ */ +/* $Id: test-mft.c,v 1.21 2022/08/26 06:28:41 tb Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -41,7 +41,6 @@ main(int argc, char *argv[]) { int c, i, ppem = 0, verb = 0; struct mft *p; - BIO *bio_out = NULL; X509 *xp = NULL; unsigned char *buf; size_t len; @@ -57,8 +56,6 @@ main(int argc, char *argv[]) if (ppem) break; ppem = 1; - if ((bio_out = BIO_new_fp(stdout, BIO_NOCLOSE)) == NULL) - errx(1, "BIO_new_fp"); break; case 'v': verb++; @@ -82,7 +79,7 @@ main(int argc, char *argv[]) if (verb) mft_print(xp, p); if (ppem) { - if (!PEM_write_bio_X509(bio_out, xp)) + if (!PEM_write_X509(stdout, xp)) errx(1, "PEM_write_bio_X509: unable to write cert"); } @@ -91,7 +88,6 @@ main(int argc, char *argv[]) X509_free(xp); } - BIO_free(bio_out); EVP_cleanup(); CRYPTO_cleanup_all_ex_data(); ERR_free_strings(); diff --git a/regress/usr.sbin/rpki-client/test-roa.c b/regress/usr.sbin/rpki-client/test-roa.c index e314cea9a91..da4e874e865 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.17 2022/05/31 21:35:46 tb Exp $ */ +/* $Id: test-roa.c,v 1.18 2022/08/26 06:28:41 tb Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -37,7 +37,6 @@ int main(int argc, char *argv[]) { int c, i, ppem = 0, verb = 0; - BIO *bio_out = NULL; X509 *xp = NULL; struct roa *p; unsigned char *buf; @@ -54,8 +53,6 @@ main(int argc, char *argv[]) if (ppem) break; ppem = 1; - if ((bio_out = BIO_new_fp(stdout, BIO_NOCLOSE)) == NULL) - errx(1, "BIO_new_fp"); break; case 'v': verb++; @@ -79,7 +76,7 @@ main(int argc, char *argv[]) if (verb) roa_print(xp, p); if (ppem) { - if (!PEM_write_bio_X509(bio_out, xp)) + if (!PEM_write_X509(stdout, xp)) errx(1, "PEM_write_bio_X509: unable to write cert"); } @@ -88,7 +85,6 @@ main(int argc, char *argv[]) X509_free(xp); } - BIO_free(bio_out); EVP_cleanup(); CRYPTO_cleanup_all_ex_data(); ERR_free_strings(); diff --git a/regress/usr.sbin/rpki-client/test-rsc.c b/regress/usr.sbin/rpki-client/test-rsc.c index 5876e214392..5c5e66cfe3e 100644 --- a/regress/usr.sbin/rpki-client/test-rsc.c +++ b/regress/usr.sbin/rpki-client/test-rsc.c @@ -1,4 +1,4 @@ -/* $Id: test-rsc.c,v 1.2 2022/05/31 21:35:46 tb Exp $ */ +/* $Id: test-rsc.c,v 1.3 2022/08/26 06:28:41 tb Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -41,7 +41,6 @@ main(int argc, char *argv[]) { int c, i, ppem = 0, verb = 0; struct rsc *p; - BIO *bio_out = NULL; X509 *xp = NULL; unsigned char *buf; size_t len; @@ -57,8 +56,6 @@ main(int argc, char *argv[]) if (ppem) break; ppem = 1; - if ((bio_out = BIO_new_fp(stdout, BIO_NOCLOSE)) == NULL) - errx(1, "BIO_new_fp"); break; case 'v': verb++; @@ -82,7 +79,7 @@ main(int argc, char *argv[]) if (verb) rsc_print(xp, p); if (ppem) { - if (!PEM_write_bio_X509(bio_out, xp)) + if (!PEM_write_X509(stdout, xp)) errx(1, "PEM_write_bio_X509: unable to write cert"); } @@ -91,7 +88,6 @@ main(int argc, char *argv[]) X509_free(xp); } - BIO_free(bio_out); EVP_cleanup(); CRYPTO_cleanup_all_ex_data(); ERR_free_strings(); -- 2.20.1