Przeglądaj źródła

e2ee: fix authentication tag check

this needs to be called with an Uint8Array, not an ArrayBuffer
dev1
Philipp Hancke 5 lat temu
rodzic
commit
4b71f96beb
1 zmienionych plików z 2 dodań i 1 usunięć
  1. 2
    1
      modules/e2ee/Worker.js

+ 2
- 1
modules/e2ee/Worker.js Wyświetl plik

296
                 this._cryptoKeyRing[keyIndex].authenticationKey, encodedFrame.data);
296
                 this._cryptoKeyRing[keyIndex].authenticationKey, encodedFrame.data);
297
 
297
 
298
             // Do truncated hash comparison.
298
             // Do truncated hash comparison.
299
-            if (!isArrayEqual(authTag, calculatedTag.slice(0, digestLength[encodedFrame.type]))) {
299
+            if (!isArrayEqual(new Uint8Array(authTag),
300
+                    new Uint8Array(calculatedTag.slice(0, digestLength[encodedFrame.type])))) {
300
                 // TODO: at this point we need to ratchet until we get a key that works. If we ratchet too often
301
                 // TODO: at this point we need to ratchet until we get a key that works. If we ratchet too often
301
                 // we need to return an error to the app.
302
                 // we need to return an error to the app.
302
                 console.error('Authentication tag mismatch', new Uint8Array(authTag), new Uint8Array(calculatedTag,
303
                 console.error('Authentication tag mismatch', new Uint8Array(authTag), new Uint8Array(calculatedTag,

Ładowanie…
Anuluj
Zapisz