Increment pkey references count
This commit is contained in:
parent
48e59eaeb1
commit
99a7aff31e
@ -16132,7 +16132,7 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD *md)
|
||||
{
|
||||
WOLFSSL_ENTER("EVP_MD_CTX_cleanup");
|
||||
if (ctx->pctx != NULL)
|
||||
XFREE(ctx->pctx, NULL, DYNAMIC_TYPE_PUBLIC_KEY);
|
||||
wolfSSL_EVP_PKEY_CTX_free(ctx->pctx);
|
||||
|
||||
if (ctx->macType == (NID_hmac & 0xFF)) {
|
||||
wc_HmacFree(&ctx->hash.hmac);
|
||||
|
@ -918,6 +918,7 @@ int wolfSSL_EVP_PKEY_CTX_free(WOLFSSL_EVP_PKEY_CTX *ctx)
|
||||
WOLFSSL_EVP_PKEY_CTX *wolfSSL_EVP_PKEY_CTX_new(WOLFSSL_EVP_PKEY *pkey, WOLFSSL_ENGINE *e)
|
||||
{
|
||||
WOLFSSL_EVP_PKEY_CTX* ctx;
|
||||
int type = NID_undef;
|
||||
|
||||
if (pkey == NULL) return 0;
|
||||
if (e != NULL) return 0;
|
||||
@ -931,7 +932,18 @@ WOLFSSL_EVP_PKEY_CTX *wolfSSL_EVP_PKEY_CTX_new(WOLFSSL_EVP_PKEY *pkey, WOLFSSL_E
|
||||
#if !defined(NO_RSA) && !defined(HAVE_USER_RSA)
|
||||
ctx->padding = RSA_PKCS1_PADDING;
|
||||
#endif
|
||||
type = wolfSSL_EVP_PKEY_type(pkey->type);
|
||||
|
||||
if ((type == EVP_PKEY_RSA) ||
|
||||
(type == EVP_PKEY_DSA) ||
|
||||
(type == EVP_PKEY_EC)) {
|
||||
if (wc_LockMutex(&pkey->refMutex) != 0) {
|
||||
WOLFSSL_MSG("Couldn't lock pkey mutex");
|
||||
}
|
||||
pkey->references++;
|
||||
|
||||
wc_UnLockMutex(&pkey->refMutex);
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user