diff options
author | Norbert Preining <preining@logic.at> | 2016-04-12 06:07:40 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2016-04-12 06:07:40 +0000 |
commit | dd4bdccfb5d96b72900478b3d07651d6b7382e6a (patch) | |
tree | 5cf7dbac2f95bbefad89028f3d37a1aa368da687 /Master/texmf-dist/scripts | |
parent | e4ea0d46df62e587ae70e6ab7711ac1c013bef32 (diff) |
replace sha256 with generic checksum
We use tldigest($string) or tlchecksum($file) to generate checksum.
The algorithm can be changed at any time provided that tldigest
and tlchecksum (in TLUtils) and the setting TLConfig::ChecksumLength
are kept in sync.
git-svn-id: svn://tug.org/texlive/trunk@40429 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/tlmgr.pl | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index 13da7e23c30..bbfaecc872a 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -5837,7 +5837,7 @@ sub setup_one_remotetlpdb { my $local_copy_tlpdb_used = 0; if ($location =~ m;^(http|ftp)://;) { # first check that the saved tlpdb is present at all - my $loc_digest = Digest::SHA::sha256_hex($location); + my $loc_digest = TeXLive::TLUtils::tldigest($location); my $loc_copy_of_remote_tlpdb = "$Master/$InfraLocation/texlive.tlpdb.$loc_digest"; ddebug("loc_digest = $loc_digest\n"); @@ -5846,11 +5846,11 @@ sub setup_one_remotetlpdb { ddebug("loc copy found!\n"); # we found the tlpdb matching the current location # check for the remote hash - my $path = "$location/$InfraLocation/$DatabaseName.sha256"; + my $path = "$location/$InfraLocation/$DatabaseName.checksum"; ddebug("remote path of digest = $path\n"); my $fh = TeXLive::TLUtils::download_file($path, "|"); my $rem_digest; - if (read ($fh, $rem_digest, 64) != 64) { + if (read ($fh, $rem_digest, $ChecksumLength) != $ChecksumLength) { info(<<END_NO_INTERNET); No connection to the internet. Unable to download the checksum of the remote TeX Live database, @@ -5869,10 +5869,10 @@ END_NO_INTERNET $local_copy_tlpdb_used = 1; } else { ddebug("found remote digest: $rem_digest\n"); - my $rem_copy_digest = TeXLive::TLUtils::tlsha256($loc_copy_of_remote_tlpdb); + my $rem_copy_digest = TeXLive::TLUtils::tlchecksum($loc_copy_of_remote_tlpdb); ddebug("rem_copy_digest = $rem_copy_digest\n"); if ($rem_copy_digest eq $rem_digest) { - debug("sha256 of local copy identical with remote hash\n"); + debug("checksum of local copy identical with remote hash\n"); $remotetlpdb = TeXLive::TLPDB->new(root => $location, tlpdbfile => $loc_copy_of_remote_tlpdb); $local_copy_tlpdb_used = 1; @@ -5882,9 +5882,9 @@ END_NO_INTERNET } if (!$local_copy_tlpdb_used) { # TODO verification - # here we should add code to download the remote .sha256.gpg (.asc?) + # here we should add code to download the remote .checksum.gpg (.asc?) # and verify it. - my $path = "$location/$InfraLocation/$DatabaseName.sha256.asc"; + my $path = "$location/$InfraLocation/$DatabaseName.checksum.asc"; my $fh = TeXLive::TLUtils::download_file($path, "|"); # TODO verify ... $remotetlpdb = TeXLive::TLPDB->new(root => $location); @@ -5963,9 +5963,9 @@ FROZEN # save remote database if it is a net location # make sure that the writeout of the tlpdb is done in UNIX mode - # since otherwise the sha256 will change. + # since otherwise the checksum will change. if (!$local_copy_tlpdb_used && $location =~ m;^(http|ftp)://;) { - my $loc_digest = Digest::SHA::sha256_hex($location); + my $loc_digest = TeXLive::TLUtils::tldigest($location); my $loc_copy_of_remote_tlpdb = "$Master/$InfraLocation/texlive.tlpdb.$loc_digest"; my $tlfh; |