From: Andrew Bartlett Date: Tue, 4 Nov 2014 22:56:58 +0000 (+1300) Subject: Only create a key of 256 bits length, not 256 bytes X-Git-Tag: v0.93~62^2^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=707c78b57b849da484d2fd18c4d9fc4114b8a7a1;p=ceph.git Only create a key of 256 bits length, not 256 bytes The actual open of the encrypted partition only uses the first 256 bits regardless. Signed-off-by: Andrew Bartlett --- diff --git a/src/ceph-disk b/src/ceph-disk index ccceecaf6697..57663133a731 100755 --- a/src/ceph-disk +++ b/src/ceph-disk @@ -794,7 +794,7 @@ def get_or_create_dmcrypt_key( if not os.path.exists(key_dir): os.makedirs(key_dir, stat.S_IRUSR|stat.S_IWUSR|stat.S_IXUSR) with file('/dev/urandom', 'rb') as i: - key = i.read(256) + key = i.read(256 / 8) fd = os.open(path, os.O_WRONLY|os.O_CREAT, stat.S_IRUSR|stat.S_IWUSR) assert os.write(fd, key) == len(key)