Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows CI failures. #2143

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions 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,8 +583,10 @@ 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() 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);
if (res != 0) {
if (res != BOTAN_FFI_ERROR_BAD_MAC) {
RNP_LOG("aead finish failed: %d", res);
Expand All @@ -606,14 +613,17 @@ pgp_cipher_aead_finish(pgp_crypt_t *crypt, uint8_t *out, const uint8_t *in, size
}
}

RNP_LOG("calling pgp_cipher_aead_reset()");
pgp_cipher_aead_reset(crypt);
RNP_LOG("done");
return true;
}

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
3 changes: 3 additions & 0 deletions src/lib/rnp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3132,14 +3132,17 @@ rnp_verify_dest_provider(pgp_parse_handler_t *handler,
const char * filename,
uint32_t mtime)
{
RNP_LOG("here");
rnp_op_verify_t op = (rnp_op_verify_t) handler->param;
if (!op->output) {
RNP_LOG("here");
return false;
}
*dst = &(op->output->dst);
*closedst = false;
op->filename = filename ? std::string(filename) : "";
op->file_mtime = mtime;
RNP_LOG("here");
return true;
}

Expand Down
12 changes: 11 additions & 1 deletion src/librepgp/stream-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,18 @@
src_read(pgp_source_t *src, void *buf, size_t len, size_t *readres)
{
size_t left = len;
size_t read;
size_t read = 0;
pgp_source_cache_t *cache = src->cache;
bool readahead = cache ? cache->readahead : false;

if (src->error) {
RNP_LOG("read error");
return false;
}

if (src->eof || (len == 0)) {
*readres = 0;
RNP_LOG("read eof");
return true;
}

Expand Down Expand Up @@ -96,11 +98,14 @@
// If there is no cache or chunk is larger then read directly
if (!src->read(src, buf, left, &read)) {
src->error = 1;
RNP_LOG("here");
return false;
}
// RNP_LOG("here: %p %zu", src->read, read);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
if (!read) {
src->eof = 1;
len = len - left;
RNP_LOG("here: %zu", len);
goto finish;
}
left -= read;
Expand All @@ -109,11 +114,14 @@
// Try to fill the cache to avoid small reads
if (!src->read(src, &cache->buf[0], sizeof(cache->buf), &read)) {
src->error = 1;
RNP_LOG("here");
return false;
}
// RNP_LOG("here: %p %zu", src->read, read);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
if (!read) {
src->eof = 1;
len = len - left;
RNP_LOG("here: %zu", len);
goto finish;
} else if (read < left) {
memcpy(buf, &cache->buf[0], read);
Expand All @@ -133,6 +141,7 @@
if (src->knownsize && (src->readb == src->size)) {
src->eof = 1;
}
//RNP_LOG("read bytes: %zu", len);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
*readres = len;
return true;
}
Expand Down Expand Up @@ -386,6 +395,7 @@
if (rres < 0) {
return false;
}
RNP_LOG("%zu from %zu", (size_t) rres, len);
*readres = rres;
return true;
}
Expand Down
Loading
Loading