summaryrefslogtreecommitdiffstats
path: root/test/danetest.c
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2016-04-06 11:31:31 +0200
committerAndy Polyakov <appro@openssl.org>2016-04-07 21:09:22 +0200
commit02b91dcf1cdd2fc75ecdb47d2fba2936e840ed3c (patch)
tree669e69f9ea515912b76da9ebffdf91e385841160 /test/danetest.c
parent800b299b0a53c871be57c4b2c97c95d6642489ea (diff)
test/[dane|evp_]test.c: BIO-fy file I/O.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'test/danetest.c')
-rw-r--r--test/danetest.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/danetest.c b/test/danetest.c
index 9b7ac1d98d..5bca1aaea1 100644
--- a/test/danetest.c
+++ b/test/danetest.c
@@ -146,7 +146,7 @@ static int verify_chain(SSL *ssl, STACK_OF(X509) *chain)
return (ret);
}
-static STACK_OF(X509) *load_chain(FILE *fp, int nelem)
+static STACK_OF(X509) *load_chain(BIO *fp, int nelem)
{
int count;
char *name = 0;
@@ -164,7 +164,7 @@ static STACK_OF(X509) *load_chain(FILE *fp, int nelem)
for (count = 0;
count < nelem && errtype == 0
- && PEM_read(fp, &name, &header, &data, &len);
+ && PEM_read_bio(fp, &name, &header, &data, &len);
++count) {
const unsigned char *p = data;
@@ -211,12 +211,12 @@ err:
return NULL;
}
-static char *read_to_eol(FILE *f)
+static char *read_to_eol(BIO *f)
{
static char buf[1024];
int n;
- if (fgets(buf, sizeof(buf), f)== NULL)
+ if (!BIO_gets(f, buf, sizeof(buf)))
return NULL;
n = strlen(buf);
@@ -359,7 +359,7 @@ static int allws(const char *cp)
}
static int test_tlsafile(SSL_CTX *ctx, const char *basename,
- FILE *f, const char *path)
+ BIO *f, const char *path)
{
char *line;
int testno = 0;
@@ -463,7 +463,7 @@ static int test_tlsafile(SSL_CTX *ctx, const char *basename,
int main(int argc, char *argv[])
{
- FILE *f;
+ BIO *f;
BIO *bio_err;
SSL_CTX *ctx = NULL;
const char *basedomain;
@@ -488,7 +488,7 @@ int main(int argc, char *argv[])
CRYPTO_set_mem_debug(1);
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
- f = fopen(tlsafile, "r");
+ f = BIO_new_file(tlsafile, "r");
if (f == NULL) {
fprintf(stderr, "%s: Error opening tlsa record file: '%s': %s\n",
progname, tlsafile, strerror(errno));
@@ -523,7 +523,7 @@ int main(int argc, char *argv[])
end:
- (void) fclose(f);
+ BIO_free(f);
SSL_CTX_free(ctx);
#ifndef OPENSSL_NO_CRYPTO_MDEBUG