From 3f7850dc5aefe49859b5bed31899d31636cf1fe8 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 12 Feb 2014 17:43:49 +1100 Subject: [PATCH] Clean up JNI code, add stack trace to check up on Jenkins test. --- native/src/main/c/NativeCipherImpl.c | 17 +++++------------ .../main/java/net/md_5/bungee/NativeCipher.java | 1 + 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/native/src/main/c/NativeCipherImpl.c b/native/src/main/c/NativeCipherImpl.c index e5b7a7b6..f27eda13 100644 --- a/native/src/main/c/NativeCipherImpl.c +++ b/native/src/main/c/NativeCipherImpl.c @@ -49,19 +49,12 @@ void Java_net_md_15_bungee_NativeCipherImpl_free void Java_net_md_15_bungee_NativeCipherImpl_cipher (JNIEnv* env, jobject obj, jboolean forEncryption, jlong key, jlong iv, jlong in, jlong out, jint length) { - AES_KEY *aes_key = (AES_KEY*)key; - size_t buffer_length = (size_t) length; - - BYTE *input = (BYTE*) in; - BYTE *output = (BYTE*) out; - BYTE* jni_iv = (BYTE*) iv; - AES_cfb8_encrypt( - input, // input buffer - output, // output buffer - buffer_length, // readable bytes - aes_key, // encryption key - jni_iv, // IV + (BYTE*) in, // input buffer + (BYTE*) out, // output buffer + (size_t) length, // readable bytes + (AES_KEY*) key, // encryption key + (BYTE*) iv, // IV NULL, // not needed forEncryption ? AES_ENCRYPT : AES_DECRYPT // encryption mode ); diff --git a/native/src/main/java/net/md_5/bungee/NativeCipher.java b/native/src/main/java/net/md_5/bungee/NativeCipher.java index a521c447..320da45d 100644 --- a/native/src/main/java/net/md_5/bungee/NativeCipher.java +++ b/native/src/main/java/net/md_5/bungee/NativeCipher.java @@ -44,6 +44,7 @@ public class NativeCipher implements BungeeCipher loaded = true; } catch ( Throwable t ) { + t.printStackTrace(); } }