openssl: Read cert from private key file when needed

* src/openssl.c (ssl_init): Assign opt.cert_{file, type}
  from opt.private_key(_type)
This commit is contained in:
Rohit Mathulla 2015-04-24 15:48:30 +10:00 committed by Tim Ruehsen
parent 8654f7e2e7
commit 3765a1b266
1 changed files with 7 additions and 0 deletions

View File

@ -296,6 +296,13 @@ ssl_init (void)
opt.private_key_type = opt.cert_type;
}
/* Use cert from private key file unless otherwise specified. */
if (opt.private_key && !opt.cert_file)
{
opt.cert_file = xstrdup (opt.private_key);
opt.cert_type = opt.private_key_type;
}
if (opt.cert_file)
if (SSL_CTX_use_certificate_file (ssl_ctx, opt.cert_file,
key_type_to_ssl_type (opt.cert_type))