Bury the last remains of non-header signatures into lead

Header signatures were the new hot almost exactly twenty years ago, we
haven't supported anything else in a very, very, very, very very long time.
Drop the useless argument to rpmReadSignature() and bury the last remaining
related constant into rpmlead.c which is the only place that "needs" it.
No functional changes.
This commit is contained in:
Panu Matilainen 2016-10-24 08:38:26 +03:00
parent 149a8cf341
commit 0cc5ee83f1
6 changed files with 9 additions and 17 deletions

View File

@ -544,7 +544,7 @@ static rpmRC rpmpkgRead(rpmKeyring keyring, rpmVSFlags vsflags,
}
/* Read the signature header. */
rc = rpmReadSignature(fd, &sigh, RPMSIGTYPE_HEADERSIG, msg);
rc = rpmReadSignature(fd, &sigh, msg);
if (rc != RPMRC_OK) {
goto exit;

View File

@ -258,7 +258,7 @@ static int rpmpkgVerifySigs(rpmKeyring keyring, rpmQueryFlags flags,
goto exit;
}
rc = rpmReadSignature(fd, &sigh, RPMSIGTYPE_HEADERSIG, &msg);
rc = rpmReadSignature(fd, &sigh, &msg);
if (rc != RPMRC_OK) {
goto exit;

View File

@ -17,6 +17,9 @@
#include "debug.h"
/* A long time ago in a galaxy far far away, signatures were not in a header */
#define RPMSIGTYPE_HEADERSIG 5
static unsigned char const lead_magic[] = {
RPMLEAD_MAGIC0, RPMLEAD_MAGIC1, RPMLEAD_MAGIC2, RPMLEAD_MAGIC3
};

View File

@ -133,7 +133,7 @@ static inline rpmRC printSize(FD_t fd, size_t siglen, size_t pad, rpm_loff_t dat
return RPMRC_OK;
}
rpmRC rpmReadSignature(FD_t fd, Header * sighp, sigType sig_type, char ** msg)
rpmRC rpmReadSignature(FD_t fd, Header * sighp, char ** msg)
{
char *buf = NULL;
int32_t block[4];
@ -151,9 +151,6 @@ rpmRC rpmReadSignature(FD_t fd, Header * sighp, sigType sig_type, char ** msg)
if (sighp)
*sighp = NULL;
if (sig_type != RPMSIGTYPE_HEADERSIG)
goto exit;
memset(block, 0, sizeof(block));
if ((xx = Freadall(fd, block, sizeof(block))) != sizeof(block)) {
rasprintf(&buf, _("sigh size(%d): BAD, read returned %d"),

View File

@ -8,13 +8,6 @@
#include <rpm/header.h>
/** \ingroup signature
* Signature types stored in rpm lead.
*/
typedef enum sigType_e {
RPMSIGTYPE_HEADERSIG= 5 /*!< Header style signature */
} sigType;
enum {
RPMSIG_UNKNOWN_TYPE = 0,
RPMSIG_DIGEST_TYPE = 1,
@ -43,11 +36,10 @@ Header rpmNewSignature(void);
* If an old-style signature is found, we emulate a new style one.
* @param fd file handle
* @retval sighp address of (signature) header (or NULL)
* @param sig_type type of signature header to read (from lead)
* @retval msg failure msg
* @return rpmRC return code
*/
rpmRC rpmReadSignature(FD_t fd, Header *sighp, sigType sig_type, char ** msg);
rpmRC rpmReadSignature(FD_t fd, Header *sighp, char ** msg);
/** \ingroup signature
* Write signature header.

View File

@ -538,7 +538,7 @@ static rpmRC replaceSigDigests(FD_t fd, const char *rpm, Header *sigp,
}
headerFree(*sigp);
rc = rpmReadSignature(fd, sigp, RPMSIGTYPE_HEADERSIG, NULL);
rc = rpmReadSignature(fd, sigp, NULL);
if (rc != RPMRC_OK) {
rpmlog(RPMLOG_ERR, _("rpmReadSignature failed\n"));
goto exit;
@ -708,7 +708,7 @@ static int rpmSign(const char *rpm, int deleting, int signfiles)
}
sigStart = Ftell(fd);
rc = rpmReadSignature(fd, &sigh, RPMSIGTYPE_HEADERSIG, &msg);
rc = rpmReadSignature(fd, &sigh, &msg);
if (rc != RPMRC_OK) {
rpmlog(RPMLOG_ERR, _("%s: rpmReadSignature failed: %s"), rpm,
(msg && *msg ? msg : "\n"));