]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Only create a key of 256 bits length, not 256 bytes
authorAndrew Bartlett <abartlet@catalyst.net.nz>
Tue, 4 Nov 2014 22:56:58 +0000 (11:56 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 30 Jan 2015 01:34:42 +0000 (14:34 +1300)
The actual open of the encrypted partition only uses the first 256 bits regardless.

Signed-off-by: Andrew Bartlett <abartlet@catalyst.net.nz>
src/ceph-disk

index ccceecaf66973a6ef32a85133afc15b3ec393a84..57663133a73108fa8912173b7e0e065c43e12ce5 100755 (executable)
@@ -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)