journal-verify.c revision 5996c7c295e073ce21d41305169132c8aa993ad0
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering This file is part of systemd.
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering Copyright 2012 Lennart Poettering
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering systemd is free software; you can redistribute it and/or modify it
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering under the terms of the GNU Lesser General Public License as published by
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering the Free Software Foundation; either version 2.1 of the License, or
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering (at your option) any later version.
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering systemd is distributed in the hope that it will be useful, but
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering Lesser General Public License for more details.
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering You should have received a copy of the GNU Lesser General Public License
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poetteringstatic int journal_file_object_verify(JournalFile *f, Object *o) {
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering /* This does various superficial tests about the length an
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering * possible field values. It does not follow any references to
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering * other objects. */
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering if (le64toh(o->data.entry_offset) <= 0 ||
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering if (le64toh(o->object.size) - offsetof(DataObject, payload) <= 0)
46e65dcc3a522b5e992e165b5e61d14254026859Lennart Poettering if (o->object.flags & OBJECT_COMPRESSED) {
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering le64toh(o->object.size) - offsetof(Object, data.payload),
e7e55dbdc38f929805ab2407fbd50886043a9e7cDavid Herrmann h2 = hash64(o->data.payload, le64toh(o->object.size) - offsetof(Object, data.payload));
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletar if (le64toh(o->object.size) - offsetof(FieldObject, payload) <= 0)
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletar if ((le64toh(o->object.size) - offsetof(EntryObject, items)) % sizeof(EntryItem) != 0)
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletar if ((le64toh(o->object.size) - offsetof(EntryObject, items)) / sizeof(EntryItem) <= 0)
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletar !VALID_REALTIME(le64toh(o->entry.realtime)) ||
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletar !VALID_MONOTONIC(le64toh(o->entry.monotonic)))
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletar for (i = 0; i < journal_file_entry_n_items(o); i++) {
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletar if ((le64toh(o->object.size) - offsetof(HashTableObject, items)) % sizeof(HashItem) != 0)
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletar if ((le64toh(o->object.size) - offsetof(HashTableObject, items)) / sizeof(HashItem) <= 0)
ff49bc3212cb07d850dcfd59940539773a0be26fMichal Schmidt for (i = 0; i < journal_file_hash_table_n_items(o); i++) {
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletar if (o->hash_table.items[i].head_hash_offset != 0 &&
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletar !VALID64(le64toh(o->hash_table.items[i].head_hash_offset)))
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletar if (o->hash_table.items[i].tail_hash_offset != 0 &&
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletar !VALID64(le64toh(o->hash_table.items[i].tail_hash_offset)))
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering if ((o->hash_table.items[i].head_hash_offset != 0) !=
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering (o->hash_table.items[i].tail_hash_offset != 0))
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering if ((le64toh(o->object.size) - offsetof(EntryArrayObject, items)) % sizeof(le64_t) != 0)
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering if ((le64toh(o->object.size) - offsetof(EntryArrayObject, items)) / sizeof(le64_t) <= 0)
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering if (!VALID64(o->entry_array.next_entry_array_offset))
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering for (i = 0; i < journal_file_entry_array_n_items(o); i++)
4d7859d173282e16bb75254c2b4ec14a915ef30bKay Sievers if (le64toh(o->object.size) != sizeof(TagObject))
ffc06c3513d9a0693c7f810d03b20705127ba55aKay Sieversstatic void draw_progress(uint64_t p, usec_t *last_usec) {
ffc06c3513d9a0693c7f810d03b20705127ba55aKay Sievers unsigned n, i, j, k;
4d7859d173282e16bb75254c2b4ec14a915ef30bKay Sievers j = (n * (unsigned) p) / 65535ULL;
4d7859d173282e16bb75254c2b4ec14a915ef30bKay Sievers fputs("\r\x1B[?25l" ANSI_HIGHLIGHT_GREEN_ON, stdout);
4d7859d173282e16bb75254c2b4ec14a915ef30bKay Sievers for (i = 0; i < j; i++)
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering for (i = 0; i < k; i++)
151b9b9662a90455262ce575a8a8ae74bf4ff336Lennart Poettering printf(" %3lu%%", 100LU * (unsigned long) p / 65535LU);
151b9b9662a90455262ce575a8a8ae74bf4ff336Lennart Poetteringstatic void flush_progress(void) {
4d7859d173282e16bb75254c2b4ec14a915ef30bKay Sievers unsigned n, i;
94676f3e9352cbf1f72e0a512ee0d2ed83ff676dLennart Poettering for (i = 0; i < n + 5; i++)
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poetteringstatic int write_uint64(int fd, uint64_t p) {
17d33cecaa762f7e43200307328af5e9135e2091Giovanni Campagna if (k != sizeof(p))
f647962d64e844689f3e2acfce6102fc47e76df2Michal Schmidtstatic int contains_uint64(MMapCache *m, int fd, uint64_t n, uint64_t p) {
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering /* Bisection ... */
4d7859d173282e16bb75254c2b4ec14a915ef30bKay Sievers a = 0; b = n;
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering while (a < b) {
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering c = (a + b) / 2;
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering r = mmap_cache_get(m, fd, PROT_READ|PROT_WRITE, 0, false, c * sizeof(uint64_t), sizeof(uint64_t), NULL, (void **) &z);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering if (a + 1 >= b)
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering if (!contains_uint64(f->mmap, entry_fd, n_entries, entry_p)) {
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering log_error("Data object references invalid entry at %llu", (unsigned long long) data_p);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering r = journal_file_move_to_object(f, OBJECT_ENTRY, entry_p, &o);
2b6bf07dd23bb467099d213c97b3875c5e453491Zbigniew Jędrzejewski-Szmek for (i = 0; i < n; i++)
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering if (le64toh(o->entry.items[i].object_offset) == data_p) {
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering log_error("Data object not referenced by linked entry at %llu", (unsigned long long) data_p);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering /* Check if this entry is also in main entry array. Since the
ef42202ac8ed27e7ff1fc90ef8bc2590046dff25Zbigniew Jędrzejewski-Szmek * main entry array has already been verified we can rely on
f647962d64e844689f3e2acfce6102fc47e76df2Michal Schmidt * its consistency.*/
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering a = le64toh(f->header->entry_array_offset);
4d7859d173282e16bb75254c2b4ec14a915ef30bKay Sievers while (i < n) {
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering if (entry_p <= le64toh(o->entry_array.items[u-1])) {
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering while (x < y) {
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering z = (x + y) / 2;
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering if (le64toh(o->entry_array.items[z]) == entry_p)
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering if (x + 1 >= y)
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering if (entry_p < le64toh(o->entry_array.items[z]))
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering log_error("Entry object doesn't exist in main entry array at %llu", (unsigned long long) entry_p);
e1636421f46db6d06fbd028ef20a3113fa3e11f8Lennart Poettering a = le64toh(o->entry_array.next_entry_array_offset);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering int entry_array_fd, uint64_t n_entry_arrays) {
4d7859d173282e16bb75254c2b4ec14a915ef30bKay Sievers /* We already checked this earlier */
e1636421f46db6d06fbd028ef20a3113fa3e11f8Lennart Poettering r = entry_points_to_data(f, entry_fd, n_entries, q, p);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering while (i < n) {
7fd1b19bc9e9f5574f2877936b8ac267c7706947Harald Hoyer if (a == 0) {
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering log_error("Array chain too short at %llu", (unsigned long long) p);
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering if (!contains_uint64(f->mmap, entry_array_fd, n_entry_arrays, a)) {
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering log_error("Invalid array at %llu", (unsigned long long) p);
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o);
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering next = le64toh(o->entry_array.next_entry_array_offset);
c62e11ce3966c55d23520b9f0785c7e839cf7f37Lennart Poettering log_error("Array chain has cycle at %llu", (unsigned long long) p);
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering for (j = 0; i < n && j < m; i++, j++) {
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering log_error("Data object's entry array not sorted at %llu", (unsigned long long) p);
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering r = entry_points_to_data(f, entry_fd, n_entries, q, p);
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering /* Pointer might have moved, reposition */
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o);
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering int entry_array_fd, uint64_t n_entry_arrays,
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering n = le64toh(f->header->data_hash_table_size) / sizeof(HashItem);
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering for (i = 0; i < n; i++) {
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering draw_progress(0xC000 + (0x3FFF * i / n), last_usec);
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering p = le64toh(f->data_hash_table[i].head_hash_offset);
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering while (p != 0) {
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering if (!contains_uint64(f->mmap, data_fd, n_data, p)) {
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering log_error("Invalid data object at hash entry %llu of %llu",
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering (unsigned long long) i, (unsigned long long) n);
7d6884b65e6ea7317346d29bc2f6c9ba051a0cacThomas Hindoe Paaboel Andersen r = journal_file_move_to_object(f, OBJECT_DATA, p, &o);
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering next = le64toh(o->data.next_hash_offset);
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering log_error("Hash chain has a cycle in hash entry %llu of %llu",
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering (unsigned long long) i, (unsigned long long) n);
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering log_error("Hash value mismatch in hash entry %llu of %llu",
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering (unsigned long long) i, (unsigned long long) n);
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering r = verify_data(f, o, p, entry_fd, n_entries, entry_array_fd, n_entry_arrays);
4d7859d173282e16bb75254c2b4ec14a915ef30bKay Sievers if (last != le64toh(f->data_hash_table[i].tail_hash_offset)) {
a86a47ce1f63476631635fbcbc10af8877172114Lennart Poettering log_error("Tail hash pointer mismatch in hash table");
31cf921abbeafc9dae2d5c777f3e2285e6f4c19dJan Synacekstatic int data_object_in_hash_table(JournalFile *f, uint64_t hash, uint64_t p) {
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering n = le64toh(f->header->data_hash_table_size) / sizeof(HashItem);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering q = le64toh(f->data_hash_table[h].head_hash_offset);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering while (q != 0) {
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering r = journal_file_move_to_object(f, OBJECT_DATA, q, &o);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering for (i = 0; i < n; i++) {
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering q = le64toh(o->entry.items[i].object_offset);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering if (!contains_uint64(f->mmap, data_fd, n_data, q)) {
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering log_error("Invalid data object at entry %llu",
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering (unsigned long long) p);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering r = journal_file_move_to_object(f, OBJECT_DATA, q, &u);
546158bc6f46f8004cc11e81d19d223e0da56730Jan Janssen log_error("Hash mismatch for data object at entry %llu",
546158bc6f46f8004cc11e81d19d223e0da56730Jan Janssen (unsigned long long) p);
4d7859d173282e16bb75254c2b4ec14a915ef30bKay Sievers if (r == 0) {
4d7859d173282e16bb75254c2b4ec14a915ef30bKay Sievers log_error("Data object missing from hash at entry %llu",
de33fc625725d199629ed074d6278504deb23debLennart Poettering (unsigned long long) p);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering int entry_array_fd, uint64_t n_entry_arrays,
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering a = le64toh(f->header->entry_array_offset);
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering while (i < n) {
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering draw_progress(0x8000 + (0x3FFF * i / n), last_usec);
50cfc579280fb42569488079bd2e249e32a27df2Lennart Poettering log_error("Array chain too short at %llu of %llu",
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering (unsigned long long) i, (unsigned long long) n);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering if (!contains_uint64(f->mmap, entry_array_fd, n_entry_arrays, a)) {
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering log_error("Invalid array at %llu of %llu",
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering (unsigned long long) i, (unsigned long long) n);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering next = le64toh(o->entry_array.next_entry_array_offset);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering log_error("Array chain has cycle at %llu of %llu",
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering (unsigned long long) i, (unsigned long long) n);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering for (j = 0; i < n && j < m; i++, j++) {
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering log_error("Entry array not sorted at %llu of %llu",
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering (unsigned long long) i, (unsigned long long) n);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering if (!contains_uint64(f->mmap, entry_fd, n_entries, p)) {
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering log_error("Invalid array entry at %llu of %llu",
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering (unsigned long long) i, (unsigned long long) n);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering r = journal_file_move_to_object(f, OBJECT_ENTRY, p, &o);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering r = verify_entry(f, o, p, data_fd, n_data);
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering /* Pointer might have moved, reposition */
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o);
4d7859d173282e16bb75254c2b4ec14a915ef30bKay Sievers usec_t *first_validated, usec_t *last_validated, usec_t *last_contained,
a9cdc94f7ff40f22a3cf9472f612a80730a1b010Dave Reisner uint64_t p = 0, last_tag = 0, last_epoch = 0, last_tag_realtime = 0, last_sealed_realtime = 0;
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering uint64_t entry_seqnum = 0, entry_monotonic = 0, entry_realtime = 0;
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering bool entry_seqnum_set = false, entry_monotonic_set = false, entry_realtime_set = false, found_main_entry_array = false;
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering uint64_t n_weird = 0, n_objects = 0, n_entries = 0, n_data = 0, n_fields = 0, n_data_hash_tables = 0, n_field_hash_tables = 0, n_entry_arrays = 0, n_tags = 0;
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering int data_fd = -1, entry_fd = -1, entry_array_fd = -1;
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering char data_path[] = "/var/tmp/journal-data-XXXXXX",
4d7859d173282e16bb75254c2b4ec14a915ef30bKay Sievers entry_array_path[] = "/var/tmp/journal-entry-array-XXXXXX";
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering r = journal_file_parse_verification_key(f, key);
return -ENOTSUP;
} else if (f->seal)
return -ENOKEY;
if (data_fd < 0) {
r = -errno;
goto fail;
if (entry_fd < 0) {
r = -errno;
goto fail;
if (entry_array_fd < 0) {
r = -errno;
goto fail;
#ifdef HAVE_GCRYPT
r = -ENOTSUP;
goto fail;
r = -EBADMSG;
goto fail;
if (show_progress)
goto fail;
r = -EBADMSG;
goto fail;
found_last = true;
n_objects ++;
r = journal_file_object_verify(f, o);
goto fail;
r = -EBADMSG;
goto fail;
case OBJECT_DATA:
goto fail;
n_data++;
case OBJECT_FIELD:
n_fields++;
case OBJECT_ENTRY:
r = -EBADMSG;
goto fail;
goto fail;
r = -EBADMSG;
goto fail;
if (!entry_seqnum_set &&
r = -EBADMSG;
goto fail;
if (entry_seqnum_set &&
r = -EBADMSG;
goto fail;
entry_seqnum_set = true;
if (entry_monotonic_set &&
r = -EBADMSG;
goto fail;
entry_monotonic_set = true;
if (!entry_realtime_set &&
r = -EBADMSG;
goto fail;
entry_realtime_set = true;
n_entries ++;
case OBJECT_DATA_HASH_TABLE:
r = -EBADMSG;
goto fail;
le64toh(f->header->data_hash_table_size) != le64toh(o->object.size) - offsetof(HashTableObject, items)) {
r = -EBADMSG;
goto fail;
case OBJECT_FIELD_HASH_TABLE:
r = -EBADMSG;
goto fail;
le64toh(f->header->field_hash_table_size) != le64toh(o->object.size) - offsetof(HashTableObject, items)) {
r = -EBADMSG;
goto fail;
case OBJECT_ENTRY_ARRAY:
goto fail;
if (found_main_entry_array) {
r = -EBADMSG;
goto fail;
found_main_entry_array = true;
case OBJECT_TAG:
r = -EBADMSG;
goto fail;
r = -EBADMSG;
goto fail;
r = -EBADMSG;
goto fail;
#ifdef HAVE_GCRYPT
if (f->seal) {
r = -EBADMSG;
goto fail;
goto fail;
r = journal_file_hmac_start(f);
goto fail;
if (last_tag == 0) {
r = journal_file_hmac_put_header(f);
goto fail;
q = last_tag;
goto fail;
goto fail;
goto fail;
r = -EBADMSG;
goto fail;
f->hmac_running = false;
n_tags ++;
n_weird ++;
if (!found_last) {
r = -EBADMSG;
goto fail;
r = -EBADMSG;
goto fail;
r = -EBADMSG;
goto fail;
r = -EBADMSG;
goto fail;
r = -EBADMSG;
goto fail;
r = -EBADMSG;
goto fail;
r = -EBADMSG;
goto fail;
r = -EBADMSG;
goto fail;
r = -EBADMSG;
goto fail;
if (!found_main_entry_array) {
r = -EBADMSG;
goto fail;
if (entry_seqnum_set &&
r = -EBADMSG;
goto fail;
if (entry_monotonic_set &&
r = -EBADMSG;
goto fail;
r = -EBADMSG;
goto fail;
r = verify_entry_array(f,
goto fail;
r = verify_hash_table(f,
goto fail;
if (show_progress)
if (first_validated)
if (last_validated)
if (last_contained)
fail:
if (show_progress)
f->path,
if (data_fd >= 0) {
if (entry_fd >= 0) {
if (entry_array_fd >= 0) {