patch: handle pwd=NULL in tls
This commit is contained in:
parent
a608d8bd69
commit
1c268e4e51
1 changed files with 5 additions and 3 deletions
|
@ -115,9 +115,11 @@ int tls_alloc(struct tls **tlsp, const char *keyfile, const char *pwd)
|
|||
if (keyfile) {
|
||||
err = EINVAL;
|
||||
|
||||
tls->pass = pwd;
|
||||
SSL_CTX_set_default_passwd_cb(tls->ctx, password_cb);
|
||||
SSL_CTX_set_default_passwd_cb_userdata(tls->ctx, tls);
|
||||
if (pwd) {
|
||||
tls->pass = pwd;
|
||||
SSL_CTX_set_default_passwd_cb(tls->ctx, password_cb);
|
||||
SSL_CTX_set_default_passwd_cb_userdata(tls->ctx, tls);
|
||||
}
|
||||
|
||||
r = SSL_CTX_use_certificate_chain_file(tls->ctx, keyfile);
|
||||
if (r <= 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue