forked from wolfSSL/wolfssl
only set up tmp ctx if using password
This commit is contained in:
12
src/ssl.c
12
src/ssl.c
@ -1091,11 +1091,13 @@ int CyaSSL_KeyPemToDer(const unsigned char* pem, int pemSz, unsigned char* buff,
|
|||||||
der.buffer = NULL;
|
der.buffer = NULL;
|
||||||
|
|
||||||
#ifdef OPENSSL_EXTRA
|
#ifdef OPENSSL_EXTRA
|
||||||
info.ctx = CyaSSL_CTX_new(CyaSSLv23_client_method());
|
if (pass) {
|
||||||
if (info.ctx == NULL)
|
info.ctx = CyaSSL_CTX_new(CyaSSLv23_client_method());
|
||||||
return MEMORY_E;
|
if (info.ctx == NULL)
|
||||||
CyaSSL_CTX_set_default_passwd_cb(info.ctx, OurPasswordCb);
|
return MEMORY_E;
|
||||||
CyaSSL_CTX_set_default_passwd_cb_userdata(info.ctx, (void*)pass);
|
CyaSSL_CTX_set_default_passwd_cb(info.ctx, OurPasswordCb);
|
||||||
|
CyaSSL_CTX_set_default_passwd_cb_userdata(info.ctx, (void*)pass);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ret = PemToDer(pem, pemSz, PRIVATEKEY_TYPE, &der, NULL, &info, &eccKey);
|
ret = PemToDer(pem, pemSz, PRIVATEKEY_TYPE, &der, NULL, &info, &eccKey);
|
||||||
|
Reference in New Issue
Block a user