Commit 7e77801a authored by Philipp Hörist's avatar Philipp Hörist

[omemo] Add back 12 byte IV read support for aesgcm links

parent ab47492b
......@@ -169,10 +169,19 @@ class FileDecryption:
raise ValueError('Invalid fragment')
fragment = binascii.unhexlify(fragment)
key = fragment[16:]
iv = fragment[:16]
if len(key) != 32 or len(iv) != 16:
raise ValueError('Invalid fragment')
size = len(fragment)
# Clients started out with using a 16 byte IV but long term
# want to swtich to the more performant 12 byte IV
# We have to support both
if size == 48:
key = fragment[16:]
iv = fragment[:16]
elif size == 44:
key = fragment[12:]
iv = fragment[:12]
else:
raise ValueError('Invalid fragment size: %s' % size)
return key, iv
@staticmethod
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment