From 51646f7133c30c69ec3c05ab8502900ffa91c798 Mon Sep 17 00:00:00 2001 From: Nickolay Olshevsky Date: Tue, 14 Nov 2023 17:53:49 +0200 Subject: [PATCH] Logging update. --- src/lib/crypto/symmetric.cpp | 8 +++++++- src/librepgp/stream-parse.cpp | 12 ++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/lib/crypto/symmetric.cpp b/src/lib/crypto/symmetric.cpp index afd812796..007832e1e 100644 --- a/src/lib/crypto/symmetric.cpp +++ b/src/lib/crypto/symmetric.cpp @@ -488,6 +488,7 @@ pgp_cipher_aead_init(pgp_crypt_t * crypt, RNP_LOG("failed to get update granularity"); return false; } + RNP_LOG("initialized aead %p, granularity %zu.", crypt->aead.obj, crypt->aead.granularity); return true; } @@ -548,10 +549,12 @@ pgp_cipher_aead_update(pgp_crypt_t *crypt, uint8_t *out, const uint8_t *in, size return false; } + RNP_LOG("calling botan_cipher_update() on %p with %zu.", crypt->aead.obj, len); if (botan_cipher_update(crypt->aead.obj, 0, out, len, &outwr, in, len, &inread) != 0) { RNP_LOG("aead update failed"); return false; } + RNP_LOG("done"); if ((outwr != len) || (inread != len)) { RNP_LOG("wrong aead usage"); @@ -564,7 +567,9 @@ pgp_cipher_aead_update(pgp_crypt_t *crypt, uint8_t *out, const uint8_t *in, size void pgp_cipher_aead_reset(pgp_crypt_t *crypt) { + RNP_LOG("calling botan_cipher_reset() on %p.", crypt->aead.obj); botan_cipher_reset(crypt->aead.obj); + RNP_LOG("done"); } bool @@ -578,7 +583,7 @@ pgp_cipher_aead_finish(pgp_crypt_t *crypt, uint8_t *out, const uint8_t *in, size if (crypt->aead.decrypt) { size_t datalen = len - crypt->aead.taglen; /* for decryption we should have tag for the final update call */ - RNP_LOG("calling botan_cipher_update() with %zu.", len); + RNP_LOG("calling botan_cipher_update() on %p with %zu.", crypt->aead.obj, len); res = botan_cipher_update(crypt->aead.obj, flags, out, datalen, &outwr, in, len, &inread); RNP_LOG("done: res %d, consumed %zu, written %zu", res, inread, outwr); @@ -618,6 +623,7 @@ void pgp_cipher_aead_destroy(pgp_crypt_t *crypt) { if (crypt->aead.obj) { + RNP_LOG("calling botan_cipher_destroy() on %p", crypt->aead.obj); botan_cipher_destroy(crypt->aead.obj); } memset(crypt, 0x0, sizeof(*crypt)); diff --git a/src/librepgp/stream-parse.cpp b/src/librepgp/stream-parse.cpp index d2ebb4a68..4e9a62e50 100644 --- a/src/librepgp/stream-parse.cpp +++ b/src/librepgp/stream-parse.cpp @@ -228,7 +228,7 @@ is_pgp_source(pgp_source_t &src) static bool partial_pkt_src_read(pgp_source_t *src, void *buf, size_t len, size_t *readres) { - RNP_LOG("partial %p start: %zu", src, len); + // RNP_LOG("partial %p start: %zu", src, len); if (src->eof) { *readres = 0; return true; @@ -243,7 +243,7 @@ partial_pkt_src_read(pgp_source_t *src, void *buf, size_t len, size_t *readres) size_t write = 0; while (len > 0) { if (!param->pleft && param->last) { - RNP_LOG("partial finish: %zu", write); + // RNP_LOG("partial finish: %zu", write); // we have the last chunk *readres = write; return true; @@ -254,13 +254,13 @@ partial_pkt_src_read(pgp_source_t *src, void *buf, size_t len, size_t *readres) RNP_LOG("partial chunk len failure"); return false; } - RNP_LOG("partial new chunk: %zu %d", read, (int) param->last); + // RNP_LOG("partial new chunk: %zu %d", read, (int) param->last); param->psize = read; param->pleft = read; } if (!param->pleft) { - RNP_LOG("partial zero chunk"); + // RNP_LOG("partial zero chunk"); *readres = write; return true; } @@ -274,7 +274,7 @@ partial_pkt_src_read(pgp_source_t *src, void *buf, size_t len, size_t *readres) RNP_LOG("failed to read data chunk"); return false; } - RNP_LOG("partial read %zu", read); + // RNP_LOG("partial read %zu", read); if (!read) { RNP_LOG("unexpected eof"); *readres = write; @@ -286,7 +286,7 @@ partial_pkt_src_read(pgp_source_t *src, void *buf, size_t len, size_t *readres) param->pleft -= read; } - RNP_LOG("partial end of cycle"); + // RNP_LOG("partial end of cycle"); *readres = write; return true; }