Fix OpenSSL build for new AEAD changes
Change-Id: I06304121d29d6fdcc7dab7a2c8e9d208a394e0a8
diff --git a/src/main/native/org_conscrypt_NativeCrypto.cpp b/src/main/native/org_conscrypt_NativeCrypto.cpp
index 5ad3d09..daa57bf 100644
--- a/src/main/native/org_conscrypt_NativeCrypto.cpp
+++ b/src/main/native/org_conscrypt_NativeCrypto.cpp
@@ -4865,25 +4865,27 @@
EVP_CIPHER_CTX_free(ctx);
}
-static jlong NativeCrypto_EVP_aead_aes_128_gcm(JNIEnv*, jclass) {
+static jlong NativeCrypto_EVP_aead_aes_128_gcm(JNIEnv* env, jclass) {
#if defined(OPENSSL_IS_BORINGSSL)
+ UNUSED_ARGUMENT(env);
const EVP_AEAD* ctx = EVP_aead_aes_128_gcm();
JNI_TRACE("EVP_aead_aes_128_gcm => ctx=%p", ctx);
return reinterpret_cast<jlong>(ctx);
#else
- jniThrowRuntimeException("Not supported for OpenSSL");
+ jniThrowRuntimeException(env, "Not supported for OpenSSL");
return 0;
#endif
}
-static jlong NativeCrypto_EVP_aead_aes_256_gcm(JNIEnv*, jclass) {
+static jlong NativeCrypto_EVP_aead_aes_256_gcm(JNIEnv* env, jclass) {
#if defined(OPENSSL_IS_BORINGSSL)
+ UNUSED_ARGUMENT(env);
const EVP_AEAD* ctx = EVP_aead_aes_256_gcm();
JNI_TRACE("EVP_aead_aes_256_gcm => ctx=%p", ctx);
return reinterpret_cast<jlong>(ctx);
#else
- jniThrowRuntimeException("Not supported for OpenSSL");
- return NULL;
+ jniThrowRuntimeException(env, "Not supported for OpenSSL");
+ return 0;
#endif
}
@@ -4914,7 +4916,11 @@
JNI_TRACE("EVP_AEAD_CTX_init(%p, %p, %d) => %p", evpAead, keyArray, tagLen, aeadCtx.get());
return reinterpret_cast<jlong>(aeadCtx.release());
#else
- jniThrowRuntimeException("Not supported for OpenSSL");
+ UNUSED_ARGUMENT(env);
+ UNUSED_ARGUMENT(evpAeadRef);
+ UNUSED_ARGUMENT(keyArray);
+ UNUSED_ARGUMENT(tagLen);
+ jniThrowRuntimeException(env, "Not supported for OpenSSL");
return 0;
#endif
}
@@ -4931,7 +4937,9 @@
EVP_AEAD_CTX_cleanup(evpAeadCtx);
OPENSSL_free(evpAeadCtx);
#else
- jniThrowRuntimeException("Not supported for OpenSSL");
+ UNUSED_ARGUMENT(env);
+ UNUSED_ARGUMENT(evpAeadCtxRef);
+ jniThrowRuntimeException(env, "Not supported for OpenSSL");
#endif
}
@@ -4947,7 +4955,9 @@
JNI_TRACE("EVP_AEAD_max_overhead(%p) => %d", evpAead, maxOverhead);
return maxOverhead;
#else
- jniThrowRuntimeException("Not supported for OpenSSL");
+ UNUSED_ARGUMENT(env);
+ UNUSED_ARGUMENT(evpAeadRef);
+ jniThrowRuntimeException(env, "Not supported for OpenSSL");
return 0;
#endif
}
@@ -4964,7 +4974,9 @@
JNI_TRACE("EVP_AEAD_nonce_length(%p) => %d", evpAead, nonceLength);
return nonceLength;
#else
- jniThrowRuntimeException("Not supported for OpenSSL");
+ UNUSED_ARGUMENT(env);
+ UNUSED_ARGUMENT(evpAeadRef);
+ jniThrowRuntimeException(env, "Not supported for OpenSSL");
return 0;
#endif
}
@@ -4981,7 +4993,9 @@
JNI_TRACE("EVP_AEAD_max_tag_len(%p) => %d", evpAead, maxTagLen);
return maxTagLen;
#else
- jniThrowRuntimeException("Not supported for OpenSSL");
+ UNUSED_ARGUMENT(env);
+ UNUSED_ARGUMENT(evpAeadRef);
+ jniThrowRuntimeException(env, "Not supported for OpenSSL");
return 0;
#endif
}
@@ -5065,7 +5079,16 @@
return evp_aead_ctx_op(env, ctxRef, outArray, outOffset, nonceArray, inArray, inOffset,
inLength, aadArray, EVP_AEAD_CTX_seal);
#else
- jniThrowRuntimeException("Not supported for OpenSSL");
+ UNUSED_ARGUMENT(env);
+ UNUSED_ARGUMENT(ctxRef);
+ UNUSED_ARGUMENT(outArray);
+ UNUSED_ARGUMENT(outOffset);
+ UNUSED_ARGUMENT(nonceArray);
+ UNUSED_ARGUMENT(inArray);
+ UNUSED_ARGUMENT(inOffset);
+ UNUSED_ARGUMENT(inLength);
+ UNUSED_ARGUMENT(aadArray);
+ jniThrowRuntimeException(env, "Not supported for OpenSSL");
return 0;
#endif
}
@@ -5077,7 +5100,16 @@
return evp_aead_ctx_op(env, ctxRef, outArray, outOffset, nonceArray, inArray, inOffset,
inLength, aadArray, EVP_AEAD_CTX_open);
#else
- jniThrowRuntimeException("Not supported for OpenSSL");
+ UNUSED_ARGUMENT(env);
+ UNUSED_ARGUMENT(ctxRef);
+ UNUSED_ARGUMENT(outArray);
+ UNUSED_ARGUMENT(outOffset);
+ UNUSED_ARGUMENT(nonceArray);
+ UNUSED_ARGUMENT(inArray);
+ UNUSED_ARGUMENT(inOffset);
+ UNUSED_ARGUMENT(inLength);
+ UNUSED_ARGUMENT(aadArray);
+ jniThrowRuntimeException(env, "Not supported for OpenSSL");
return 0;
#endif
}