Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts/libmakepkg/integrity
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2016-10-11 23:04:25 +1000
committerAllan McRae <allan@archlinux.org>2016-10-22 20:50:55 +1000
commit577701250d645d1fc1a505cde34aedbeb3208ea5 (patch)
tree779183b41b3a84fd012a4dbb38337aed00ad0025 /scripts/libmakepkg/integrity
parent603f087cd73aff0d39bf0ebfb23aaae5626cb814 (diff)
Use coreutils binaries for checking/generating checksums
If pacman is build against a crypto library other than openssl, it makes no sense to require makepkg to use it. The only currently considered alternative to openssl is nettle, which has no binary for base64 encode/decode. This means that we could replace the hashing cacluations with nettle-hash, but would require base64 from coreutils. Given makepkg already relies heavily on coreutils, we might as well use all the coreutils hashing binaries too. This patch also improves the checking of required binaries for hashing operations. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/libmakepkg/integrity')
-rw-r--r--scripts/libmakepkg/integrity/generate_checksum.sh.in9
-rw-r--r--scripts/libmakepkg/integrity/verify_checksum.sh.in4
2 files changed, 4 insertions, 9 deletions
diff --git a/scripts/libmakepkg/integrity/generate_checksum.sh.in b/scripts/libmakepkg/integrity/generate_checksum.sh.in
index 7a567100..b61f2281 100644
--- a/scripts/libmakepkg/integrity/generate_checksum.sh.in
+++ b/scripts/libmakepkg/integrity/generate_checksum.sh.in
@@ -59,8 +59,8 @@ generate_one_checksum() {
if [[ $netfile != *.@(sig?(n)|asc) ]]; then
local file
file="$(get_filepath "$netfile")" || missing_source_file "$netfile"
- sum="$(openssl dgst -${integ} "$file")"
- sum=${sum##* }
+ sum="$("${integ}sum" "$file")"
+ sum=${sum%% *}
else
sum="SKIP"
fi
@@ -80,11 +80,6 @@ generate_one_checksum() {
generate_checksums() {
msg "$(gettext "Generating checksums for source files...")"
- if ! type -p openssl >/dev/null; then
- error "$(gettext "Cannot find the %s binary required for generating sourcefile checksums.")" "openssl"
- exit 1 # $E_MISSING_PROGRAM
- fi
-
local integlist
if (( $# == 0 )); then
IFS=$'\n' read -rd '' -a integlist < <(get_integlist)
diff --git a/scripts/libmakepkg/integrity/verify_checksum.sh.in b/scripts/libmakepkg/integrity/verify_checksum.sh.in
index 44a2b2e1..5830aff3 100644
--- a/scripts/libmakepkg/integrity/verify_checksum.sh.in
+++ b/scripts/libmakepkg/integrity/verify_checksum.sh.in
@@ -82,8 +82,8 @@ verify_integrity_one() {
return 1
fi
- local realsum="$(openssl dgst -${integ} "$file")"
- realsum="${realsum##* }"
+ local realsum="$("${integ}sum" "$file")"
+ realsum="${realsum%% *}"
if [[ ${expectedsum,,} = "$realsum" ]]; then
printf '%s\n' "$(gettext "Passed")" >&2
else