Parcourir la source

e2ee: fix authentication tag check

this needs to be called with an Uint8Array, not an ArrayBuffer
dev1
Philipp Hancke il y a 5 ans
Parent
révision
4b71f96beb
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2
    1
      modules/e2ee/Worker.js

+ 2
- 1
modules/e2ee/Worker.js Voir le fichier

@@ -296,7 +296,8 @@ class Context {
296 296
                 this._cryptoKeyRing[keyIndex].authenticationKey, encodedFrame.data);
297 297
 
298 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 301
                 // TODO: at this point we need to ratchet until we get a key that works. If we ratchet too often
301 302
                 // we need to return an error to the app.
302 303
                 console.error('Authentication tag mismatch', new Uint8Array(authTag), new Uint8Array(calculatedTag,

Chargement…
Annuler
Enregistrer