diff options
| -rw-r--r-- | luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp b/luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp index 7dabc5d7c9..ba2a040f03 100644 --- a/luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp +++ b/luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp @@ -2698,6 +2698,10 @@ static void NativeCrypto_SSL_use_OpenSSL_PrivateKey(JNIEnv* env, jclass, jint ss JNI_TRACE("ssl=%p SSL_use_OpenSSL_PrivateKey => error", ssl); return; } + // SSL_use_PrivateKey expects to take ownership of the EVP_PKEY, + // but we have an external reference from the caller such as an + // OpenSSLKey, so we manually increment the reference count here. + CRYPTO_add(&pkey->references,+1,CRYPTO_LOCK_EVP_PKEY); JNI_TRACE("ssl=%p SSL_use_OpenSSL_PrivateKey => ok", ssl); } |
