From e690d88fa08da6400696236db20cabd15d1dc0be Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Mon, 24 Dec 2018 12:18:36 -0500 Subject: [PATCH] Generic MBEDTLS_ROOT --- native/compile-linux.sh | 2 +- native/compile-osx.sh | 2 +- .../velocitypowered/natives/encryption/MbedtlsAesImpl.java | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/native/compile-linux.sh b/native/compile-linux.sh index 6634dfc94..b55fcf554 100755 --- a/native/compile-linux.sh +++ b/native/compile-linux.sh @@ -1,7 +1,7 @@ #!/bin/bash # Modify as you need. -MBEDTLS_ROOT=mbedtls-2.12.0 +MBEDTLS_ROOT=mbedtls CFLAGS="-O3 -I$JAVA_HOME/include/ -I$JAVA_HOME/include/linux/ -fPIC -shared" gcc $CFLAGS -lz src/main/c/jni_util.c src/main/c/jni_zlib_deflate.c src/main/c/jni_zlib_inflate.c \ -o src/main/resources/linux_x64/velocity-compress.so diff --git a/native/compile-osx.sh b/native/compile-osx.sh index 4ab9b4d11..b1404339e 100755 --- a/native/compile-osx.sh +++ b/native/compile-osx.sh @@ -1,7 +1,7 @@ #!/bin/bash # Modify as you need. -MBEDTLS_ROOT=mbedtls-2.12.0 +MBEDTLS_ROOT=mbedtls export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home CFLAGS="-O3 -I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin/ -fPIC -shared" diff --git a/native/src/main/java/com/velocitypowered/natives/encryption/MbedtlsAesImpl.java b/native/src/main/java/com/velocitypowered/natives/encryption/MbedtlsAesImpl.java index 9e5aa403d..ef57cdaa8 100644 --- a/native/src/main/java/com/velocitypowered/natives/encryption/MbedtlsAesImpl.java +++ b/native/src/main/java/com/velocitypowered/natives/encryption/MbedtlsAesImpl.java @@ -1,8 +1,10 @@ package com.velocitypowered.natives.encryption; -public class MbedtlsAesImpl { +import java.security.GeneralSecurityException; - native long init(byte[] key); +class MbedtlsAesImpl { + + native long init(byte[] key) throws GeneralSecurityException; native void process(long ctx, long sourceAddress, int sourceLength, long destinationAddress, boolean encrypt);