04-28-2013, 09:24 PM
If you decrypt the second AES block in the superblock, then you can test the following which gets you around 1 in 2 ^ 92.3:
Also I think s_free_inodes_count is signed so that gives you another bits worth of validation.
Code:
Offset (bytes) | Size (bytes) | Description
---------------+--------------+---------------------
1040 | 4 | s_free_inodes_count
1044 | 4 | s_first_data_block
1048 | 4 | s_log_block_size
1052 | 4 | s_log_frag_size
Code:
// exact: s_first_data_block == 0 || (s_first_data_block == 1 && s_log_block_size == 0)
if ((unsigned int) s_first_data_block < 2)
// assumes max block size is 32MiB
if ((unsigned int) s_log_block_size < 16)
// assumes max fragment size is 32MiB and (min is 1 byte)
if ((int) s_log_frag_size >= -10 && (int) s_log_frag_size < 16)
// volume_size_KiB is 32 bit if the volume is less than 4 TiB
if ((unsigned int) s_free_inodes_count < volume_size_KiB >> s_log_block_size)
Also I think s_free_inodes_count is signed so that gives you another bits worth of validation.