am b95f7161: Merge "NativeCrypto: various fixes"
* commit 'b95f71612d7dfc1dfcb825cb1d96ccdb95e14c0f':
NativeCrypto: various fixes
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLMac.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLMac.java
index 54d9f25..697af5a 100644
--- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLMac.java
+++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLMac.java
@@ -55,7 +55,7 @@
*/
private final byte[] singleByte = new byte[1];
- protected OpenSSLMac(long evp_md, int size, int evp_pkey_type) {
+ private OpenSSLMac(long evp_md, int size, int evp_pkey_type) {
this.evp_md = evp_md;
this.size = size;
this.evp_pkey_type = evp_pkey_type;
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLX509Certificate.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLX509Certificate.java
index 93af6ff..af960d5 100644
--- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLX509Certificate.java
+++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLX509Certificate.java
@@ -294,6 +294,10 @@
@Override
public boolean[] getKeyUsage() {
final boolean[] kusage = NativeCrypto.get_X509_ex_kusage(mContext);
+ if (kusage == null) {
+ return null;
+ }
+
if (kusage.length >= 9) {
return kusage;
}
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 8795428..ec36da0 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
@@ -2881,9 +2881,8 @@
}
}
-static void NativeCrypto_EVP_DigestSignInit(JNIEnv* env, jclass, jint evpMdCtxRef,
- const jlong evpMdRef, jlong pkeyRef)
-{
+static void NativeCrypto_EVP_DigestSignInit(JNIEnv* env, jclass, jlong evpMdCtxRef,
+ const jlong evpMdRef, jlong pkeyRef) {
EVP_MD_CTX* mdCtx = reinterpret_cast<EVP_MD_CTX*>(evpMdCtxRef);
const EVP_MD* md = reinterpret_cast<const EVP_MD*>(evpMdRef);
EVP_PKEY* pkey = reinterpret_cast<EVP_PKEY*>(pkeyRef);
@@ -4238,7 +4237,7 @@
return NULL;
}
- JNI_TRACE("X509Type_get_ext_oid(%p, %p) => fetching extension failed", x509Type, oidString);
+ JNI_TRACE("X509Type_get_ext_oid(%p, %p) => %p", x509Type, oidString, ext->value);
return ASN1ToByteArray<ASN1_OCTET_STRING, i2d_ASN1_OCTET_STRING>(env, ext->value);
}
@@ -4960,7 +4959,7 @@
Unique_ASN1_BIT_STRING bitStr(static_cast<ASN1_BIT_STRING*>(
X509_get_ext_d2i(x509, NID_key_usage, NULL, NULL)));
if (bitStr.get() == NULL) {
- JNI_TRACE("get_X509_ex_kusage(%p) => conversion to bitstring failed", x509);
+ JNI_TRACE("get_X509_ex_kusage(%p) => null", x509);
return NULL;
}