From baed47c3c20512507e497058d388782400a072f6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 17 Aug 2012 00:45:18 +0200 Subject: journal: rework terminology Let's clean up our terminology a bit. New terminology: FSS = Forward Secure Sealing FSPRG = Forward Secure Pseudo-Random Generator FSS is the combination of FSPRG and a HMAC. Sealing = process of adding authentication tags to the journal. Verification = process of checking authentication tags to the journal. Sealing Key = The key used for adding authentication tags to the journal. Verification Key = The key used for checking authentication tags of the journal. Key pair = The pair of Sealing Key and Verification Key Internally, the Sealing Key is the combination of the FSPRG State plus change interval/start time. Internally, the Verification Key is the combination of the FSPRG Seed plus change interval/start time. --- src/journal/journal-verify.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/journal/journal-verify.c') diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c index e646e38ddc..b7097e7b01 100644 --- a/src/journal/journal-verify.c +++ b/src/journal/journal-verify.c @@ -38,6 +38,7 @@ * - write tag only if non-tag objects have been written * - change terms * - write bit mucking test + * - tag timestamps should be between entry timestamps * * - Allow building without libgcrypt * - check with sparse @@ -595,7 +596,7 @@ static int verify_entry_array( return 0; } -static int journal_file_parse_seed(JournalFile *f, const char *s) { +static int journal_file_parse_verification_key(JournalFile *f, const char *key) { uint8_t *seed; size_t seed_size, c; const char *k; @@ -607,7 +608,7 @@ static int journal_file_parse_seed(JournalFile *f, const char *s) { if (!seed) return -ENOMEM; - k = s; + k = key; for (c = 0; c < seed_size; c++) { int x, y; @@ -644,13 +645,14 @@ static int journal_file_parse_seed(JournalFile *f, const char *s) { f->fsprg_seed = seed; f->fsprg_seed_size = seed_size; - f->fsprg_start_usec = start; - f->fsprg_interval_usec = interval; + + f->fss_start_usec = start; + f->fss_interval_usec = interval; return 0; } -int journal_file_verify(JournalFile *f, const char *seed) { +int journal_file_verify(JournalFile *f, const char *key) { int r; Object *o; uint64_t p = 0, last_tag = 0, last_epoch = 0; @@ -666,8 +668,8 @@ int journal_file_verify(JournalFile *f, const char *seed) { assert(f); - if (seed) { - r = journal_file_parse_seed(f, seed); + if (key) { + r = journal_file_parse_verification_key(f, key); if (r < 0) { log_error("Failed to parse seed."); return r; @@ -848,8 +850,8 @@ int journal_file_verify(JournalFile *f, const char *seed) { case OBJECT_TAG: { uint64_t q; - if (!(le32toh(f->header->compatible_flags) & HEADER_COMPATIBLE_AUTHENTICATED)) { - log_error("Tag object without authentication at %llu", (unsigned long long) p); + if (!(le32toh(f->header->compatible_flags) & HEADER_COMPATIBLE_SEALED)) { + log_error("Tag object without sealing at %llu", (unsigned long long) p); r = -EBADMSG; goto fail; } @@ -904,7 +906,7 @@ int journal_file_verify(JournalFile *f, const char *seed) { goto fail; if (memcmp(o->tag.tag, gcry_md_read(f->hmac, 0), TAG_LENGTH) != 0) { - log_error("Tag did not authenticate at %llu", (unsigned long long) p); + log_error("Tag failed verification at %llu", (unsigned long long) p); r = -EBADMSG; goto fail; } -- cgit v1.2.3-54-g00ecf