diff options
author | Fabian Groffen <grobian@gentoo.org> | 2024-01-01 14:17:56 +0100 |
---|---|---|
committer | Fabian Groffen <grobian@gentoo.org> | 2024-01-01 14:17:56 +0100 |
commit | 92920dd0b9efed3e7467b4b18b68df86f9eee9d8 (patch) | |
tree | 25674b47ac1b38d2d5779cac106866bb410adba6 /libq | |
parent | gnulib: update (diff) | |
download | portage-utils-92920dd0b9efed3e7467b4b18b68df86f9eee9d8.tar.gz portage-utils-92920dd0b9efed3e7467b4b18b68df86f9eee9d8.tar.bz2 portage-utils-92920dd0b9efed3e7467b4b18b68df86f9eee9d8.zip |
*: remove WHIRLPOOL hash support
WHIRLPOOL has not been in use since mid 2017, and its support is bound
to be removed from OpenSSL.
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'libq')
-rw-r--r-- | libq/hash.c | 26 | ||||
-rw-r--r-- | libq/hash.h | 14 | ||||
-rw-r--r-- | libq/tree.c | 2 |
3 files changed, 11 insertions, 31 deletions
diff --git a/libq/hash.c b/libq/hash.c index b5aec46..4a1202a 100644 --- a/libq/hash.c +++ b/libq/hash.c @@ -1,5 +1,5 @@ /* - * Copyright 2018-2020 Gentoo Foundation + * Copyright 2018-2024 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 * * Copyright 2018- Fabian Groffen - <grobian@gentoo.org> @@ -15,7 +15,6 @@ #ifdef HAVE_SSL # include <openssl/md5.h> # include <openssl/sha.h> -# include <openssl/whrlpool.h> #else # include "hash_md5_sha1.h" #endif @@ -120,7 +119,6 @@ hash_multiple_file_fd( char *sha1, char *sha256, char *sha512, - char *whrlpl, char *blak2b, size_t *flen, int hashes) @@ -133,13 +131,11 @@ hash_multiple_file_fd( SHA_CTX s1; SHA256_CTX s256; SHA512_CTX s512; - WHIRLPOOL_CTX whrl; #else struct md5_ctx_t m5; struct sha1_ctx_t s1; (void)sha256; (void)sha512; - (void)whrlpl; #endif #ifdef HAVE_BLAKE2B blake2b_state bl2b; @@ -156,7 +152,6 @@ hash_multiple_file_fd( SHA1_Init(&s1); SHA256_Init(&s256); SHA512_Init(&s512); - WHIRLPOOL_Init(&whrl); #else md5_begin(&m5); sha1_begin(&s1); @@ -190,11 +185,6 @@ hash_multiple_file_fd( if (hashes & HASH_SHA512) SHA512_Update(&s512, data, len); } -#pragma omp section - { - if (hashes & HASH_WHIRLPOOL) - WHIRLPOOL_Update(&whrl, data, len); - } #else #pragma omp section { @@ -253,14 +243,6 @@ hash_multiple_file_fd( hash_hex(sha512, sha512buf, SHA512_DIGEST_LENGTH); } } -#pragma omp section - { - if (hashes & HASH_WHIRLPOOL) { - unsigned char whrlplbuf[WHIRLPOOL_DIGEST_LENGTH]; - WHIRLPOOL_Final(whrlplbuf, &whrl); - hash_hex(whrlpl, whrlplbuf, WHIRLPOOL_DIGEST_LENGTH); - } - } #else #pragma omp section { @@ -303,7 +285,6 @@ hash_multiple_file_at_cb( char *sha1, char *sha256, char *sha512, - char *whrlpl, char *blak2b, size_t *flen, int hashes) @@ -321,7 +302,7 @@ hash_multiple_file_at_cb( } ret = hash_multiple_file_fd(fd, md5, sha1, sha256, sha512, - whrlpl, blak2b, flen, hashes); + blak2b, flen, hashes); if (ret != 0) close(fd); @@ -340,11 +321,10 @@ hash_file_at_cb(int pfd, const char *fname, int hash, hash_cb_t cb) case HASH_SHA1: case HASH_SHA256: case HASH_SHA512: - case HASH_WHIRLPOOL: case HASH_BLAKE2B: if (hash_multiple_file_at_cb(pfd, fname, cb, _hash_file_buf, _hash_file_buf, _hash_file_buf, - _hash_file_buf, _hash_file_buf, _hash_file_buf, + _hash_file_buf, _hash_file_buf, &dummy, hash) != 0) return NULL; break; diff --git a/libq/hash.h b/libq/hash.h index f85080d..fb4ab5f 100644 --- a/libq/hash.h +++ b/libq/hash.h @@ -18,7 +18,7 @@ enum hash_impls { HASH_SHA1 = 1<<1, HASH_SHA256 = 1<<2, HASH_SHA512 = 1<<3, - HASH_WHIRLPOOL = 1<<4, + HASH_WHIRLPOOL = 1<<4, /* removed */ HASH_BLAKE2B = 1<<5 }; @@ -32,15 +32,15 @@ typedef int (*hash_cb_t) (int, const char *); void hash_hex(char *out, const unsigned char *buf, const int length); int hash_multiple_file_fd( int fd, char *md5, char *sha1, char *sha256, char *sha512, - char *whrlpl, char *blak2b, size_t *flen, int hashes); + char *blak2b, size_t *flen, int hashes); int hash_multiple_file_at_cb( int pfd, const char *fname, hash_cb_t cb, char *md5, - char *sha1, char *sha256, char *sha512, char *whrlpl, + char *sha1, char *sha256, char *sha512, char *blak2b, size_t *flen, int hashes); -#define hash_multiple_file(f, m, s1, s2, s5, w, b, l, h) \ - hash_multiple_file_at_cb(AT_FDCWD, f, NULL, m, s1, s2, s5, w, b, l, h) -#define hash_compute_file(f, s2, s5, w, b, l, h) \ - hash_multiple_file_at_cb(AT_FDCWD, f, NULL, NULL, NULL, s2, s5, w, b, l, h) +#define hash_multiple_file(f, m, s1, s2, s5, b, l, h) \ + hash_multiple_file_at_cb(AT_FDCWD, f, NULL, m, s1, s2, s5, b, l, h) +#define hash_compute_file(f, s2, s5, b, l, h) \ + hash_multiple_file_at_cb(AT_FDCWD, f, NULL, NULL, NULL, s2, s5, b, l, h) char *hash_file_at_cb(int pfd, const char *filename, int hash_algo, hash_cb_t cb); #define hash_file(f, h) hash_file_at_cb(AT_FDCWD, f, h, NULL) #define hash_file_at(fd, f, h) hash_file_at_cb(fd, f, h, NULL) diff --git a/libq/tree.c b/libq/tree.c index 1922b7d..15d8267 100644 --- a/libq/tree.c +++ b/libq/tree.c @@ -1075,7 +1075,7 @@ tree_read_file_binpkg(tree_pkg_ctx *pkg_ctx) lseek(newfd, 0, SEEK_SET); /* reposition at the whole file */ if (hash_multiple_file_fd(newfd, NULL, m->Q_SHA1, NULL, NULL, - NULL, NULL, &fsize, HASH_SHA1) == 0) + NULL, &fsize, HASH_SHA1) == 0) snprintf(m->Q_SIZE, 19 + 1, "%zu", fsize); } |