diff options
author | Jonathan Liu <net147@gmail.com> | 2013-10-04 07:32:12 -0700 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2013-10-09 20:25:34 -0700 |
commit | 70aa35b2b4d2e723fe82ac3184e5921a52be73ab (patch) | |
tree | 99f7aeccec390116b231c3a990b8e23e722b6d89 /NEWS | |
parent | 1c659d5cc6830c6f4f26660e9049582afbad3fd3 (diff) | |
download | parted-70aa35b2b4d2e723fe82ac3184e5921a52be73ab.tar.gz |
dos: improve MBR signature generation
Using tv_usec in struct timeval from gettimeofday() doesn't provide
enough precision to fill an unsigned 32-bit integer and isn't really
random. It it always less than one million when using the GNU C library
while an unsigned 32-bit integer ranges between 0 and 4294967295.
In FAT filesystem creation, parted already uses a better random
generator, so move that code into a common function and use it
for MS-DOS MBR signature generation.
* libparted/fs/r/fat/fat.c (_gen_new_serial_number): Remove.
(fat_create): Use generate_random_uint32 instead of
_gen_new_serial_number.
* libparted/labels/dos.c (generate_random_id): Remove.
(msdos_write): Use generate_random_uint32 instead of
generate_random_id.
* libparted/labels/misc.h (generate_random_uint32): New function.
Created from _gen_new_serial_number in libparted/fs/r/fat/fat.c with
additional check to avoid returning zero, which may be interpreted
as no FAT serial number or no MBR signature.
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -23,6 +23,10 @@ GNU parted NEWS -*- outline -*- partprobe now tells the kernel to forget about any partitions on a device that has no recognizable partition table. + dos: the range of random MBR signature values was artificially limited + to 0..999999, which mistakenly included 0. Now, we use the full 32-bit + range, but exclude 0. + ** Changes in behavior parted -l no longer lists device-mapper devices other than |