aboutsummaryrefslogtreecommitdiff
path: root/javascript/olm_outbound_group_session.js
diff options
context:
space:
mode:
authorHubert Chathi <hubert@uhoreg.ca>2018-10-12 17:02:51 -0400
committerHubert Chathi <hubert@uhoreg.ca>2018-10-12 17:02:51 -0400
commit5cf074d3372f1e189fe410a075013adefabb1aa5 (patch)
treea72a96fafab69e62b5083cbe1933b4e34e9a72d5 /javascript/olm_outbound_group_session.js
parentac071d9c0d69e4330a06f171e3bddc713ecd97d6 (diff)
parentaf86a9a8b899eeb3c1c464cb0c54218acd788fa6 (diff)
Merge branch 'master' into poljar
Diffstat (limited to 'javascript/olm_outbound_group_session.js')
-rw-r--r--javascript/olm_outbound_group_session.js15
1 files changed, 4 insertions, 11 deletions
diff --git a/javascript/olm_outbound_group_session.js b/javascript/olm_outbound_group_session.js
index 24ea644..e232883 100644
--- a/javascript/olm_outbound_group_session.js
+++ b/javascript/olm_outbound_group_session.js
@@ -1,10 +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 OutboundGroupSession() {
var size = Module['_olm_outbound_group_session_size']();
this.buf = malloc(size);
@@ -66,7 +59,7 @@ OutboundGroupSession.prototype['create'] = restore_stack(function() {
OutboundGroupSession.prototype['encrypt'] = function(plaintext) {
var plaintext_buffer, message_buffer, plaintext_length;
try {
- plaintext_length = Module['lengthBytesUTF8'](plaintext);
+ plaintext_length = lengthBytesUTF8(plaintext);
var message_length = outbound_group_session_method(
Module['_olm_group_encrypt_message_length']
@@ -75,7 +68,7 @@ OutboundGroupSession.prototype['encrypt'] = function(plaintext) {
// need to allow space for the terminator (which stringToUTF8 always
// writes), hence + 1.
plaintext_buffer = malloc(plaintext_length + 1);
- Module['stringToUTF8'](plaintext, plaintext_buffer, plaintext_length + 1);
+ stringToUTF8(plaintext, plaintext_buffer, plaintext_length + 1);
message_buffer = malloc(message_length + NULL_BYTE_PADDING_LENGTH);
outbound_group_session_method(Module['_olm_group_encrypt'])(
@@ -86,12 +79,12 @@ OutboundGroupSession.prototype['encrypt'] = function(plaintext) {
// UTF8ToString requires a null-terminated argument, so add the
// null terminator.
- Module['setValue'](
+ setValue(
message_buffer+message_length,
0, "i8"
);
- return Module['UTF8ToString'](message_buffer);
+ return UTF8ToString(message_buffer);
} finally {
if (plaintext_buffer !== undefined) {
// don't leave a copy of the plaintext in the heap.