8 #if defined(HAVE_MACHINE_TYPES_H)
9 # include <machine/types.h>
12 #include <netinet/in.h>
14 #define _RPMIOB_INTERNAL
20 #define _RPMHKP_INTERNAL
24 #define _RPMTAG_INTERNAL
30 #define _RPMTS_INTERNAL
63 #define timedRead (ufdio->read)
85 fprintf(stderr,
"--> rpmWriteHeader(%p, %p, %p)\n", fd, h, msg);
89 *msg =
xstrdup(
_(
"write of NULL header"));
96 *msg =
xstrdup(
_(
"headerUnload failed"));
100 {
unsigned char * hmagic =
NULL;
104 nb =
Fwrite(hmagic,
sizeof(hmagic[0]), nmagic, fd);
105 if (nb != nmagic ||
Ferror(fd)) {
108 ?
xstrdup(
_(
"short write of header magic"))
115 nb =
Fwrite(uh,
sizeof(
char), length, fd);
117 if (nb != length ||
Ferror(fd)) {
120 ?
xstrdup(
_(
"short write of header"))
169 const char * pubkeysource =
NULL;
178 fprintf(stderr,
"--> %s(%p,%p)\n", __FUNCTION__, ts, _dig);
187 ts->hkp = rpmhkpNew(
NULL, 0);
188 hkp = rpmhkpLink(ts->hkp);
189 awol = rpmbfLink(hkp->awol);
193 fprintf(stderr,
"==> find sig id %08x %08x ts pubkey id %08x %08x\n",
199 if (memcmp(sigp->signid, hkp->signid,
sizeof(hkp->signid))) {
202 fprintf(stderr,
"*** free pkt %p[%d] id %08x %08x\n", hkp->pkt, hkp->pktlen,
pgpGrab(hkp->signid, 4),
pgpGrab(hkp->signid+4, 4));
204 hkp->pkt =
_free(hkp->pkt);
206 memset(hkp->signid, 0,
sizeof(hkp->signid));
210 if (hkp->pkt ==
NULL && awol !=
NULL
211 && rpmbfChk(awol, sigp->signid,
sizeof(sigp->signid)))
215 if (hkp->pkt ==
NULL) {
227 memcpy(
xmalloc(iob->blen), iob->b, iob->blen);
228 hkp->pktlen = iob->blen;
229 pubkeysource =
xstrdup(
"keyutils");
234 fprintf(stderr,
"\t%s: rpmku %p[%u]\n", __FUNCTION__, hkp->pkt, (
unsigned) hkp->pktlen);
238 if (hkp->pkt ==
NULL) {
239 unsigned hx = 0xffffffff;
240 unsigned ix = 0xffffffff;
245 if (ts->rdb ==
NULL) {
246 xx =
rpmdbOpen(ts->rootDir, &ts->rdb, ts->dbmode, (mode_t)0644);
250 _(
"cannot open Packages database in %s\n"), dn);
270 if (b64decode(he->
p.
argv[ix], (
void **)&hkp->pkt, &hkp->pktlen))
279 if (ix < 0xffffffff) {
281 sprintf(hnum,
"h#%u[%u]", hx, ix);
285 hkp->pkt =
_free(hkp->pkt);
289 fprintf(stderr,
"\t%s: rpmdb %p[%u]\n", __FUNCTION__, hkp->pkt, (
unsigned) hkp->pktlen);
293 if (hkp->pkt ==
NULL && dig->pub && dig->publen > 0) {
297 if (!memcmp(sigp->signid, keyid,
sizeof(keyid))) {
298 hkp->pkt = (uint8_t *) dig->pub; dig->pub =
NULL;
299 hkp->pktlen = dig->publen; dig->publen = 0;
300 pubkeysource =
xstrdup(
"package");
303 fprintf(stderr,
"\t%s: auto %p[%u]\n", __FUNCTION__, hkp->pkt, (
unsigned) hkp->pktlen);
308 if (hkp->pkt ==
NULL) {
309 const char *
fn =
rpmExpand(
"%{_hkp_keyserver_query}",
"0x",
312 xx = (fn && *fn !=
'%')
317 hkp->pkt =
_free(hkp->pkt);
321 pubkeysource =
xstrdup(
"keyserver");
325 fprintf(stderr,
"\t%s: rpmhkp %p[%u]\n", __FUNCTION__, hkp->pkt, (
unsigned) hkp->pktlen);
330 if (hkp->pkt ==
NULL) {
334 if (fn && *fn !=
'%')
338 hkp->pkt =
_free(hkp->pkt);
341 pubkeysource =
xstrdup(
"macro");
347 if (hkp->pkt ==
NULL || hkp->pktlen == 0)
350 fprintf(stderr,
"\t%s: match %p[%u]\n", __FUNCTION__, hkp->pkt, (
unsigned) hkp->pktlen);
353 hkp->pkts =
_free(hkp->pkts);
355 xx =
pgpGrabPkts(hkp->pkt, hkp->pktlen, &hkp->pkts, &hkp->npkts);
359 memcpy(pubp->signid, hkp->keyid,
sizeof(pubp->signid));
376 fprintf(stderr,
"*** rpmhkpValidate: validate %d rc %d\n", validate, rc);
383 xx = rpmhkpFindKey(hkp, dig, sigp->signid, sigp->pubkey_algo);
387 _rpmhkpDumpDig(__FUNCTION__, dig);
391 if (sigp->pubkey_algo == pubp->pubkey_algo
392 && !memcmp(sigp->signid, pubp->signid,
sizeof(sigp->signid)) )
399 iob->b = (
rpmuint8_t *)memcpy(iob->b, hkp->pkt, iob->blen);
403 fprintf(stderr,
"\t%s: rpmku %p[%u]\n", __FUNCTION__, hkp->pkt, (
unsigned) hkp->pktlen);
407 memcpy(hkp->signid, pubp->signid,
sizeof(hkp->signid));
422 pubkeysource =
_free(pubkeysource);
424 hkp->pkt =
_free(hkp->pkt);
427 xx = rpmbfAdd(awol, sigp->signid,
sizeof(sigp->signid));
431 (
void) rpmbfFree(awol);
432 (
void) rpmhkpFree(hkp);
435 fprintf(stderr,
"<-- %s(%p,%p) res %d\n", __FUNCTION__, ts, _dig, res);
445 if (ts->dig ==
NULL) {
496 0xed, 0xab, 0xee, 0xdb, 0x00, 0x00, 0x00, 0x00
516 fprintf(stderr,
"--> wrLead(%p, %p, %p)\n", fd, ptr, msg);
518 memcpy(&l, ptr,
sizeof(l));
521 if ((
int)l.
major == 0)
522 l.
major = (
unsigned char) 3;
528 memcpy(&l.
magic, lead_magic,
sizeof(l.
magic));
529 l.
type = (
unsigned short) htons(l.
type);
534 if (
Fwrite(&l, 1,
sizeof(l),
fd) !=
sizeof(l))
560 fprintf(stderr,
"--> rdLead(%p, %p, %p)\n", fd, ptr, msg);
566 if ((xx = (
int)
timedRead(fd, (
char *)l,
sizeof(*l))) != (
int)
sizeof(*l)) {
569 _(
"lead size(%u): BAD, read(%d), %s(%d)"),
574 _(
"lead size(%u): BAD, read(%d), %s(%d)"),
583 unsigned char * bh = (
unsigned char *)l;
584 if (bh[0] ==
'x' && bh[1] ==
'a' && bh[2] ==
'r' && bh[3] ==
'!') {
596 unsigned char *
b =
NULL;
598 const char item[] =
"Lead";
601 _(
"XAR file not found (or no XAR support)"));
606 if (nb !=
sizeof(*l)) {
608 _(
"lead size(%u): BAD, xar read(%u)"),
618 l->
type = (
unsigned short) ntohs(l->
type);
623 if (memcmp(l->
magic, lead_magic,
sizeof(l->
magic))) {
658 if (msg !=
NULL && buf[0] !=
'\0') {
659 buf[
sizeof(
buf)-1] =
'\0';
680 static unsigned char zero[8]
681 = {
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0' };
687 fprintf(stderr,
"--> wrSignature(%p, %p, %p)\n", fd, ptr, msg);
694 pad = (8 - (sigSize % 8)) % 8;
696 if (
Fwrite(zero,
sizeof(zero[0]), pad,
fd) != pad)
715 struct stat sb, *
st = &sb;
722 if (fdno == 123456789) {
725 st->st_size -= nl + siglen + pad + datalen;
729 if (
Fstat(fd, st) < 0)
732 expected = nl + siglen + pad + datalen;
734 D_(
"Expected size: %12lu = lead(%u)+sigs(%u)+pad(%u)+data(%lu)\n"),
735 (
unsigned long)expected,
736 (
unsigned)nl, (
unsigned) siglen, (
unsigned) pad,
737 (
unsigned long)datalen);
739 D_(
" Actual size: %12lu\n"), (
unsigned long)st->st_size);
772 unsigned char * dataStart;
773 unsigned char * dataEnd =
NULL;
781 fprintf(stderr,
"--> rdSignature(%p, %p, %p)\n", fd, ptr, msg);
787 memset(block, 0,
sizeof(block));
789 const char item[] =
"Signature";
792 _(
"XAR file not found (or no XAR support)"));
798 if ((xx = (
int)
timedRead(fd, (
char *)block,
sizeof(block))) != (
int)
sizeof(block)) {
800 _(
"sigh size(%d): BAD, read returned %d"), (
int)
sizeof(block),
xx);
804 {
unsigned char * hmagic =
NULL;
809 if (memcmp(block, hmagic, nmagic)) {
810 unsigned char * x = (
unsigned char *)block;
812 (
void)
snprintf(buf,
sizeof(buf),
_(
"sigh magic: BAD, read %02x%02x%02x%02x%02x%02x%02x%02x"), x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]);
820 _(
"sigh tags: BAD, no. of tags(%u) out of range"), (
unsigned) il);
826 _(
"sigh data: BAD, no. of bytes(%u) out of range"), (
unsigned) dl);
834 size_t pvlen = (
sizeof(il) +
sizeof(dl) +
nb);
835 static const int prot = PROT_READ | PROT_WRITE;
836 static const int flags = MAP_PRIVATE| MAP_ANONYMOUS;
837 static const int fdno = -1;
838 static const off_t off = 0;
841 if (ei ==
NULL || ei == (
void *)-1)
843 "==> mmap(%p[%u], 0x%x, 0x%x, %d, 0x%x) error(%d): %s\n",
847 size_t pvlen = (
sizeof(il) +
sizeof(dl) +
nb);
851 if ((xx = (
int)
timedRead(fd, (
char *)&ei[2], nb)) != (
int)
nb) {
853 _(
"sigh blob(%u): BAD, read returned %d"), (
unsigned) nb, xx);
860 size_t pvlen = (
sizeof(il) +
sizeof(dl) +
nb);
861 if (mprotect(ei, pvlen, PROT_READ) != 0)
862 fprintf(stderr,
"==> mprotect(%p[%u],0x%x) error(%d): %s\n",
863 ei, (
unsigned)pvlen, PROT_READ,
864 errno, strerror(errno));
868 dataStart = (
unsigned char *) (pe + il);
874 _(
"tag[%d]: BAD, tag %u type %u offset %d count %u"),
889 _(
"region tag: BAD, tag %u type %u offset %d count %u"),
903 _(
"region offset: BAD, tag %u type %u offset %d count %u"),
917 memcpy(dataEnd, &stag,
sizeof(stag));
928 _(
"region trailer: BAD, tag %u type %u offset %d count %u"),
934 memset(info, 0,
sizeof(*info));
938 if ((entry->
info.
offset %
sizeof(*pe)) || ril > il) {
940 _(
"region size: BAD, ril(%u) > il(%u)"), (
unsigned) ril, (
unsigned) il);
946 memset(info, 0,
sizeof(*info));
947 for (i = 1; i < (
unsigned) il; i++) {
951 _(
"sigh tag[%u]: BAD, tag %u type %u offset %d count %u"),
972 size_t pad = (8 - (sigSize % 8)) % 8;
975 if (pad && (xx = (
int)
timedRead(fd, (
char *)block, pad)) != (
int) pad)
978 _(
"sigh pad(%u): BAD, read %d bytes"), (
unsigned) pad, xx);
987 size_t datasize = he->
p.
ui32p[0];
988 rc =
printSize(fd, sigSize, pad, datasize);
991 _(
"sigh sigSize(%u): BAD, Fstat(2) failed"), (
unsigned) sigSize);
999 if (sighp && sigh && rc ==
RPMRC_OK)
1005 buf[
sizeof(
buf)-1] =
'\0';
1037 size_t pvlen =
sizeof(ildl) + (il *
sizeof(*pe)) + dl;
1038 unsigned char * dataStart = (
unsigned char *) (pe + il);
1043 const void * sig =
NULL;
1051 unsigned char * regionEnd =
NULL;
1059 fprintf(stderr,
"--> headerCheck(%p, %p[%u], %p)\n", dig, uh, (
unsigned) uc, msg);
1064 if (uc > 0 && pvlen != uc) {
1066 _(
"blob size(%d): BAD, 8 + 16 * il(%u) + dl(%u)"),
1075 _(
"tag[%d]: BAD, tag %u type %u offset %d count %u"),
1093 _(
"region tag: BAD, tag %u type %u offset %d count %u"),
1103 _(
"region offset: BAD, tag %u type %u offset %d count %u"),
1122 _(
"region trailer: BAD, tag %u type %u offset %d count %u"),
1128 memset(info, 0,
sizeof(*info));
1132 if ((entry->
info.
offset %
sizeof(*pe)) || ril > il) {
1134 _(
"region size: BAD, ril(%u) > il(%u)"), (
unsigned) ril, (
unsigned)il);
1139 for (i = ril; i < (
unsigned) il; i++) {
1143 _(
"tag[%u]: BAD, tag %u type %u offset %d count %u"),
1154 for (b = dataStart + entry->
info.
offset; *b !=
'\0'; b++) {
1155 if (strchr(
"0123456789abcdefABCDEF", *b) ==
NULL)
1161 (
void)
snprintf(buf,
sizeof(buf),
_(
"hdr SHA1: BAD, not hex"));
1164 if (info->
tag == 0) {
1165 *info = entry->
info;
1173 (
void)
snprintf(buf,
sizeof(buf),
_(
"hdr RSA: BAD, not binary"));
1176 *info = entry->
info;
1177 siglen = info->
count;
1183 (
void)
snprintf(buf,
sizeof(buf),
_(
"hdr DSA: BAD, not binary"));
1186 *info = entry->
info;
1187 siglen = info->
count;
1198 buf[
sizeof(
buf)-1] =
'\0';
1201 fprintf(stderr,
"<-- headerCheck #1: rc %d \"%s\"\n", rc, (msg ? *msg:
""));
1206 if (info->
tag == 0) {
1210 _(
"tag[%d]: BAD, tag %u type %u offset %d count %u"),
1215 (
void)
snprintf(buf,
sizeof(buf),
"Header sanity check: OK");
1218 buf[
sizeof(
buf)-1] =
'\0';
1221 fprintf(stderr,
"<-- headerCheck #2: rc %d \"%s\"\n", rc, (msg ? *msg:
""));
1229 sig = memcpy(
xmalloc(siglen), dataStart + info->
offset, siglen);
1238 switch (info->
tag) {
1241 pleft = info->
count;
1243 xx = rpmhkpLoadSignature(
NULL, dig, pp);
1248 _(
"skipping header with unverifiable V%u signature\n"),
1249 (
unsigned) dig->signature.version);
1269 b = (
unsigned char *) ildl;
1274 b = (
unsigned char *) pe;
1275 nb = (size_t) (htonl(ildl[0]) *
sizeof(*pe));
1279 b = (
unsigned char *) dataStart;
1280 nb = (size_t) htonl(ildl[1]);
1288 pleft = info->
count;
1290 xx = rpmhkpLoadSignature(
NULL, dig, pp);
1295 _(
"skipping header with unverifiable V%u signature\n"),
1296 (
unsigned) dig->signature.version);
1317 b = (
unsigned char *) ildl;
1322 b = (
unsigned char *) pe;
1323 nb = (size_t) (htonl(ildl[0]) *
sizeof(*pe));
1327 b = (
unsigned char *) dataStart;
1328 nb = (size_t) htonl(ildl[1]);
1342 buf[
sizeof(
buf)-1] =
'\0';
1346 fprintf(stderr,
"<-- headerCheck #3: rc %d \"%s\"\n", rc, (msg ? *msg:
""));
1360 memcpy(p, ptr,
sizeof(p));
1361 return (8 + 8 + 16 * ntohl(p[2]) + ntohl(p[3]));
1413 const char * origin =
NULL;
1419 fprintf(stderr,
"--> rpmReadHeader(%p, %p, %p)\n", fd, hdrp, msg);
1432 memset(block, 0,
sizeof(block));
1434 const char item[] =
"Header";
1437 _(
"XAR file not found (or no XAR support)"));
1444 if ((xx = (
int)
timedRead(fd, (
char *)block,
sizeof(block))) != (
int)
sizeof(block)) {
1450 _(
"hdr size(%u): BAD, read returned %d"), (
unsigned)
sizeof(block), xx);
1457 if (memcmp(block, b, nb)) {
1458 unsigned char * x = (
unsigned char *) block;
1460 (
void)
snprintf(buf,
sizeof(buf),
_(
"hdr magic: BAD, read %02x%02x%02x%02x%02x%02x%02x%02x"), x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]);
1468 _(
"hdr tags: BAD, no. of tags(%u) out of range"), (
unsigned) il);
1475 _(
"hdr data: BAD, no. of bytes(%u) out of range\n"), (
unsigned) dl);
1482 uc =
sizeof(il) +
sizeof(dl) +
nb;
1484 static const int prot = PROT_READ | PROT_WRITE;
1485 static const int flags = MAP_PRIVATE| MAP_ANONYMOUS;
1486 static const int fdno = -1;
1487 static const off_t off = 0;
1490 if (ei ==
NULL || ei == (
void *)-1)
1492 "==> mmap(%p[%u], 0x%x, 0x%x, %d, 0x%x) error(%d): %s\n",
1499 if ((xx = (
int)
timedRead(fd, (
char *)&ei[2], nb)) != (
int)
nb) {
1501 _(
"hdr blob(%u): BAD, read returned %d"), (
unsigned)nb, xx);
1508 if (mprotect(ei, uc, PROT_READ) != 0)
1509 fprintf(stderr,
"==> mprotect(%p[%u],0x%x) error(%d): %s\n",
1510 ei, (
unsigned)
uc, PROT_READ,
1511 errno, strerror(errno));
1535 if (origin !=
NULL) {
1536 const char * lpath =
NULL;
1537 int ut =
urlPath(origin, &lpath);
1539 if (lpath && *lpath !=
'/') {
1542 rpath =
_free(rpath);
1559 if (ei !=
NULL && uc > 0) {
1561 if (munmap(ei, uc) != 0)
1562 fprintf(stderr,
"==> munmap(%p[%u]) error(%d): %s\n",
1572 if (msg !=
NULL && *msg ==
NULL && buf[0] !=
'\0') {
1573 buf[
sizeof(
buf)-1] =
'\0';
1578 fprintf(stderr,
"<-- rpmReadHeader: rc %d \"%s\"\n", rc, (msg ? *msg:
""));
1626 if (!
strcmp(fn,
"Signature")) {
1628 len += ((8 - (len % 8)) % 8);
1630 if (!
strcmp(fn,
"Header"))
1642 if (!
strcmp(fn,
"Header"))
1655 rc =
rdLead(fd, ptr, msg);
1657 if (!
strcmp(fn,
"Signature"))
1660 if (!
strcmp(fn,
"Header"))
1673 rc =
wrLead(fd, ptr, msg);
1675 if (!
strcmp(fn,
"Signature"))
1678 if (!
strcmp(fn,
"Header"))
Structure(s)and methods for a XAR archive wrapper format.
rpmop rpmtsOp(rpmts ts, rpmtsOpX opx)
Retrieve operation timestamp from a transaction set.
enum pgpPubkeyAlgo_e pgpPubkeyAlgo
9.1.
int pgpGrabPkts(const rpmuint8_t *pkts, size_t pktlen, rpmuint8_t ***pppkts, int *pnpkts)
Return array of packet pointers.
struct rpmdb_s * rpmdb
Database of headers and tag value indices.
rpmlog(RPMLOG_ERR,"%s\n", buf)
static void fdSetXAR(FD_t fd, rpmxar xar)
static rpmRC wrHeader(FD_t fd, void *ptr, const char **msg)
Write metadata header.
rpmtime_t rpmswAdd(rpmop to, rpmop from)
Sum statistic counters.
int pgpPktLen(const rpmuint8_t *pkt, size_t pleft, pgpPkt pp)
static size_t szHeader(const void *ptr)
Return size of Header.
static rpmRC rdSignature(FD_t fd, void *ptr, const char **msg)
Read (and verify header+payload size) signature header.
rpmRC rpmpkgWrite(const char *fn, FD_t fd, void *ptr, const char **msg)
Write item onto file descriptor.
size_t Fwrite(const void *buf, size_t size, size_t nmemb, FD_t fd)
fwrite(3) clone.
char * xstrdup(const char *str)
uint32_t rpmmiInstance(rpmmi mi)
Return header instance for current position of rpmdb iterator.
char * rpmGetPath(const char *path,...)
Return (malloc'ed) expanded, canonicalized, file path.
static char *size_t nb
fgets(3) analogue that reads \ continuations.
int pgpPubkeyFingerprint(const rpmuint8_t *pkt, size_t pktlen, rpmuint8_t *keyid)
Print/parse an OpenPGP subtype packet.
struct rpmts_s * rpmts
The RPM Transaction Set.
rpmdb rpmtsGetRdb(rpmts ts)
Get transaction set database handle.
int rpmxarNext(rpmxar xar)
Iterate a xar archive instance.
pgpDig rpmtsDig(rpmts ts)
Get OpenPGP packet parameters, i.e.
rpmRC headerCheck(pgpDig dig, const void *uh, size_t uc, const char **msg)
Check header consistency, performing headerGet() the hard way.
pgpDigParams rpmtsPubkey(const rpmts ts)
Return OpenPGP pubkey constants.
rpmRC rpmpkgCheck(const char *fn, FD_t fd, const void *ptr, const char **msg)
Verify item integrity.
unsigned char rpmuint8_t
Private int typedefs to avoid C99 portability issues.
sprintf(t," (%u)",(unsigned) dig->nbytes)
pgpArmor pgpReadPkts(const char *fn, rpmuint8_t **pkt, size_t *pktlen)
Parse armored OpenPGP packets from a file.
int Fstat(FD_t fd, struct stat *st)
fstat(2) clone.
pgpDig pgpDigNew(pgpVSFlags vsflags, pgpPubkeyAlgo pubkey_algo)
Create a container for parsed OpenPGP packates.
enum rpmRC_e rpmRC
RPM return codes.
memset(_r, 0, sizeof(*_r))
pgpVSFlags pgpDigVSFlags
Disabler bits(s) for signature/digest checking.
const char * Fstrerror(FD_t fd)
strerror(3) clone.
void * xcalloc(size_t nmemb, size_t size)
assert(key->size==sizeof(hdrNum))
int rpmdbOpen(const char *prefix, rpmdb *dbp, int mode, mode_t perms)
Open rpm database.
rpmmi rpmmiFree(rpmmi mi)
Destroy rpm database iterator.
static char * pgpHexStr(const rpmuint8_t *p, size_t plen)
Return hex formatted representation of bytes.
int rpmxarPull(rpmxar xar, const char *fn)
static rpmRC wrLead(FD_t fd, const void *ptr, const char **msg)
Write lead to file handle.
fprintf(stderr,"--> %s(%p,%p,%p) sig %p sigp %p\n", __FUNCTION__, dig, t, rsactx, sig, sigp)
size_t rpmpkgSizeof(const char *fn, const void *ptr)
Return size of item in bytes.
static rpmxar fdGetXAR(FD_t fd)
enum pgpHashAlgo_e pgpHashAlgo
9.4.
enum rpmtsOpX_e rpmtsOpX
Indices for timestamps.
static rpmRC rdHeader(FD_t fd, void *ptr, const char **msg)
Read metadata header.
void * pgpStatsAccumulator(pgpDig dig, int opx)
Return pgpDig container accumulator structure.
static rpmRC rpmReadHeader(FD_t fd, Header *hdrp, const char **msg)
Return checked and loaded header.
int rpmDigestUpdate(DIGEST_CTX ctx, const void *data, size_t len)
Update context with next plain text buffer.
pgpDigParams pgpGetSignature(pgpDig dig)
Return OpenPGP signature parameters.
Header rpmmiNext(rpmmi mi)
Return next package header from iteration.
unsigned short signature_type
The FD_t File Handle data structure.
pgpDig pgpDigFree(pgpDig dig)
Destroy a container for parsed OpenPGP packates.
Generate and verify rpm package signatures.
DIGEST_CTX rpmDigestInit(pgpHashAlgo hashalgo, rpmDigestFlags flags)
Initialize digest.
pgpDig pgpDigLink(pgpDig dig)
Reference a signature parameters instance.
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
static rpmRC ckHeader(FD_t fd, const void *ptr, const char **msg)
Check metadata header.
static void fdSetDig(FD_t fd, pgpDig dig)
pgpVSFlags rpmVSFlags
Bit(s) to control digest and signature verification.
Cumulative statistics for an operation.
rpmiob rpmiobNew(size_t len)
Create an I/O buffer.
int Ferror(FD_t fd)
ferror(3) clone.
return strcmp(ame->name, bme->name)
rpmRC rpmkuFindPubkey(pgpDigParams sigp, rpmiob *iobp)
Lookup pubkey in keyutils keyring.
urltype urlPath(const char *url, const char **pathp)
Return path component of URL.
static unsigned char lead_magic[]
static int snprintf(char *buf, int nb, const char *fmt,...)
Methods to handle package elements.
int pgpSetFindPubkey(pgpDig dig, int(*findPubkey)(void *ts, void *dig), void *_ts)
Set find pubkey vector.
int rpmxarSwapBuf(rpmxar xar, unsigned char *b, size_t bsize, unsigned char **obp, size_t *obsizep)
const void * pgpGetSig(pgpDig dig)
Get signature tag data, i.e.
Structures and prototypes used for an "rpmts" transaction set.
static const char * fdGetOPath(FD_t fd)
static rpmRC wrSignature(FD_t fd, void *ptr, const char **msg)
Write signature header.
struct pgpDigParams_s * pgpDigParams
int Fileno(FD_t fd)
fileno(3) clone.
static void
Print copy of spec file, filling in Group/Description/Summary from specspo.
rpmxar rpmxarFree(rpmxar xar, const char *msg)
Destroy a xar archive instance.
int pgpSetSig(pgpDig dig, rpmuint32_t sigtag, rpmuint32_t sigtype, const void *sig, rpmuint32_t siglen)
Set signature tag info, i.e.
char * buf
Parse (and execute) macro undefinition.
int
Save source and expand field into target.
static unsigned int pgpGrab(const rpmuint8_t *s, size_t nbytes)
Return (native-endian) integer from big-endian representation.
rpmRC rpmpkgRead(const char *fn, FD_t fd, void *ptr, const char **msg)
Read item from file descriptor.
Access RPM indices using Berkeley DB interface(s).
static rpmRC printSize(FD_t fd, size_t siglen, size_t pad, size_t datalen)
Print package size.
static rpmRC rdLead(FD_t fd, void *ptr, const char **msg)
Read lead from file handle.
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
rpmxar rpmxarNew(const char *fn, const char *fmode)
Create a xar archive instance.
char * Realpath(const char *path, char *resolved_path)
realpath(3) clone.
static pgpDig fdGetDig(FD_t fd)
rpmRC rpmVerifySignature(void *_dig, char *result)
Verify a signature from a package.
rpmRC rpmkuStorePubkey(pgpDigParams sigp, rpmiob iob)
Store pubkey in keyutils keyring.
rpmRC rpmtsFindPubkey(rpmts ts, void *_dig)
Retrieve pubkey from rpm database.
pgpDigParams pgpGetPubkey(pgpDig dig)
Return OpenPGP pubkey parameters.
rpmmi rpmmiInit(rpmdb db, rpmTag tag, const void *keyp, size_t keylen)
Return database iterator.
void rpmtsCleanDig(rpmts ts)
Free signature verification data.