-/* $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>
*
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;
}
} 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);
}
-/* $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>
*
BIO *bio_out = NULL;
X509 *xp = NULL;
struct gbr *p;
+ unsigned char *buf;
+ size_t len;
ERR_load_crypto_strings();
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) {
errx(1,
"PEM_write_bio_X509: unable to write cert");
}
+ free(buf);
gbr_free(p);
X509_free(xp);
}
-/* $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>
*
struct mft *p;
BIO *bio_out = NULL;
X509 *xp = NULL;
+ unsigned char *buf;
+ size_t len;
ERR_load_crypto_strings();
OpenSSL_add_all_ciphers();
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) {
errx(1,
"PEM_write_bio_X509: unable to write cert");
}
+ free(buf);
mft_free(p);
X509_free(xp);
}
-/* $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>
*
BIO *bio_out = NULL;
X509 *xp = NULL;
struct roa *p;
-
+ unsigned char *buf;
+ size_t len;
ERR_load_crypto_strings();
OpenSSL_add_all_ciphers();
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) {
errx(1,
"PEM_write_bio_X509: unable to write cert");
}
+ free(buf);
roa_free(p);
X509_free(xp);
}
-/* $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>
*
{
int c, i, verb = 0;
char *buf;
+ size_t len;
struct tal *tal;
ERR_load_crypto_strings();
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;