From ba323c65d6ab303cc2389353ea5bd82360244f18 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 10 Nov 2020 18:30:48 +0100 Subject: [PATCH 1/3] fix typo in name --- src/matrix/e2ee/OlmWorker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/matrix/e2ee/OlmWorker.js b/src/matrix/e2ee/OlmWorker.js index 649db309..31099e65 100644 --- a/src/matrix/e2ee/OlmWorker.js +++ b/src/matrix/e2ee/OlmWorker.js @@ -37,7 +37,7 @@ export class OlmWorker { account.unpickle("", pickle); } - async createOutboundSession(account, newSession, theirIdentityKey, theirOneTimeKey) { + async createOutboundOlmSession(account, newSession, theirIdentityKey, theirOneTimeKey) { const accountPickle = account.pickle(""); const sessionPickle = await this._workerPool.send({type: "olm_create_outbound", accountPickle, theirIdentityKey, theirOneTimeKey}).response(); newSession.unpickle("", sessionPickle); From f5480b77082b7ed4e45d9923ca1a290b5e6c6026 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 10 Nov 2020 18:31:18 +0100 Subject: [PATCH 2/3] provide random value for IE11 --- src/matrix/e2ee/OlmWorker.js | 8 +++++++- src/platform/web/worker/main.js | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/matrix/e2ee/OlmWorker.js b/src/matrix/e2ee/OlmWorker.js index 31099e65..e538dd31 100644 --- a/src/matrix/e2ee/OlmWorker.js +++ b/src/matrix/e2ee/OlmWorker.js @@ -39,7 +39,13 @@ export class OlmWorker { async createOutboundOlmSession(account, newSession, theirIdentityKey, theirOneTimeKey) { const accountPickle = account.pickle(""); - const sessionPickle = await this._workerPool.send({type: "olm_create_outbound", accountPickle, theirIdentityKey, theirOneTimeKey}).response(); + let randomValues; + if (window.msCrypto) { + randomValues = [ + window.msCrypto.getRandomValues(new Uint8Array(64)), + ]; + } + const sessionPickle = await this._workerPool.send({type: "olm_create_outbound", accountPickle, theirIdentityKey, theirOneTimeKey, randomValues}).response(); newSession.unpickle("", sessionPickle); } diff --git a/src/platform/web/worker/main.js b/src/platform/web/worker/main.js index ae440f57..41cf3419 100644 --- a/src/platform/web/worker/main.js +++ b/src/platform/web/worker/main.js @@ -142,8 +142,9 @@ class MessageHandler { }); } - _olmCreateOutbound(accountPickle, theirIdentityKey, theirOneTimeKey) { + _olmCreateOutbound(randomValues, accountPickle, theirIdentityKey, theirOneTimeKey) { return this._toMessage(() => { + this._feedRandomValues(randomValues); const account = new this._olm.Account(); const newSession = new this._olm.Session(); try { @@ -168,7 +169,7 @@ class MessageHandler { } else if (type === "olm_create_account_otks") { this._sendReply(message, this._olmCreateAccountAndOTKs(message.randomValues, message.otkAmount)); } else if (type === "olm_create_outbound") { - this._sendReply(message, this._olmCreateOutbound(message.accountPickle, message.theirIdentityKey, message.theirOneTimeKey)); + this._sendReply(message, this._olmCreateOutbound(message.randomValues, message.accountPickle, message.theirIdentityKey, message.theirOneTimeKey)); } } } From 2ad34c2dd2dbf73807b7c481ea9f564a90deae0a Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 10 Nov 2020 18:31:33 +0100 Subject: [PATCH 3/3] c/p error for passing arguments to create_outbound --- src/platform/web/worker/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/web/worker/main.js b/src/platform/web/worker/main.js index 41cf3419..db8d84e9 100644 --- a/src/platform/web/worker/main.js +++ b/src/platform/web/worker/main.js @@ -149,7 +149,7 @@ class MessageHandler { const newSession = new this._olm.Session(); try { account.unpickle("", accountPickle); - newSession.create_outbound(account, newSession, theirIdentityKey, theirOneTimeKey); + newSession.create_outbound(account, theirIdentityKey, theirOneTimeKey); return newSession.pickle(""); } finally { account.free();