components/openssl: SSL load verify data from itself structure when "new"

This commit is contained in:
dongheng
2016-09-22 16:41:51 +08:00
parent fa6f03f77f
commit f796b4e58e
5 changed files with 28 additions and 6 deletions

View File

@@ -177,6 +177,8 @@ int SSL_CTX_use_PrivateKey_ASN1(int type, SSL_CTX *ctx,
if (!ret)
SSL_RET(failed2, "SSL_CTX_use_PrivateKey\n");
ctx->cert->pkey->ref++;
return 1;
failed2:
@@ -203,7 +205,10 @@ int SSL_use_PrivateKey_ASN1(int type, SSL *ssl,
int ret;
EVP_PKEY *pkey;
pkey = d2i_PrivateKey(0, &ssl->cert->pkey, &d, len);
if (ssl->cert->pkey->ref)
SSL_RET(failed1);
pkey = d2i_PrivateKey(0, NULL, &d, len);
if (!pkey)
SSL_RET(failed1, "d2i_PrivateKey\n");
@@ -211,6 +216,8 @@ int SSL_use_PrivateKey_ASN1(int type, SSL *ssl,
if (!ret)
SSL_RET(failed2, "SSL_CTX_use_PrivateKey\n");
ssl->cert->pkey->ref++;
return 1;
failed2: