Home | History | Annotate | Download | only in libfec

Lines Matching defs:header

99 /* attempts to read and validate an ecc header from file position `offset' */
112 fec_header header;
116 if (!raw_pread(f, &header, sizeof(fec_header), offset)) {
121 /* move offset back to the beginning of the block for validating header */
124 if (header.magic != FEC_MAGIC) {
127 if (header.version != FEC_VERSION) {
128 error("unsupported ecc version: %u", header.version);
131 if (header.size != sizeof(fec_header)) {
132 error("unexpected ecc header size: %u", header.size);
135 if (header.roots == 0 || header.roots >= FEC_RSM) {
136 error("invalid ecc roots: %u", header.roots);
139 if (f->ecc.roots != (int)header.roots) {
141 header.roots);
144 if (header.fec_size % header.roots ||
145 header.fec_size % FEC_BLOCKSIZE) {
146 error("inconsistent ecc size %u", header.fec_size);
150 f->data_size = header.inp_size;
154 if (header.fec_size !=
156 error("inconsistent ecc size %u", header.fec_size);
160 f->ecc.size = header.fec_size;
161 f->ecc.start = header.inp_size;
188 f->ecc.valid = !memcmp(hash, header.hash, SHA256_DIGEST_LENGTH);
197 /* attempts to read an ecc header from `offset', and checks for a backup copy
198 at the end of the block if the primary header is not valid */
205 /* check the primary header at the beginning of the block */
210 /* check the backup header at the end of the block */
212 warn("using backup ecc header");
312 /* verity header is at the end of the data area */
457 memcpy(data->signature, f->verity.header.signature,
462 data->table_length = f->verity.header.length;