summaryrefslogtreecommitdiff
path: root/client/src/leap/soledad
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/leap/soledad')
-rw-r--r--client/src/leap/soledad/client/_blobs.py3
-rw-r--r--client/src/leap/soledad/client/_crypto.py6
2 files changed, 8 insertions, 1 deletions
diff --git a/client/src/leap/soledad/client/_blobs.py b/client/src/leap/soledad/client/_blobs.py
index 99ed1678..24e2fa65 100644
--- a/client/src/leap/soledad/client/_blobs.py
+++ b/client/src/leap/soledad/client/_blobs.py
@@ -125,7 +125,8 @@ class DecrypterBuffer(object):
self.preamble_pipe.write(data)
def close(self):
- return self.decrypter._end_stream(), self.decrypter.size
+ real_size = self.decrypter.decrypted_content_size
+ return self.decrypter._end_stream(), real_size
class BlobManager(object):
diff --git a/client/src/leap/soledad/client/_crypto.py b/client/src/leap/soledad/client/_crypto.py
index 868fcd0d..7a1d508e 100644
--- a/client/src/leap/soledad/client/_crypto.py
+++ b/client/src/leap/soledad/client/_crypto.py
@@ -360,6 +360,10 @@ class BlobDecryptor(object):
if start_stream:
self._start_stream()
+ @property
+ def decrypted_content_size(self):
+ return self._aes.written
+
def _start_stream(self):
self._producer = FileBodyProducer(self.fd, readSize=2**16)
@@ -485,6 +489,7 @@ class AESWriter(object):
cipher = _get_aes_cipher(key, self.iv, tag, mode)
cipher = cipher.decryptor() if tag else cipher.encryptor()
self.cipher, self.aead = cipher, ''
+ self.written = 0
def authenticate(self, data):
self.aead += data
@@ -495,6 +500,7 @@ class AESWriter(object):
return getattr(self.cipher, 'tag', None)
def write(self, data):
+ self.written += len(data)
self.buffer.write(self.cipher.update(data))
def end(self):