diff options
author | Hubert Chathi <hubert@uhoreg.ca> | 2018-10-12 17:02:51 -0400 |
---|---|---|
committer | Hubert Chathi <hubert@uhoreg.ca> | 2018-10-12 17:02:51 -0400 |
commit | 5cf074d3372f1e189fe410a075013adefabb1aa5 (patch) | |
tree | a72a96fafab69e62b5083cbe1933b4e34e9a72d5 /javascript/olm_inbound_group_session.js | |
parent | ac071d9c0d69e4330a06f171e3bddc713ecd97d6 (diff) | |
parent | af86a9a8b899eeb3c1c464cb0c54218acd788fa6 (diff) |
Merge branch 'master' into poljar
Diffstat (limited to 'javascript/olm_inbound_group_session.js')
-rw-r--r-- | javascript/olm_inbound_group_session.js | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/javascript/olm_inbound_group_session.js b/javascript/olm_inbound_group_session.js index 6bc745d..7d9e401 100644 --- a/javascript/olm_inbound_group_session.js +++ b/javascript/olm_inbound_group_session.js @@ -1,9 +1,3 @@ -/* The 'length' argument to Pointer_stringify doesn't work if the input includes - * characters >= 128; we therefore need to add a NULL character to all of our - * strings. This acts as a symbolic constant to help show what we're doing. - */ -var NULL_BYTE_PADDING_LENGTH = 1; - function InboundGroupSession() { var size = Module['_olm_inbound_group_session_size'](); this.buf = malloc(size); @@ -77,14 +71,14 @@ InboundGroupSession.prototype['decrypt'] = restore_stack(function( try { message_buffer = malloc(message.length); - Module['writeAsciiToMemory'](message, message_buffer, true); + writeAsciiToMemory(message, message_buffer, true); var max_plaintext_length = inbound_group_session_method( Module['_olm_group_decrypt_max_plaintext_length'] )(this.ptr, message_buffer, message.length); // caculating the length destroys the input buffer, so we need to re-copy it. - Module['writeAsciiToMemory'](message, message_buffer, true); + writeAsciiToMemory(message, message_buffer, true); plaintext_buffer = malloc(max_plaintext_length + NULL_BYTE_PADDING_LENGTH); var message_index = stack(4); @@ -100,14 +94,14 @@ InboundGroupSession.prototype['decrypt'] = restore_stack(function( // UTF8ToString requires a null-terminated argument, so add the // null terminator. - Module['setValue']( + setValue( plaintext_buffer+plaintext_length, 0, "i8" ); return { "plaintext": UTF8ToString(plaintext_buffer), - "message_index": Module['getValue'](message_index, "i32") + "message_index": getValue(message_index, "i32") } } finally { if (message_buffer !== undefined) { |