diff --git a/lib/bitlk/bitlk.c b/lib/bitlk/bitlk.c index 212ab7d0..0b202113 100644 --- a/lib/bitlk/bitlk.c +++ b/lib/bitlk/bitlk.c @@ -501,18 +501,6 @@ int BITLK_read_sb(struct crypt_device *cd, struct bitlk_metadata *params) goto out; } - if (memcmp(sig.boot_code, BITLK_BOOTCODE_V1, sizeof(sig.boot_code)) == 0) { - log_err(cd, _("BITLK version 1 is currently not supported.")); - r = -ENOTSUP; - goto out; - } else if (memcmp(sig.boot_code, BITLK_BOOTCODE_V2, sizeof(sig.boot_code)) == 0) - ; - else { - log_err(cd, _("Invalid or unknown boot signature for BITLK device.")); - r = -EINVAL; - goto out; - } - if (memcmp(sig.signature, BITLK_SIGNATURE, sizeof(sig.signature)) == 0) { params->togo = false; fve_offset = BITLK_HEADER_METADATA_OFFSET; @@ -525,6 +513,18 @@ int BITLK_read_sb(struct crypt_device *cd, struct bitlk_metadata *params) goto out; } + if (memcmp(sig.boot_code, BITLK_BOOTCODE_V1, sizeof(sig.boot_code)) == 0) { + log_err(cd, _("BITLK version 1 is currently not supported.")); + r = -ENOTSUP; + goto out; + } else if (memcmp(sig.boot_code, BITLK_BOOTCODE_V2, sizeof(sig.boot_code)) == 0) + ; + else { + log_err(cd, _("Invalid or unknown boot signature for BITLK device.")); + r = -EINVAL; + goto out; + } + params->sector_size = le16_to_cpu(sig.sector_size); if (params->sector_size == 0) { log_dbg(cd, "Got sector size 0, assuming 512.");