diff --git a/native/compile-native.sh b/native/compile-native.sh index 99ba41d2..ecfd206a 100755 --- a/native/compile-native.sh +++ b/native/compile-native.sh @@ -1,3 +1,3 @@ #!/bin/sh -gcc -shared -fPIC -O3 -Werror -I/usr/lib/jvm/default-java/include/ src/main/c/NativeCipherImpl.c -o src/main/resources/native-cipher.so -lcrypto +gcc -shared -fPIC -O3 -Werror -I$JAVA_HOME/include/ src/main/c/NativeCipherImpl.c -o src/main/resources/native-cipher.so -lcrypto diff --git a/native/src/main/c/NativeCipherImpl.c b/native/src/main/c/NativeCipherImpl.c index 41884025..6e35aa68 100644 --- a/native/src/main/c/NativeCipherImpl.c +++ b/native/src/main/c/NativeCipherImpl.c @@ -11,7 +11,7 @@ jlong Java_net_md_15_bungee_NativeCipherImpl_init AES_KEY *aes_key = malloc(sizeof(AES_KEY)); jboolean isKeyCopy; - BYTE *key_bytes = (*env)->GetByteArrayElements(env, key, &isKeyCopy); + BYTE *key_bytes = (BYTE*)(*env)->GetByteArrayElements(env, key, &isKeyCopy); int key_length = (*env)->GetArrayLength(env, key) * 8; // in bits AES_set_encrypt_key(key_bytes, key_length, aes_key); @@ -37,7 +37,7 @@ void Java_net_md_15_bungee_NativeCipherImpl_cipher BYTE *output = (BYTE*) out; jboolean isCopy; - BYTE *iv_bytes = (*env)->GetByteArrayElements(env, iv, &isCopy); + BYTE *iv_bytes = (BYTE*)(*env)->GetByteArrayElements(env, iv, &isCopy); AES_cfb8_encrypt( input, // input buffer diff --git a/native/src/main/resources/native-cipher.so b/native/src/main/resources/native-cipher.so index 262be07b..03d70f6d 100755 Binary files a/native/src/main/resources/native-cipher.so and b/native/src/main/resources/native-cipher.so differ