Lines Matching full:ecc
98 /* attempts to read and validate an ecc header from file position `offset' */
102 check(f->ecc.rsn > 0 && f->ecc.rsn < FEC_RSM);
113 /* there's obviously no ecc data at this point, so there is no need to
127 error("unsupported ecc version: %u", header.version);
131 error("unexpected ecc header size: %u", header.size);
135 error("invalid ecc roots: %u", header.roots);
138 if (f->ecc.roots != (int)header.roots) {
139 error("unexpected number of roots: %d vs %u", f->ecc.roots,
145 error("inconsistent ecc size %u", header.fec_size);
148 /* structure: data | ecc | header */
157 f->ecc.blocks = fec_div_round_up(f->data_size, FEC_BLOCKSIZE);
158 f->ecc.rounds = fec_div_round_up(f->ecc.blocks, f->ecc.rsn);
161 (uint32_t)f->ecc.rounds * f->ecc.roots * FEC_BLOCKSIZE) {
162 error("inconsistent ecc size %u", header.fec_size);
166 f->ecc.size = header.fec_size;
167 f->ecc.start = header.inp_size;
177 while (n < f->ecc.size) {
178 if (len > f->ecc.size - n) {
179 len = f->ecc.size - n;
182 if (!raw_pread(f, buf, len, f->ecc.start + n)) {
183 error("failed to read ecc: %s", strerror(errno));
194 f->ecc.valid = !memcmp(hash, header.hash, SHA256_DIGEST_LENGTH);
196 if (!f->ecc.valid) {
197 warn("ecc data not valid");
203 /* attempts to read an ecc header from `offset', and checks for a backup copy
218 warn("using backup ecc header");
351 /* locates, validates, and loads ecc data from `f->fd' */
361 f->ecc.start);
410 memset(&f->ecc, 0, sizeof(f->ecc));
473 /* populates `data' from the internal data in `f', returns a value <0 if ecc
480 if (!f->ecc.start) {
485 check(f->ecc.start >= f->data_size);
486 check(f->ecc.start < f->size);
487 check(f->ecc.start % FEC_BLOCKSIZE == 0)
489 data->valid = f->ecc.valid;
490 data->roots = f->ecc.roots;
491 data->blocks = f->ecc.blocks;
492 data->rounds = f->ecc.rounds;
493 data->start = f->ecc.start;
543 f->ecc.roots = roots;
544 f->ecc.rsn = FEC_RSM - roots;
564 f->data_size = f->size; /* until ecc and/or verity are loaded */