aboutsummaryrefslogtreecommitdiff
path: root/java/android/OlmLibSdk/olm-sdk/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'java/android/OlmLibSdk/olm-sdk/src/main')
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_session.cpp27
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_utility.cpp2
2 files changed, 16 insertions, 13 deletions
diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_session.cpp b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_session.cpp
index 0febc02..23cbaee 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_session.cpp
+++ b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_session.cpp
@@ -446,6 +446,8 @@ JNIEXPORT jint OLM_SESSION_FUNC_DEF(encryptMessageJni)(JNIEnv *env, jobject thiz
jfieldID encryptedMsgFieldId;
jfieldID typeMsgFieldId;
+ LOGD("## encryptMessageJni(): IN ");
+
if(NULL == (sessionPtr = (OlmSession*)getSessionInstanceId(env,thiz)))
{
LOGE("## encryptMessageJni(): failure - invalid Session ptr=NULL");
@@ -572,34 +574,35 @@ JNIEXPORT jstring OLM_SESSION_FUNC_DEF(decryptMessage)(JNIEnv *env, jobject thiz
void *plainTextMsgPtr = NULL;
char *tempEncryptedPtr = NULL;
+ LOGD("## decryptMessage(): IN ");
if(NULL == (sessionPtr = (OlmSession*)getSessionInstanceId(env,thiz)))
{
- LOGE("## decryptMessage(): failure - invalid Session ptr=NULL");
+ LOGE("## decryptMessage(): failure - invalid Session ptr=NULL");
}
else if(0 == aEncryptedMsg)
{
- LOGE("## decryptMessage(): failure - invalid clear message");
+ LOGE("## decryptMessage(): failure - invalid clear message");
}
else if(0 == (encryptedMsgJclass = env->GetObjectClass(aEncryptedMsg)))
{
- LOGE("## decryptMessage(): failure - unable to get crypted message class");
+ LOGE("## decryptMessage(): failure - unable to get crypted message class");
}
else if(0 == (encryptedMsgFieldId = env->GetFieldID(encryptedMsgJclass,"mCipherText","Ljava/lang/String;")))
{
- LOGE("## decryptMessage(): failure - unable to get message field");
+ LOGE("## decryptMessage(): failure - unable to get message field");
}
else if(0 == (typeMsgFieldId = env->GetFieldID(encryptedMsgJclass,"mType","J")))
{
- LOGE("## decryptMessage(): failure - unable to get message type field");
+ LOGE("## decryptMessage(): failure - unable to get message type field");
}
else if(0 == (encryptedMsgJstring = (jstring)env->GetObjectField(aEncryptedMsg, encryptedMsgFieldId)))
{
- LOGE("## decryptMessage(): failure - JNI encrypted object ");
+ LOGE("## decryptMessage(): failure - JNI encrypted object ");
}
else if(0 == (encryptedMsgPtr = env->GetStringUTFChars(encryptedMsgJstring, 0)))
{
- LOGE("## decryptMessage(): failure - encrypted message JNI allocation OOM");
+ LOGE("## decryptMessage(): failure - encrypted message JNI allocation OOM");
}
else
{
@@ -611,7 +614,7 @@ JNIEXPORT jstring OLM_SESSION_FUNC_DEF(decryptMessage)(JNIEnv *env, jobject thiz
// create a dedicated temp buffer to be used in next Olm API calls
tempEncryptedPtr = static_cast<char*>(malloc(encryptedMsgLength*sizeof(uint8_t)));
memcpy(tempEncryptedPtr, encryptedMsgPtr, encryptedMsgLength);
- LOGD("## decryptMessageJni(): encryptedMsgType=%lld encryptedMsgLength=%lu encryptedMsg=%s",encryptedMsgType,encryptedMsgLength,encryptedMsgPtr);
+ LOGD("## decryptMessageJni(): encryptedMsgType=%lld encryptedMsgLength=%lu encryptedMsg=%s",encryptedMsgType,encryptedMsgLength,encryptedMsgPtr);
// get max plaintext length
size_t maxPlainTextLength = olm_decrypt_max_plaintext_length(sessionPtr,
@@ -623,11 +626,11 @@ JNIEXPORT jstring OLM_SESSION_FUNC_DEF(decryptMessage)(JNIEnv *env, jobject thiz
if(maxPlainTextLength == olm_error())
{
const char *errorMsgPtr = olm_session_last_error(sessionPtr);
- LOGE("## decryptMessageJni(): failure - olm_decrypt_max_plaintext_length Msg=%s",errorMsgPtr);
+ LOGE("## decryptMessage(): failure - olm_decrypt_max_plaintext_length Msg=%s",errorMsgPtr);
}
else
{
- LOGD("## decryptMessage(): maxPlaintextLength=%lu",maxPlainTextLength);
+ LOGD("## decryptMessage(): maxPlaintextLength=%lu",maxPlainTextLength);
// allocate output decrypted message
plainTextMsgPtr = static_cast<void*>(malloc(maxPlainTextLength*sizeof(uint8_t)));
@@ -643,12 +646,12 @@ JNIEXPORT jstring OLM_SESSION_FUNC_DEF(decryptMessage)(JNIEnv *env, jobject thiz
if(plaintextLength == olm_error())
{
const char *errorMsgPtr = olm_session_last_error(sessionPtr);
- LOGE("## decryptMessage(): failure - olm_decrypt Msg=%s",errorMsgPtr);
+ LOGE("## decryptMessage(): failure - olm_decrypt Msg=%s",errorMsgPtr);
}
else
{
(static_cast<char*>(plainTextMsgPtr))[plaintextLength] = static_cast<char>('\0');
- LOGD("## decryptMessage(): decrypted returnedLg=%lu plainTextMsgPtr=%s",plaintextLength, static_cast<char*>(plainTextMsgPtr));
+ LOGD("## decryptMessage(): decrypted returnedLg=%lu plainTextMsgPtr=%s",plaintextLength, static_cast<char*>(plainTextMsgPtr));
decryptedMsgRetValue = env->NewStringUTF(static_cast<const char*>(plainTextMsgPtr));
}
}
diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_utility.cpp b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_utility.cpp
index 99df7f5..c27fe7c 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_utility.cpp
+++ b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_utility.cpp
@@ -136,6 +136,6 @@ jlong getSessionInstanceId(JNIEnv* aJniEnv, jobject aJavaObject)
LOGD("## getSessionInstanceId() ERROR! aJniEnv=NULL");
}
- LOGD("## getSessionInstanceId() success - instanceId=%lld",instanceId);
+ //LOGD("## getSessionInstanceId() success - instanceId=%lld",instanceId);
return instanceId;
}