Commit abc69bd6 authored by Jason Karns's avatar Jason Karns
Browse files

SHA2 support shouldn't be a pre-req for MD5 checksum verification

parent 018357fe
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -247,8 +247,6 @@ compute_md5() {
}

verify_checksum() {
  # If there's no SHA2 support, return success
  [ -n "$HAS_SHA2_SUPPORT" ] || return 0
  local checksum_command="compute_sha2"

  # If the specified filename doesn't exist, return success
@@ -256,7 +254,7 @@ verify_checksum() {
  [ -e "$filename" ] || return 0

  # If there's no expected checksum, return success
  local expected_checksum=`echo "$2" | tr [A-Z] [a-z]`
  local expected_checksum="$(echo "$2" | tr [A-Z] [a-z])"
  [ -n "$expected_checksum" ] || return 0

  case "${#expected_checksum}" in
@@ -264,6 +262,10 @@ verify_checksum() {
    [ -n "$HAS_MD5_SUPPORT" ] || return 0
    checksum_command="compute_md5"
    ;;
  64) # SHA2 256
    [ -n "$HAS_SHA2_SUPPORT" ] || return 0
    checksum_command="compute_sha2"
    ;;
  esac

  # If the computed checksum is empty, return failure