Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert JNI_JARJAR_PREFIX change #43

Merged
merged 1 commit into from
Jan 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions common/src/jni/main/cpp/JniConstants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ void JniConstants::init(JavaVM *vm, JNIEnv *env) {
stringClass = JniUtil::findClass(env, "java/lang/String");

cryptoUpcallsClass = JniUtil::getGlobalRefToClass(
env, CONSCRYPT_SYMBOL_PREFIX "org/conscrypt/CryptoUpcalls");
nativeRefClass =
JniUtil::getGlobalRefToClass(env, CONSCRYPT_SYMBOL_PREFIX "org/conscrypt/NativeRef");
env, TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/CryptoUpcalls");
nativeRefClass = JniUtil::getGlobalRefToClass(
env, TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef");
openSslInputStreamClass = JniUtil::getGlobalRefToClass(
env, CONSCRYPT_SYMBOL_PREFIX "org/conscrypt/OpenSSLBIOInputStream");
env, TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/OpenSSLBIOInputStream");

nativeRef_context = JniUtil::getFieldRef(env, nativeRefClass, "context", "J");

Expand Down
24 changes: 13 additions & 11 deletions common/src/jni/main/cpp/org_conscrypt_NativeCrypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9132,15 +9132,16 @@ static int NativeCrypto_ENGINE_SSL_write_heap(JNIEnv* env, jclass, jlong sslRef,

#define FILE_DESCRIPTOR "Ljava/io/FileDescriptor;"
#define SSL_CALLBACKS \
"L" CONSCRYPT_SYMBOL_PREFIX "org/conscrypt/NativeCrypto$SSLHandshakeCallbacks;"
#define REF_EC_GROUP "L" CONSCRYPT_SYMBOL_PREFIX "org/conscrypt/NativeRef$EC_GROUP;"
#define REF_EC_POINT "L" CONSCRYPT_SYMBOL_PREFIX "org/conscrypt/NativeRef$EC_POINT;"
#define REF_EVP_CIPHER_CTX "L" CONSCRYPT_SYMBOL_PREFIX "org/conscrypt/NativeRef$EVP_CIPHER_CTX;"
#define REF_EVP_MD_CTX "L" CONSCRYPT_SYMBOL_PREFIX "org/conscrypt/NativeRef$EVP_MD_CTX;"
#define REF_EVP_PKEY "L" CONSCRYPT_SYMBOL_PREFIX "org/conscrypt/NativeRef$EVP_PKEY;"
#define REF_EVP_PKEY_CTX "L" CONSCRYPT_SYMBOL_PREFIX "org/conscrypt/NativeRef$EVP_PKEY_CTX;"
#define REF_HMAC_CTX "L" CONSCRYPT_SYMBOL_PREFIX "org/conscrypt/NativeRef$HMAC_CTX;"
#define REF_BIO_IN_STREAM "L" CONSCRYPT_SYMBOL_PREFIX "org/conscrypt/OpenSSLBIOInputStream;"
"L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeCrypto$SSLHandshakeCallbacks;"
#define REF_EC_GROUP "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EC_GROUP;"
#define REF_EC_POINT "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EC_POINT;"
#define REF_EVP_CIPHER_CTX \
"L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_CIPHER_CTX;"
#define REF_EVP_MD_CTX "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;"
#define REF_EVP_PKEY "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_PKEY;"
#define REF_EVP_PKEY_CTX "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_PKEY_CTX;"
#define REF_HMAC_CTX "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$HMAC_CTX;"
#define REF_BIO_IN_STREAM "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/OpenSSLBIOInputStream;"
static JNINativeMethod sNativeCryptoMethods[] = {
CONSCRYPT_NATIVE_METHOD(NativeCrypto, clinit, "()V"),
CONSCRYPT_NATIVE_METHOD(NativeCrypto, EVP_PKEY_new_RSA, "([B[B[B[B[B[B[B[B)J"),
Expand Down Expand Up @@ -9422,8 +9423,9 @@ CONSCRYPT_PUBLIC jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {

JniConstants::init(vm, env);

JniUtil::jniRegisterNativeMethods(env, CONSCRYPT_SYMBOL_PREFIX "org/conscrypt/NativeCrypto",
sNativeCryptoMethods, NELEM(sNativeCryptoMethods));
JniUtil::jniRegisterNativeMethods(env,
TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeCrypto",
sNativeCryptoMethods, NELEM(sNativeCryptoMethods));

CompatibilityCloseMonitor::init();
return JNI_VERSION_1_6;
Expand Down
3 changes: 1 addition & 2 deletions common/src/jni/main/include/Errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ class Errors {
* Throws a ParsingException with the given string as a message.
*/
static int throwParsingException(JNIEnv* env, const char* message) {
return jniThrowException(env, CONSCRYPT_SYMBOL_PREFIX
"org/conscrypt/OpenSSLX509CertificateFactory$ParsingException",
return jniThrowException(env, TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/OpenSSLX509CertificateFactory$ParsingException",
message);
}

Expand Down
9 changes: 4 additions & 5 deletions common/src/jni/main/include/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@
#ifndef CONSCRYPT_SRC_MAIN_NATIVE_MACROS_H_
#define CONSCRYPT_SRC_MAIN_NATIVE_MACROS_H_

#ifdef JNI_JARJAR_PREFIX
#define TO_STRING(x) #x
#define CONSCRYPT_SYMBOL_PREFIX TO_STRING(JNI_JARJAR_PREFIX)
#else
#define CONSCRYPT_SYMBOL_PREFIX ""
#define TO_STRING1(x) #x
#define TO_STRING(x) TO_STRING1(x)
#ifndef JNI_JARJAR_PREFIX
#ifndef CONSCRYPT_NOT_UNBUNDLED
#define CONSCRYPT_UNBUNDLED
#endif
#define JNI_JARJAR_PREFIX
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, this causes a warning on windows IIRC

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows currently has a sea of warnings. I can change this to "" though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, "" doesn't work either ... I forget why exactly. I had tried a few things here ... it's a bit tricky.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'll leave it at a warning :)

#endif

// The FALLTHROUGH_INTENDED macro can be used to annotate implicit fall-through
Expand Down