Skip to content

Commit

Permalink
Only create a key of 256 bits length, not 256 bytes
Browse files Browse the repository at this point in the history
The actual open of the encrypted partition only uses the first 256 bits regardless.

Signed-off-by: Andrew Bartlett <[email protected]>
  • Loading branch information
Andrew Bartlett authored and abartlet committed Jan 30, 2015
1 parent 6a45b8e commit 707c78b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ceph-disk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 707c78b

Please sign in to comment.