summaryrefslogtreecommitdiff
path: root/sbin/isakmpd
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>2001-08-16 16:51:58 +0000
committerHakan Olsson <ho@cvs.openbsd.org>2001-08-16 16:51:58 +0000
commit0377c97775b9225793e4b6784dfd94707feca687 (patch)
treed97ff1d6f8a0f80ae35a55059540321574a20deb /sbin/isakmpd
parent3b4821547f38695990aaeea8f8f9b2929535aab1 (diff)
openssl black magic.
Diffstat (limited to 'sbin/isakmpd')
-rw-r--r--sbin/isakmpd/ike_auth.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/sbin/isakmpd/ike_auth.c b/sbin/isakmpd/ike_auth.c
index 88e4f254a69..58d0740228b 100644
--- a/sbin/isakmpd/ike_auth.c
+++ b/sbin/isakmpd/ike_auth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ike_auth.c,v 1.56 2001/08/16 13:49:50 ho Exp $ */
+/* $OpenBSD: ike_auth.c,v 1.57 2001/08/16 16:51:57 ho Exp $ */
/* $EOM: ike_auth.c,v 1.59 2000/11/21 00:21:31 angelos Exp $ */
/*
@@ -1192,7 +1192,7 @@ get_raw_key_from_file (int type, u_int8_t *id, size_t id_len, RSA **rsa)
char filename[FILENAME_MAX];
char *rdir, *base, *addrstr = 0;
struct stat st;
- FILE *fp;
+ BIO *bio;
if (type != IKE_AUTH_RSA_SIG) /* XXX More types? */
{
@@ -1265,16 +1265,23 @@ get_raw_key_from_file (int type, u_int8_t *id, size_t id_len, RSA **rsa)
/* If the file does not exist, fail silently. */
if (stat (filename, &st) == 0)
{
- fp = fopen (filename, "r");
- if (!fp)
+ bio = LC (BIO_new, (LC (BIO_s_file, ())));
+ if (!bio)
{
- log_error ("get_raw_key_from_file: could not open \"%s\"", filename);
+ log_error ("get_raw_key_from_file: could not initialize BIO");
+ goto out;
+ }
+ if (LC (BIO_read_filename, (bio, filename)) <= 0)
+ {
+ LOG_DBG((LOG_NEGOTIATION, 50, "get_raw_key_from_file: "
+ "BIO_read_filename(bio, \"%s\") failed", filename));
+ LC (BIO_free, (bio));
goto out;
}
LOG_DBG((LOG_NEGOTIATION, 80, "get_raw_key_from_file: reading file %s",
filename));
- *rsa = LC (PEM_read_RSAPublicKey, (fp, NULL, NULL, NULL));
- fclose (fp);
+ *rsa = LC (PEM_read_bio_RSA_PUBKEY, (bio, NULL, NULL, NULL));
+ LC (BIO_free, (bio));
}
else
LOG_DBG((LOG_NEGOTIATION, 50, "get_raw_key_from_file: file %s not found",