Remove verity FEC superblock support.

It seems to be never used anywhere.
This commit is contained in:
Milan Broz
2017-04-05 11:41:08 +02:00
parent 1da785cb77
commit 058831d88c
3 changed files with 1 additions and 48 deletions

View File

@@ -261,7 +261,7 @@ int VERITY_activate(struct crypt_device *cd,
dmd.u.verity.root_hash = root_hash; dmd.u.verity.root_hash = root_hash;
dmd.u.verity.root_hash_size = root_hash_size; dmd.u.verity.root_hash_size = root_hash_size;
dmd.u.verity.hash_offset = VERITY_hash_offset_block(verity_hdr); dmd.u.verity.hash_offset = VERITY_hash_offset_block(verity_hdr);
dmd.u.verity.fec_offset = VERITY_FEC_offset_block(verity_hdr); dmd.u.verity.fec_offset = verity_hdr->fec_area_offset / verity_hdr->hash_block_size;
dmd.u.verity.hash_blocks = VERITY_hash_blocks(cd, verity_hdr); dmd.u.verity.hash_blocks = VERITY_hash_blocks(cd, verity_hdr);
dmd.flags = activation_flags; dmd.flags = activation_flags;
dmd.size = verity_hdr->data_size * verity_hdr->data_block_size / 512; dmd.size = verity_hdr->data_size * verity_hdr->data_block_size / 512;

View File

@@ -64,7 +64,6 @@ int VERITY_FEC_create(struct crypt_device *cd,
struct device *fec_device); struct device *fec_device);
uint64_t VERITY_hash_offset_block(struct crypt_params_verity *params); uint64_t VERITY_hash_offset_block(struct crypt_params_verity *params);
uint64_t VERITY_FEC_offset_block(struct crypt_params_verity *params);
uint64_t VERITY_hash_blocks(struct crypt_device *cd, struct crypt_params_verity *params); uint64_t VERITY_hash_blocks(struct crypt_device *cd, struct crypt_params_verity *params);

View File

@@ -48,18 +48,6 @@
(roots), /* polynomial degree (number of roots) */ \ (roots), /* polynomial degree (number of roots) */ \
0 /* padding bytes at the front of shortened block */ 0 /* padding bytes at the front of shortened block */
#define FEC_SIGNATURE "fec...\0\0"
#define FEC_VERSION 0
struct fec_sb {
uint8_t signature[8]; /* "fec...\0\0" */
uint32_t version; /* superblock version */
uint8_t _pad1[4];
uint32_t roots; /* parity bytes */
uint64_t blocks; /* number of data blocks */
uint8_t _pad2[484];
} __attribute__((packed));
struct fec_input_device { struct fec_input_device {
struct device *device; struct device *device;
int fd; int fd;
@@ -78,20 +66,6 @@ struct fec_context {
size_t ninputs; size_t ninputs;
}; };
/* Calculate FEC offset in hash blocks */
uint64_t VERITY_FEC_offset_block(struct crypt_params_verity *params)
{
uint64_t fec_offset = params->fec_area_offset;
if (params->flags & CRYPT_VERITY_NO_HEADER)
return fec_offset / params->hash_block_size;
fec_offset += sizeof(struct fec_sb);
//hash_offset += params->hash_block_size - 1;
return fec_offset / params->hash_block_size;
}
/* computes ceil(x / y) */ /* computes ceil(x / y) */
static inline uint64_t FEC_div_round_up(uint64_t x, uint64_t y) static inline uint64_t FEC_div_round_up(uint64_t x, uint64_t y)
{ {
@@ -134,19 +108,6 @@ static int FEC_read_interleaved(struct fec_context *ctx, uint64_t i,
return -1; return -1;
} }
static int FEC_write_sb(struct fec_context *ctx, int fd)
{
struct fec_sb sb;
memset(&sb, 0, sizeof(sb));
memcpy(&sb.signature, FEC_SIGNATURE, sizeof(sb.signature));
sb.version = FEC_VERSION; // FIXME: endianess
sb.roots = ctx->roots; // FIXME: endianess
sb.blocks = ctx->size / ctx->block_size; // FIXME: endianess
return (write_buffer(fd, &sb, sizeof(sb)) == sizeof(sb)) ? 0 : -1;
}
/* encodes inputs to fd */ /* encodes inputs to fd */
static int FEC_encode_inputs(struct crypt_device *cd, static int FEC_encode_inputs(struct crypt_device *cd,
struct crypt_params_verity *params, struct crypt_params_verity *params,
@@ -192,13 +153,6 @@ static int FEC_encode_inputs(struct crypt_device *cd,
return -ENOMEM; return -ENOMEM;
} }
/* write superblock */
if (!(params->flags & CRYPT_VERITY_NO_HEADER) && FEC_write_sb(&ctx, fd)) {
log_err(cd, _("Failed to write FEC superblock.\n"));
r = -EIO;
goto out;
}
/* encode input */ /* encode input */
for (n = 0; n < ctx.rounds; ++n) { for (n = 0; n < ctx.rounds; ++n) {
for (i = 0; i < ctx.rsn; ++i) { for (i = 0; i < ctx.rsn; ++i) {