From: "Fabian Groffen" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage-utils:master commit in: /, libq/
Date: Sun, 14 Jul 2019 13:09:44 +0000 (UTC) [thread overview]
Message-ID: <1563106208.2e4b280488b5f030a6e735060bb73667d1533fab.grobian@gentoo> (raw)
commit: 2e4b280488b5f030a6e735060bb73667d1533fab
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 14 12:10:08 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jul 14 12:10:08 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=2e4b2804
libq/hash: ensure hash_compute_file operates on hashes requested
thinko probably due to extraction from hashgen at some point, pass
hashes with the function call, so it operates on the hashes the caller
wants it to.
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
libq/hash.c | 5 ++---
libq/hash.h | 2 +-
qmanifest.c | 4 ++--
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/libq/hash.c b/libq/hash.c
index 32d047a..6d0a62b 100644
--- a/libq/hash.c
+++ b/libq/hash.c
@@ -22,8 +22,6 @@
#include "hash.h"
-static int hashes = HASH_DEFAULT;
-
void
hash_hex(char *out, const unsigned char *buf, const int length)
{
@@ -97,7 +95,8 @@ hash_compute_file(
char *sha512,
char *whrlpl,
char *blak2b,
- size_t *flen)
+ size_t *flen,
+ int hashes)
{
FILE *f;
char data[8192];
diff --git a/libq/hash.h b/libq/hash.h
index 157c454..89f3841 100644
--- a/libq/hash.h
+++ b/libq/hash.h
@@ -21,6 +21,6 @@ enum hash_impls {
void hash_hex(char *out, const unsigned char *buf, const int length);
void hash_compute_file(const char *fname, char *sha256, char *sha512,
- char *whrlpl, char *blak2b, size_t *flen);
+ char *whrlpl, char *blak2b, size_t *flen, int hashes);
#endif
diff --git a/qmanifest.c b/qmanifest.c
index 21254c3..41faa4c 100644
--- a/qmanifest.c
+++ b/qmanifest.c
@@ -201,7 +201,7 @@ write_hashes(
update_times(tv, &s);
- hash_compute_file(fname, sha256, sha512, whrlpl, blak2b, &flen);
+ hash_compute_file(fname, sha256, sha512, whrlpl, blak2b, &flen, hashes);
len = snprintf(data, sizeof(data), "%s %s %zd", type, name, flen);
if (hashes & HASH_BLAKE2B)
@@ -1027,7 +1027,7 @@ verify_file(const char *dir, char *mfline, const char *mfest, verify_msg **msgs)
sha256[0] = sha512[0] = whrlpl[0] = blak2b[0] = '\0';
snprintf(buf, sizeof(buf), "%s/%s", dir, path);
- hash_compute_file(buf, sha256, sha512, whrlpl, blak2b, &flen);
+ hash_compute_file(buf, sha256, sha512, whrlpl, blak2b, &flen, hashes);
if (flen == 0) {
msgs_add(msgs, mfest, path, "cannot open file!");
next reply other threads:[~2019-07-14 13:09 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-14 13:09 Fabian Groffen [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-01-02 7:57 [gentoo-commits] proj/portage-utils:master commit in: /, libq/ Fabian Groffen
2020-05-16 18:27 Fabian Groffen
2020-01-05 16:08 Fabian Groffen
2020-01-04 19:48 Fabian Groffen
2020-01-01 17:54 Fabian Groffen
2019-11-15 13:52 Fabian Groffen
2019-05-07 6:19 Fabian Groffen
2019-05-06 17:33 Fabian Groffen
2019-05-02 15:48 Fabian Groffen
2018-05-18 16:58 Fabian Groffen
2016-12-29 2:25 Mike Frysinger
2016-12-29 2:25 Mike Frysinger
2016-02-14 1:26 Mike Frysinger
2016-02-14 1:26 Mike Frysinger
2015-11-28 2:44 Mike Frysinger
2015-11-28 2:44 Mike Frysinger
2015-02-24 1:26 Mike Frysinger
2014-03-21 5:32 Mike Frysinger
2014-03-10 8:45 Mike Frysinger
2014-03-10 6:00 Mike Frysinger
2014-03-08 5:51 Mike Frysinger
2014-03-08 5:51 Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1563106208.2e4b280488b5f030a6e735060bb73667d1533fab.grobian@gentoo \
--to=grobian@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox