From ec9c67189e1b841a922a627a9066d17222b51a01 Mon Sep 17 00:00:00 2001 From: Ingo Franzki Date: Thu, 14 Feb 2019 10:15:18 +0100 Subject: [PATCH] zkey-cryptsetup: Support debug level CRYPT_DEBUG_JSON MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With libcryptsetup version 2.1 a new debug level was introduced to log the JSON structures when adding key slots, digests, etc into the LUKS2 header. Signed-off-by: Ingo Franzki Signed-off-by: Jan Höppner --- zkey/zkey-cryptsetup.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/zkey/zkey-cryptsetup.c b/zkey/zkey-cryptsetup.c index afa3ab8d..24e2452c 100644 --- a/zkey/zkey-cryptsetup.c +++ b/zkey/zkey-cryptsetup.c @@ -421,6 +421,11 @@ static void cryptsetup_log(int level, const char *msg, case CRYPT_LOG_DEBUG: fprintf(stderr, "%s: # %s\n", program_invocation_short_name, msg); break; +#ifdef CRYPT_DEBUG_JSON + case CRYPT_DEBUG_JSON: + fprintf(stderr, "%s\n", msg); + break; +#endif default: warnx("Internal error on logging class for msg: %s", msg); break; @@ -2278,7 +2283,11 @@ int main(int argc, char *argv[]) crypt_set_log_callback(NULL, cryptsetup_log, NULL); if (g.debug) - crypt_set_debug_level(-1); +#ifdef CRYPT_DEBUG_JSON + crypt_set_debug_level(CRYPT_DEBUG_JSON); +#else + crypt_set_debug_level(CRYPT_DEBUG_ALL); +#endif if (command->open_device) { if (g.pos_arg == NULL) {