Allocate cipher with EVP_CIPHER_CTX_new. Thanks @Adam- for the tip.

This commit is contained in:
md_5 2014-07-02 12:57:17 +10:00
parent 7318750ed0
commit 02cb1fc65b
2 changed files with 1 additions and 1 deletions

View File

@ -6,7 +6,7 @@ typedef unsigned char byte;
jlong JNICALL Java_net_md_15_bungee_NativeCipherImpl_init(JNIEnv* env, jobject obj, jboolean forEncryption, jbyteArray key) {
jbyte *keyBytes = env->GetByteArrayElements(key, NULL);
EVP_CIPHER_CTX *cipherCtx = new EVP_CIPHER_CTX();
EVP_CIPHER_CTX *cipherCtx = EVP_CIPHER_CTX_new();
EVP_CipherInit(cipherCtx, EVP_aes_128_cfb8(), (byte*) keyBytes, (byte*) keyBytes, forEncryption);
env->ReleaseByteArrayElements(key, keyBytes, JNI_ABORT);