diff options
author | Allan McRae <allan@archlinux.org> | 2016-09-25 19:30:51 +1000 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2016-10-10 10:38:04 +1000 |
commit | 87ee9693bd70ad5b17b9542fa67a1a58cd0f7c29 (patch) | |
tree | fc2b16ea43849b01fde1d2bcbcf81cfd917201e9 /lib/libalpm | |
parent | 05e1b8de1a96526c4e59745e7e4dc4a83a6383dd (diff) | |
download | pacman-87ee9693bd70ad5b17b9542fa67a1a58cd0f7c29.tar.xz |
Remove SHA224 support
This was included due to use of PolarSSL's implementation for our internal
SHA2 support. As our internal checksum calculations are now removed, we
can also remove this unused code path.
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/util.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 3b7c3bc9..7ef4bf34 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -897,14 +897,12 @@ static int md5_file(const char *path, unsigned char output[16]) return 0; } -/* third param is so we match the PolarSSL definition */ -/** Compute the SHA-224 or SHA-256 message digest of a file. - * @param path file path of file to compute SHA2 digest of - * @param output string to hold computed SHA2 digest - * @param is224 use SHA-224 instead of SHA-256 +/** Compute the SHA-256 message digest of a file. + * @param path file path of file to compute SHA256 digest of + * @param output string to hold computed SHA256 digest * @return 0 on success, 1 on file open error, 2 on file read error */ -static int sha2_file(const char *path, unsigned char output[32], int is224) +static int sha256_file(const char *path, unsigned char output[32]) { SHA256_CTX ctx; unsigned char *buf; @@ -919,21 +917,13 @@ static int sha2_file(const char *path, unsigned char output[32], int is224) return 1; } - if(is224) { - SHA224_Init(&ctx); - } else { - SHA256_Init(&ctx); - } + SHA256_Init(&ctx); while((n = read(fd, buf, ALPM_BUFFER_SIZE)) > 0 || errno == EINTR) { if(n < 0) { continue; } - if(is224) { - SHA224_Update(&ctx, buf, n); - } else { - SHA256_Update(&ctx, buf, n); - } + SHA256_Update(&ctx, buf, n); } close(fd); @@ -943,11 +933,7 @@ static int sha2_file(const char *path, unsigned char output[32], int is224) return 2; } - if(is224) { - SHA224_Final(output, &ctx); - } else { - SHA256_Final(output, &ctx); - } + SHA256_Final(output, &ctx); return 0; } #endif @@ -1005,7 +991,7 @@ char SYMEXPORT *alpm_compute_sha256sum(const char *filename) ASSERT(filename != NULL, return NULL); - if(sha2_file(filename, output, 0) > 0) { + if(sha256_file(filename, output) > 0) { return NULL; } |