[tahoe-lafs-trac-stream] [tahoe-lafs] #2120: Change counter value for AES-CTR
tahoe-lafs
trac at tahoe-lafs.org
Wed Nov 27 21:06:50 UTC 2013
#2120: Change counter value for AES-CTR
------------------------+---------------------------
Reporter: markberger | Owner: daira
Type: defect | Status: new
Priority: normal | Milestone: undecided
Component: unknown | Version: 1.10.0
Keywords: | Launchpad Bug:
------------------------+---------------------------
In `immutable/upload.py` we have the following code:
{{{
def _hash_and_encrypt_plaintext(self, data, hash_only):
assert isinstance(data, (tuple, list)), type(data)
data = list(data)
cryptdata = []
# we use data.pop(0) instead of 'for chunk in data' to save
# memory: each chunk is destroyed as soon as we're done with it.
bytes_processed = 0
while data:
chunk = data.pop(0)
self.log(" read_encrypted handling %dB-sized chunk" %
len(chunk),
level=log.NOISY)
bytes_processed += len(chunk)
self._plaintext_hasher.update(chunk)
self._update_segment_hash(chunk)
# TODO: we have to encrypt the data (even if hash_only==True)
# because pycryptopp's AES-CTR implementation doesn't offer a
# way to change the counter value. Once pycryptopp acquires
# this ability, change this to simply update the counter
# before each call to (hash_only==False) _encryptor.process()
ciphertext = self._encryptor.process(chunk)
if hash_only:
self.log(" skipping encryption", level=log.NOISY)
else:
cryptdata.append(ciphertext)
del ciphertext
del chunk
self._ciphertext_bytes_read += bytes_processed
if self._status:
progress = float(self._ciphertext_bytes_read) /
self._file_size
self._status.set_progress(1, progress)
return cryptdata
}}}
As part of #1382 I am removing the TODO and creating a ticket for this
instead.
--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2120>
tahoe-lafs <https://tahoe-lafs.org>
secure decentralized storage
More information about the tahoe-lafs-trac-stream
mailing list