Skip to content

Commit

Permalink
Logging update.
Browse files Browse the repository at this point in the history
  • Loading branch information
ni4 committed Nov 14, 2023
1 parent 15a4b63 commit 51646f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 7 additions & 1 deletion src/lib/crypto/symmetric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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");
Expand All @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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));
Expand Down
12 changes: 6 additions & 6 deletions src/librepgp/stream-parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
if (src->eof) {
*readres = 0;
return true;
Expand All @@ -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;
Expand All @@ -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);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
param->psize = read;
param->pleft = read;
}

if (!param->pleft) {
RNP_LOG("partial zero chunk");
// RNP_LOG("partial zero chunk");

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
*readres = write;
return true;
}
Expand All @@ -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);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
if (!read) {
RNP_LOG("unexpected eof");
*readres = write;
Expand All @@ -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");

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
*readres = write;
return true;
}
Expand Down

0 comments on commit 51646f7

Please sign in to comment.