From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 1/2] eap-tls-common: update to new ELL TLS APIs
Date: Tue, 01 Oct 2019 14:32:50 -0700 [thread overview]
Message-ID: <20191001213251.2536-1-prestwoj@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1634 bytes --]
---
src/eap-tls-common.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/eap-tls-common.c b/src/eap-tls-common.c
index b069fcfd..d5b72963 100644
--- a/src/eap-tls-common.c
+++ b/src/eap-tls-common.c
@@ -523,6 +523,9 @@ static int eap_tls_handle_fragmented_request(struct eap_state *eap,
static bool eap_tls_tunnel_init(struct eap_state *eap)
{
struct eap_tls_state *eap_tls = eap_get_data(eap);
+ struct l_certchain *client_cert;
+ struct l_key *client_key;
+ struct l_queue *ca_cert;
if (eap_tls->tunnel)
return false;
@@ -543,14 +546,20 @@ static bool eap_tls_tunnel_init(struct eap_state *eap)
l_tls_set_debug(eap_tls->tunnel, eap_tls_tunnel_debug, eap,
NULL);
- if (!l_tls_set_auth_data(eap_tls->tunnel, eap_tls->client_cert,
- eap_tls->client_key,
- eap_tls->passphrase) ||
- (eap_tls->ca_cert &&
- !l_tls_set_cacert(eap_tls->tunnel,
- eap_tls->ca_cert))) {
+ client_cert = l_pem_load_certificate_chain(eap_tls->client_cert);
+ client_key = l_pem_load_private_key(eap_tls->client_key,
+ eap_tls->passphrase, NULL);
+ ca_cert = l_pem_load_certificate_list(eap_tls->ca_cert);
+
+ if (!l_tls_set_auth_data(eap_tls->tunnel, client_cert, client_key) ||
+ (ca_cert &&
+ !l_tls_set_cacert(eap_tls->tunnel, ca_cert))) {
l_error("%s: Error loading TLS keys or certificates.",
eap_get_method_name(eap));
+ l_certchain_free(client_cert);
+ l_key_free(client_key);
+ l_queue_destroy(ca_cert,
+ (l_queue_destroy_func_t)l_certchain_free);
return false;
}
--
2.17.1
next reply other threads:[~2019-10-01 21:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-01 21:32 James Prestwood [this message]
2019-10-01 21:32 ` [PATCH 2/2] unit: update test-eapol to new ELL APIs James Prestwood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191001213251.2536-1-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox