Rebuild libtextsecure also

This commit is contained in:
lilia 2015-02-11 12:49:17 -08:00
parent c230b47ef2
commit c0a8c00884

View file

@ -918,6 +918,7 @@ function copyTempDouble(ptr) {
Module["_malloc"] = _malloc; Module["_malloc"] = _malloc;
function _free() { function _free() {
} }
Module["_free"] = _free;
Module["_strlen"] = _strlen; Module["_strlen"] = _strlen;
var Browser={mainLoop:{scheduler:null,shouldPause:false,paused:false,queue:[],pause:function () { var Browser={mainLoop:{scheduler:null,shouldPause:false,paused:false,queue:[],pause:function () {
Browser.mainLoop.shouldPause = true; Browser.mainLoop.shouldPause = true;
@ -2942,6 +2943,10 @@ run();
var res = new Uint8Array(32); var res = new Uint8Array(32);
_readBytes(publicKey_ptr, 32, res); _readBytes(publicKey_ptr, 32, res);
Module._free(publicKey_ptr);
Module._free(privateKey_ptr);
Module._free(basepoint_ptr);
return Promise.resolve({ pubKey: res.buffer, privKey: privKey }); return Promise.resolve({ pubKey: res.buffer, privKey: privKey });
}, },
sharedSecret: function(pubKey, privKey) { sharedSecret: function(pubKey, privKey) {
@ -2962,11 +2967,16 @@ run();
var res = new Uint8Array(32); var res = new Uint8Array(32);
_readBytes(sharedKey_ptr, 32, res); _readBytes(sharedKey_ptr, 32, res);
Module._free(sharedKey_ptr);
Module._free(privateKey_ptr);
Module._free(basepoint_ptr);
return Promise.resolve(res.buffer); return Promise.resolve(res.buffer);
}, },
sign: function(privKey, message) { sign: function(privKey, message) {
// Where to store the result // Where to store the result
var signature_ptr = Module._malloc(32); var signature_ptr = Module._malloc(64);
// Get a pointer to our private key // Get a pointer to our private key
var privateKey_ptr = _allocate(new Uint8Array(privKey)); var privateKey_ptr = _allocate(new Uint8Array(privKey));
@ -2981,6 +2991,11 @@ run();
var res = new Uint8Array(64); var res = new Uint8Array(64);
_readBytes(signature_ptr, 64, res); _readBytes(signature_ptr, 64, res);
Module._free(signature_ptr);
Module._free(privateKey_ptr);
Module._free(message_ptr);
return Promise.resolve(res.buffer); return Promise.resolve(res.buffer);
}, },
verify: function(pubKey, message, sig) { verify: function(pubKey, message, sig) {
@ -2998,6 +3013,10 @@ run();
message_ptr, message_ptr,
message.byteLength); message.byteLength);
Module._free(publicKey_ptr);
Module._free(signature_ptr);
Module._free(message_ptr);
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
if (res !== 0) { if (res !== 0) {
reject(new Error("Invalid signature")); reject(new Error("Invalid signature"));
@ -6201,7 +6220,6 @@ window.textsecure.registerSecondDevice = function(encodedDeviceInit, cryptoInfo,
stepDone(3); stepDone(3);
return textsecure.api.registerKeys(keys).then(function() { return textsecure.api.registerKeys(keys).then(function() {
stepDone(4); stepDone(4);
//TODO: Send DeviceControl.NEW_DEVICE_REGISTERED to all other devices
}); });
}); });
}); });