eapol_test: Add option for writing server certificate chain to a file

eapol_test command line argument -o<file> can now be used to request
the received server certificate chain to be written to the specified
file. The certificates will be written in PEM format. [Bug 391]
This commit is contained in:
Jouni Malinen 2011-09-17 22:42:54 +03:00
parent 8a55f56453
commit 1b414f59fc
7 changed files with 60 additions and 9 deletions

View file

@ -59,6 +59,7 @@ struct tls_global {
void (*event_cb)(void *ctx, enum tls_event ev,
union tls_event_data *data);
void *cb_ctx;
int cert_in_cb;
};
static struct tls_global *tls_global = NULL;
@ -694,6 +695,7 @@ void * tls_init(const struct tls_config *conf)
if (conf) {
tls_global->event_cb = conf->event_cb;
tls_global->cb_ctx = conf->cb_ctx;
tls_global->cert_in_cb = conf->cert_in_cb;
}
#ifdef CONFIG_FIPS
@ -1144,7 +1146,7 @@ static void openssl_tls_cert_event(struct tls_connection *conn,
return;
os_memset(&ev, 0, sizeof(ev));
if (conn->cert_probe) {
if (conn->cert_probe || tls_global->cert_in_cb) {
cert = get_x509_cert(err_cert);
ev.peer_cert.cert = cert;
}