diff options
Diffstat (limited to 'java/android/OlmLibSdk/olm-sdk/src/main/jni')
-rw-r--r-- | java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.cpp | 12 | ||||
-rw-r--r-- | java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.h | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.cpp b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.cpp index 2dad00a..3ee3db7 100644 --- a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.cpp +++ b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.cpp @@ -262,30 +262,30 @@ JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(sessionKeyJni)(JNIEnv *env } -JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(encryptMessageJni)(JNIEnv *env, jobject thiz, jstring aClearMsg) +JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(encryptMessageJni)(JNIEnv *env, jobject thiz, jbyteArray aClearMsgBuffer) { LOGD("## encryptMessageJni(): IN"); jstring encryptedMsgRetValue = 0; OlmOutboundGroupSession *sessionPtr = NULL; - const char *clearMsgPtr = NULL; + jbyte* clearMsgPtr = NULL; if (!(sessionPtr = (OlmOutboundGroupSession*)getOutboundGroupSessionInstanceId(env,thiz))) { LOGE(" ## encryptMessageJni(): failure - invalid outbound group session ptr=NULL"); } - else if (!aClearMsg) + else if (!aClearMsgBuffer) { LOGE(" ## encryptMessageJni(): failure - invalid clear message"); } - else if (!(clearMsgPtr = env->GetStringUTFChars(aClearMsg, 0))) + else if (!(clearMsgPtr = env->GetByteArrayElements(aClearMsgBuffer, NULL))) { LOGE(" ## encryptMessageJni(): failure - clear message JNI allocation OOM"); } else { // get clear message length - size_t clearMsgLength = (size_t)env->GetStringUTFLength(aClearMsg); + size_t clearMsgLength = (size_t)env->GetArrayLength(aClearMsgBuffer); LOGD(" ## encryptMessageJni(): clearMsgLength=%lu",static_cast<long unsigned int>(clearMsgLength)); // compute max encrypted length @@ -325,7 +325,7 @@ JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(encryptMessageJni)(JNIEnv // free alloc if (clearMsgPtr) { - env->ReleaseStringUTFChars(aClearMsg, clearMsgPtr); + env->ReleaseByteArrayElements(aClearMsgBuffer, clearMsgPtr, JNI_ABORT); } return encryptedMsgRetValue; diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.h b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.h index 2fc44f8..f7e8a21 100644 --- a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.h +++ b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.h @@ -37,7 +37,7 @@ JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(sessionIdentifierJni)(JNIE JNIEXPORT jint OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(messageIndexJni)(JNIEnv *env, jobject thiz); JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(sessionKeyJni)(JNIEnv *env, jobject thiz); -JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(encryptMessageJni)(JNIEnv *env, jobject thiz, jstring aClearMsgPtr); +JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(encryptMessageJni)(JNIEnv *env, jobject thiz, jbyteArray aClearMsgBuffer); // serialization JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(serializeDataWithKeyJni)(JNIEnv *env, jobject thiz, jstring aKey, jobject aErrorMsg); |