Fix error handling for group sessions

Fix a couple of places where we were using the wrong method to get the last
error.
This commit is contained in:
Richard van der Hoff 2016-09-05 19:42:04 +01:00
parent 617f9b1696
commit c2b51207ee
2 changed files with 3 additions and 3 deletions

View file

@ -66,14 +66,14 @@ InboundGroupSession.prototype['decrypt'] = restore_stack(function(
) { ) {
var message_array = array_from_string(message); var message_array = array_from_string(message);
var message_buffer = stack(message_array); var message_buffer = stack(message_array);
var max_plaintext_length = session_method( var max_plaintext_length = inbound_group_session_method(
Module['_olm_group_decrypt_max_plaintext_length'] Module['_olm_group_decrypt_max_plaintext_length']
)(this.ptr, message_buffer, message_array.length); )(this.ptr, message_buffer, message_array.length);
// caculating the length destroys the input buffer. // caculating the length destroys the input buffer.
// So we copy the array to a new buffer // So we copy the array to a new buffer
var message_buffer = stack(message_array); var message_buffer = stack(message_array);
var plaintext_buffer = stack(max_plaintext_length + NULL_BYTE_PADDING_LENGTH); var plaintext_buffer = stack(max_plaintext_length + NULL_BYTE_PADDING_LENGTH);
var plaintext_length = session_method(Module["_olm_group_decrypt"])( var plaintext_length = inbound_group_session_method(Module["_olm_group_decrypt"])(
this.ptr, this.ptr,
message_buffer, message_array.length, message_buffer, message_array.length,
plaintext_buffer, max_plaintext_length plaintext_buffer, max_plaintext_length

View file

@ -54,7 +54,7 @@ OutboundGroupSession.prototype['unpickle'] = restore_stack(function(key, pickle)
}); });
OutboundGroupSession.prototype['create'] = restore_stack(function(key) { OutboundGroupSession.prototype['create'] = restore_stack(function(key) {
var random_length = session_method( var random_length = outbound_group_session_method(
Module['_olm_init_outbound_group_session_random_length'] Module['_olm_init_outbound_group_session_random_length']
)(this.ptr); )(this.ptr);
var random = random_stack(random_length); var random = random_stack(random_length);