Fix s_client so it works without a certificate again.
This commit is contained in:
parent
de6859e442
commit
abbc186bd2
@ -231,6 +231,8 @@ int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file)
|
|||||||
|
|
||||||
int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key)
|
int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key)
|
||||||
{
|
{
|
||||||
|
if (cert == NULL)
|
||||||
|
return 1;
|
||||||
if (SSL_CTX_use_certificate(ctx,cert) <= 0)
|
if (SSL_CTX_use_certificate(ctx,cert) <= 0)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"error setting certificate\n");
|
BIO_printf(bio_err,"error setting certificate\n");
|
||||||
|
@ -482,6 +482,11 @@ bad:
|
|||||||
if (key_file == NULL)
|
if (key_file == NULL)
|
||||||
key_file = cert_file;
|
key_file = cert_file;
|
||||||
|
|
||||||
|
|
||||||
|
if (key_file)
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
key = load_key(bio_err, key_file, key_format, 0, pass, e,
|
key = load_key(bio_err, key_file, key_format, 0, pass, e,
|
||||||
"client certificate private key file");
|
"client certificate private key file");
|
||||||
if (!key)
|
if (!key)
|
||||||
@ -490,6 +495,11 @@ bad:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cert_file)
|
||||||
|
|
||||||
|
{
|
||||||
cert = load_cert(bio_err,cert_file,cert_format,
|
cert = load_cert(bio_err,cert_file,cert_format,
|
||||||
NULL, e, "client certificate file");
|
NULL, e, "client certificate file");
|
||||||
|
|
||||||
@ -498,6 +508,7 @@ bad:
|
|||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
|
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
|
||||||
&& !RAND_status())
|
&& !RAND_status())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user