2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-02-16 02:29:56 +00:00

Correct offset to be in sectors, not bytes

This commit is contained in:
Jarrod Johnson 2021-07-23 17:32:42 -04:00
parent 81b4da6a95
commit 7f468c3a91

View File

@ -284,7 +284,7 @@ def encrypt_image(plainfile, cryptfile, keyfile):
neededblocks += 1
loopdev = subprocess.check_output(['losetup', '-f']).decode('utf8').strip()
subprocess.check_call(['losetup', loopdev, cryptfile])
subprocess.check_call(['dmsetup', 'create', dmname, '--table', '0 {} crypt aes-xts-plain64 {} 0 {} 4096'.format(neededblocks, key, loopdev)])
subprocess.check_call(['dmsetup', 'create', dmname, '--table', '0 {} crypt aes-xts-plain64 {} 0 {} 8'.format(neededblocks, key, loopdev)])
with open('/dev/mapper/{}'.format(dmname), 'wb') as cryptout:
with open(plainfile, 'rb') as plainin:
chunk = plainin.read(65536)