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

@@ -39,11 +39,12 @@
static int
remove_pkg(const char *repodir, const char *file)
{
char *filepath, *sigpath;
char *filepath, *sigpath, *sig2path;
int rv = 0;
filepath = xbps_xasprintf("%s/%s", repodir, file);
sigpath = xbps_xasprintf("%s.sig", filepath);
sig2path = xbps_xasprintf("%s.sig2", filepath);
if (remove(filepath) == -1) {
if (errno != ENOENT) {
rv = errno;
@@ -55,10 +56,18 @@ remove_pkg(const char *repodir, const char *file)
if (errno != ENOENT) {
rv = errno;
xbps_error_printf("xbps-rindex: failed to remove "
"package signature `%s': %s\n", sigpath, strerror(rv));
"legacy package signature `%s': %s\n", sigpath, strerror(rv));
}
}
if (remove(sig2path) == -1) {
if (errno != ENOENT) {
rv = errno;
xbps_error_printf("xbps-rindex: failed to remove "
"package signature `%s': %s\n", sig2path, strerror(rv));
}
}
free(sigpath);
free(sig2path);
free(filepath);
return rv;