lib/, bin/: fix signature type, now called *.sig2

Since 8d5c48b, xbps has used a sha1 ASN1 prefix with a sha256 hash, and
as of openssl v3, openssl cares about this. This works around that in a
compatible way by moving to a second sig file, binpkg.sig2.

For xbps-remove -O and xbps-rindex -r, also clean up obselete .sig files.
This commit is contained in:
classabbyamp
2023-08-08 00:36:10 -04:00
committed by Duncan Overbruck
parent e2ab72082e
commit 406f109100
7 changed files with 31 additions and 21 deletions

View File

@@ -405,15 +405,15 @@ xbps_remote_binpkg_exists(struct xbps_handle *xhp, xbps_dictionary_t pkgd)
"architecture", &arch))
return NULL;
snprintf(path, sizeof(path), "%s/%s.%s.xbps.sig", xhp->cachedir,
snprintf(path, sizeof(path), "%s/%s.%s.xbps.sig2", xhp->cachedir,
pkgver, arch);
/* check if the signature file exists */
if (access(path, R_OK) != 0)
return false;
/* strip the .sig suffix and check if binpkg file exists */
path[strlen(path)-sizeof (".sig")+1] = '\0';
/* strip the .sig2 suffix and check if binpkg file exists */
path[strlen(path)-sizeof (".sig2")+1] = '\0';
return access(path, R_OK) == 0;
}