RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson
Root: /v/rpm/cvs Email: jbj@rpm5.org
Module: rpm Date: 05-Dec-2007 00:49:27
Branch: HEAD Handle: 2007120423492402
Modified files:
rpm CHANGES
rpm/build files.c
rpm/lib rpmcli.h rpmrc.c rpmts.h
rpm/rpmdb pkgio.c rpmdb.c signature.c
rpm/rpmio rpmbc.c rpmio.c rpmio_internal.h rpmnss.c rpmpgp.c
rpmpgp.h
Log:
- eliminate dueling typdef byte, beecrypt "owns" the typedef.
Summary:
Revision Changes Path
1.1938 +1 -0 rpm/CHANGES
1.302 +2 -2 rpm/build/files.c
2.77 +2 -0 rpm/lib/rpmcli.h
2.218 +1 -1 rpm/lib/rpmrc.c
2.92 +2 -0 rpm/lib/rpmts.h
1.66 +2 -2 rpm/rpmdb/pkgio.c
1.225 +6 -6 rpm/rpmdb/rpmdb.c
1.42 +5 -5 rpm/rpmdb/signature.c
2.7 +8 -8 rpm/rpmio/rpmbc.c
1.113 +4 -4 rpm/rpmio/rpmio.c
2.99 +1 -1 rpm/rpmio/rpmio_internal.h
1.4 +4 -4 rpm/rpmio/rpmnss.c
2.78 +43 -43 rpm/rpmio/rpmpgp.c
2.64 +74 -87 rpm/rpmio/rpmpgp.h
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.1937 -r1.1938 CHANGES
--- rpm/CHANGES 4 Dec 2007 22:53:54 -0000 1.1937
+++ rpm/CHANGES 4 Dec 2007 23:49:24 -0000 1.1938
@@ -1,4 +1,5 @@
5.0a4 -> 5.0b1:
+ - jbj: eliminate dueling typdef byte, beecrypt "owns" the typedef.
- jbj: make sure that yum can upgrade zlib-devel. Trash the DEAD code.
- jbj: resurrect rpmMergeHeadersFromFD goop. Yah, mon, DEAD code ...
- jbj: re-add symbols needed for rpm-python import to loader map.
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/files.c
============================================================================
$ cvs diff -u -r1.301 -r1.302 files.c
--- rpm/build/files.c 3 Dec 2007 21:11:52 -0000 1.301
+++ rpm/build/files.c 4 Dec 2007 23:49:24 -0000 1.302
@@ -2069,7 +2069,7 @@
const char * buildURL = "%{_builddir}/%{?buildsubdir}/";
const char * fn = NULL;
const char * apkt = NULL;
- byte * pkt = NULL;
+ uint8_t * pkt = NULL;
ssize_t pktlen = 0;
int absolute = 0;
int rc = 1;
@@ -2090,7 +2090,7 @@
goto exit;
/*@notreached@*/ break;
case RPMTAG_PUBKEYS:
- if ((rc = pgpReadPkts(fn, (const byte **)&pkt, (size_t *)&pktlen)) <= 0) {
+ if ((rc = pgpReadPkts(fn, (const uint8_t **)&pkt, (size_t *)&pktlen)) <= 0) {
rpmlog(RPMLOG_ERR, _("%s: public key read failed.\n"), fn);
goto exit;
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmcli.h
============================================================================
$ cvs diff -u -r2.76 -r2.77 rpmcli.h
--- rpm/lib/rpmcli.h 3 Dec 2007 17:37:23 -0000 2.76
+++ rpm/lib/rpmcli.h 4 Dec 2007 23:49:25 -0000 2.77
@@ -446,8 +446,10 @@
INSTALL_ALLMATCHES = (1 << 9) /*!< from --allmatches (erase) */
} rpmInstallInterfaceFlags;
+/*@-redecl@*/
/*@unchecked@*/
extern int rpmcliPackagesTotal;
+/*@=redecl@*/
/*@unchecked@*/
extern int rpmcliHashesCurrent;
/*@unchecked@*/
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmrc.c
============================================================================
$ cvs diff -u -r2.217 -r2.218 rpmrc.c
--- rpm/lib/rpmrc.c 19 Nov 2007 18:57:54 -0000 2.217
+++ rpm/lib/rpmrc.c 4 Dec 2007 23:49:25 -0000 2.218
@@ -440,7 +440,7 @@
rpmGlobalMacroContext, fileSystem, internalState @*/
{
CVOG_t cvog = NULL;
- byte * b = NULL;
+ uint8_t * b = NULL;
ssize_t blen = 0;
int init_platform = 0;
miRE mi_re = NULL;
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmts.h
============================================================================
$ cvs diff -u -r2.91 -r2.92 rpmts.h
--- rpm/lib/rpmts.h 4 Dec 2007 21:24:00 -0000 2.91
+++ rpm/lib/rpmts.h 4 Dec 2007 23:49:25 -0000 2.92
@@ -1052,8 +1052,10 @@
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
+/*@-redecl@*/
/*@unchecked@*/
extern int rpmcliPackagesTotal;
+/*@=redecl@*/
/** \ingroup rpmts
* Add package to be installed to transaction set.
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/pkgio.c
============================================================================
$ cvs diff -u -r1.65 -r1.66 pkgio.c
--- rpm/rpmdb/pkgio.c 4 Dec 2007 17:08:36 -0000 1.65
+++ rpm/rpmdb/pkgio.c 4 Dec 2007 23:49:25 -0000 1.66
@@ -278,7 +278,7 @@
xx = 0;
if (fn && *fn != '%') {
- xx = (pgpReadPkts(fn, (const byte **)&ts->pkpkt, &ts->pkpktlen) != PGPARMOR_PUBKEY);
+ xx = (pgpReadPkts(fn, (const uint8_t **)&ts->pkpkt, &ts->pkpktlen) != PGPARMOR_PUBKEY);
}
fn = _free(fn);
if (xx) {
@@ -313,7 +313,7 @@
goto exit;
/* Retrieve parameters from pubkey packet(s). */
- xx = pgpPrtPkts((byte *)ts->pkpkt, ts->pkpktlen, dig, 0);
+ xx = pgpPrtPkts((uint8_t *)ts->pkpkt, ts->pkpktlen, dig, 0);
/* Do the parameters match the signature? */
if (sigp->pubkey_algo == pubp->pubkey_algo
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/rpmdb.c
============================================================================
$ cvs diff -u -r1.224 -r1.225 rpmdb.c
--- rpm/rpmdb/rpmdb.c 4 Dec 2007 03:38:53 -0000 1.224
+++ rpm/rpmdb/rpmdb.c 4 Dec 2007 23:49:25 -0000 1.225
@@ -2846,7 +2846,7 @@
if (db->db_tagn != NULL)
for (dbix = 0; dbix < db->db_ndbi; dbix++) {
dbiIndex dbi;
- byte * bin = NULL;
+ uint8_t * bin = NULL;
int i;
dbi = NULL;
@@ -2965,14 +2965,14 @@
if (dbi->dbi_rpmtag == RPMTAG_FILEDIGESTS) {
const char * s = he->p.argv[i];
size_t dlen = strlen(s);
- byte * t;
+ uint8_t * t;
unsigned j;
assert((dlen & 1) == 0);
dlen /= 2;
bin = t = xcalloc(1, dlen);
/*@-type@*/
for (j = 0; j < (unsigned) dlen; j++, t++, s += 2)
- *t = (byte) (nibble(s[0]) << 4) | nibble(s[1]);
+ *t = (uint8_t) (nibble(s[0]) << 4) | nibble(s[1]);
/*@=type@*/
key->data = bin;
key->size = (u_int32_t) dlen;
@@ -3252,7 +3252,7 @@
if (db->db_tagn != NULL)
for (dbix = 0; dbix < db->db_ndbi; dbix++) {
- byte * bin = NULL;
+ uint8_t * bin = NULL;
rpmTagData requireFlags;
rpmRC rpmrc;
int i;
@@ -3445,14 +3445,14 @@
if (dbi->dbi_rpmtag == RPMTAG_FILEDIGESTS) {
const char * s = he->p.argv[i];
size_t dlen = strlen(s);
- byte * t;
+ uint8_t * t;
unsigned j;
assert((dlen & 1) == 0);
dlen /= 2;
bin = t = xcalloc(1, dlen);
/*@-type@*/
for (j = 0; j < (unsigned) dlen; j++, t++, s += 2)
- *t = (byte) (nibble(s[0]) << 4) | nibble(s[1]);
+ *t = (uint8_t) (nibble(s[0]) << 4) | nibble(s[1]);
/*@=type@*/
key->data = bin;
key->size = (u_int32_t) dlen;
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/signature.c
============================================================================
$ cvs diff -u -r1.41 -r1.42 signature.c
--- rpm/rpmdb/signature.c 4 Dec 2007 17:08:36 -0000 1.41
+++ rpm/rpmdb/signature.c 4 Dec 2007 23:49:25 -0000 1.42
@@ -144,7 +144,7 @@
* @return 0 on success, 1 on failure
*/
static int makeGPGSignature(const char * file, uint32_t * sigTagp,
- /*@out@*/ byte ** pktp, /*@out@*/ uint32_t * pktlenp,
+ /*@out@*/ uint8_t ** pktp, /*@out@*/ uint32_t * pktlenp,
/*@null@*/ const char * passPhrase)
/*@globals rpmGlobalMacroContext, h_errno,
fileSystem, internalState @*/
@@ -312,7 +312,7 @@
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
Header h = NULL;
FD_t fd = NULL;
- byte * pkt;
+ uint8_t * pkt;
uint32_t pktlen;
const char * fn = NULL;
const char * msg;
@@ -437,7 +437,7 @@
{
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
struct stat st;
- byte * pkt;
+ uint8_t * pkt;
uint32_t pktlen;
int ret = -1; /* assume failure. */
int xx;
@@ -631,7 +631,7 @@
const void * sig = pgpGetSig(dig);
uint32_t siglen = pgpGetSiglen(dig);
rpmRC res;
- byte * md5sum = NULL;
+ uint8_t * md5sum = NULL;
size_t md5len = 0;
*t = '\0';
@@ -913,7 +913,7 @@
if (sigp->version == 4) {
uint32_t nb = sigp->hashlen;
- byte trailer[6];
+ uint8_t trailer[6];
nb = htonl(nb);
trailer[0] = sigp->version;
trailer[1] = 0xff;
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmbc.c
============================================================================
$ cvs diff -u -r2.6 -r2.7 rpmbc.c
--- rpm/rpmio/rpmbc.c 4 Dec 2007 21:02:50 -0000 2.6
+++ rpm/rpmio/rpmbc.c 4 Dec 2007 23:49:26 -0000 2.7
@@ -48,7 +48,7 @@
const char * prefix;
const char * hexstr;
const char * s;
- byte signhash16[2];
+ uint8_t signhash16[2];
char * tt;
int xx;
@@ -107,8 +107,8 @@
/* Compare leading 16 bits of digest for quick check. */
s = dig->md5;
/*@-type@*/
- signhash16[0] = (byte) (nibble(s[0]) << 4) | nibble(s[1]);
- signhash16[1] = (byte) (nibble(s[2]) << 4) | nibble(s[3]);
+ signhash16[0] = (uint8_t) (nibble(s[0]) << 4) | nibble(s[1]);
+ signhash16[1] = (uint8_t) (nibble(s[2]) << 4) | nibble(s[3]);
/*@=type@*/
return memcmp(signhash16, sigp->signhash16, sizeof(signhash16));
}
@@ -136,7 +136,7 @@
/*@modifies ctx, dig @*/
{
rpmbc bc = dig->impl;
- byte signhash16[2];
+ uint8_t signhash16[2];
int xx;
xx = rpmDigestFinal(ctx, (void **)&dig->sha1, &dig->sha1len, 1);
@@ -168,7 +168,7 @@
/**
*/
static /*@observer@*/
-const char * pgpMpiHex(const byte *p)
+const char * pgpMpiHex(const uint8_t *p)
/*@*/
{
static char prbuf[2048];
@@ -182,8 +182,8 @@
*/
static
int pgpMpiSet(const char * pre, int lbits,
- /*@out@*/ void * dest, const byte * p,
- /*@null@*/ const byte * pend)
+ /*@out@*/ void * dest, const uint8_t * p,
+ /*@null@*/ const uint8_t * pend)
/*@globals fileSystem @*/
/*@modifies *dest, fileSystem @*/
{
@@ -220,7 +220,7 @@
static
int rpmbcMpiItem(const char * pre, pgpDig dig, int itemno,
- const byte * p, /*@null@*/ const byte * pend)
+ const uint8_t * p, /*@null@*/ const uint8_t * pend)
/*@globals fileSystem @*/
/*@modifies dig, fileSystem @*/
{
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmio.c
============================================================================
$ cvs diff -u -r1.112 -r1.113 rpmio.c
--- rpm/rpmio/rpmio.c 3 Dec 2007 13:11:46 -0000 1.112
+++ rpm/rpmio/rpmio.c 4 Dec 2007 23:49:26 -0000 1.113
@@ -3820,11 +3820,11 @@
return rc;
}
-int rpmioSlurp(const char * fn, byte ** bp, ssize_t * blenp)
+int rpmioSlurp(const char * fn, uint8_t ** bp, ssize_t * blenp)
{
static ssize_t blenmax = (32 * BUFSIZ);
ssize_t blen = 0;
- byte * b = NULL;
+ uint8_t * b = NULL;
ssize_t size;
FD_t fd;
int rc = 0;
@@ -3840,7 +3840,7 @@
if (blen) {
size_t nb;
b = xmalloc(blen+1);
- b[0] = (byte) '\0';
+ b[0] = (uint8_t) '\0';
nb = Fread(b, sizeof(*b), blen, fd);
if (Ferror(fd) || (size > 0 && nb != blen)) {
rc = 1;
@@ -3850,7 +3850,7 @@
blen = nb;
b = xrealloc(b, blen+1);
}
- b[blen] = (byte) '\0';
+ b[blen] = (uint8_t) '\0';
}
exit:
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmio_internal.h
============================================================================
$ cvs diff -u -r2.98 -r2.99 rpmio_internal.h
--- rpm/rpmio/rpmio_internal.h 4 Dec 2007 21:02:50 -0000 2.98
+++ rpm/rpmio/rpmio_internal.h 4 Dec 2007 23:49:26 -0000 2.99
@@ -657,7 +657,7 @@
* @return 0 on success
*/
int rpmioSlurp(const char * fn,
- /*@out@*/ byte ** bp, /*@out@*/ ssize_t * blenp)
+ /*@out@*/ uint8_t ** bp, /*@out@*/ ssize_t * blenp)
/*@globals h_errno, fileSystem, internalState @*/
/*@modifies *bp, *blenp, fileSystem, internalState @*/;
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmnss.c
============================================================================
$ cvs diff -u -r1.3 -r1.4 rpmnss.c
--- rpm/rpmio/rpmnss.c 4 Dec 2007 21:02:50 -0000 1.3
+++ rpm/rpmio/rpmnss.c 4 Dec 2007 23:49:26 -0000 1.4
@@ -129,8 +129,8 @@
*/
static
int rpmnssMpiSet(const char * pre, int lbits,
- /*@out@*/ void * dest, const byte * p,
- /*@null@*/ const byte * pend)
+ /*@out@*/ void * dest, const uint8_t * p,
+ /*@null@*/ const uint8_t * pend)
/*@globals fileSystem @*/
/*@modifies *dest, fileSystem @*/
{
@@ -165,7 +165,7 @@
static
/*@only@*/ /*@null@*/
SECItem * rpmnssMpiCopy(PRArenaPool * arena, /*@returned@*/ SECItem * item,
- const byte * p)
+ const uint8_t * p)
/*@modifies item @*/
{
unsigned int nbytes = pgpMpiLen(p)-2;
@@ -238,7 +238,7 @@
static
int rpmnssMpiItem(const char * pre, pgpDig dig, int itemno,
- const byte * p, /*@null@*/ const byte * pend)
+ const uint8_t * p, /*@null@*/ const uint8_t * pend)
/*@globals fileSystem @*/
/*@modifies dig, fileSystem @*/
{
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmpgp.c
============================================================================
$ cvs diff -u -r2.77 -r2.78 rpmpgp.c
--- rpm/rpmio/rpmpgp.c 4 Dec 2007 22:41:54 -0000 2.77
+++ rpm/rpmio/rpmpgp.c 4 Dec 2007 23:49:26 -0000 2.78
@@ -39,7 +39,7 @@
struct pgpPkt_s {
pgpTag tag;
unsigned int pktlen;
- const byte *h;
+ const uint8_t * h;
unsigned int hlen;
};
@@ -231,7 +231,7 @@
fprintf(stderr, " %s", s);
}
-static void pgpPrtHex(const char *pre, const byte *p, size_t plen)
+static void pgpPrtHex(const char *pre, const uint8_t * p, size_t plen)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/
{
@@ -241,7 +241,7 @@
fprintf(stderr, " %s", pgpHexStr(p, plen));
}
-void pgpPrtVal(const char * pre, pgpValTbl vs, byte val)
+void pgpPrtVal(const char * pre, pgpValTbl vs, uint8_t val)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/
{
@@ -251,9 +251,9 @@
fprintf(stderr, "%s(%u)", pgpValStr(vs, val), (unsigned)val);
}
-int pgpPrtSubType(const byte *h, size_t hlen, pgpSigType sigtype)
+int pgpPrtSubType(const uint8_t * h, size_t hlen, pgpSigType sigtype)
{
- const byte *p = h;
+ const uint8_t * p = h;
unsigned plen;
int i;
@@ -365,12 +365,12 @@
};
/*@=varuse =readonlytrans @*/
-static int pgpPrtSigParams(const pgpPkt pp, byte pubkey_algo, byte sigtype,
- const byte *p)
+static int pgpPrtSigParams(const pgpPkt pp, uint8_t pubkey_algo,
+ uint8_t sigtype, const uint8_t * p)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/
{
- const byte * pend = pp->h + pp->hlen;
+ const uint8_t * pend = pp->h + pp->hlen;
int xx;
int i;
@@ -427,8 +427,8 @@
/*@globals _digp @*/
/*@modifies *_digp @*/
{
- byte version = pp->h[0];
- byte * p;
+ uint8_t version = pp->h[0];
+ uint8_t * p;
unsigned plen;
int rc;
@@ -466,7 +466,7 @@
memcpy(_digp->signhash16, v->signhash16, sizeof(_digp->signhash16));
}
- p = ((byte *)v) + sizeof(*v);
+ p = ((uint8_t *)v) + sizeof(*v);
rc = pgpPrtSigParams(pp, v->pubkey_algo, v->sigtype, p);
} break;
case 4:
@@ -583,8 +583,8 @@
#endif
/*@=varuse =readonlytrans @*/
-static const byte * pgpPrtPubkeyParams(const pgpPkt pp, byte pubkey_algo,
- /*@returned@*/ const byte *p)
+static const uint8_t * pgpPrtPubkeyParams(const pgpPkt pp, uint8_t pubkey_algo,
+ /*@returned@*/ const uint8_t * p)
/*@globals fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/
{
@@ -641,8 +641,8 @@
return p;
}
-static const byte * pgpPrtSeckeyParams(const pgpPkt pp, /*@unused@*/ byte pubkey_algo,
- /*@returned@*/ const byte *p)
+static const uint8_t * pgpPrtSeckeyParams(const pgpPkt pp, /*@unused@*/ uint8_t pubkey_algo,
+ /*@returned@*/ const uint8_t *p)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/
{
@@ -719,8 +719,8 @@
/*@globals _digp @*/
/*@modifies *_digp @*/
{
- byte version = pp->h[0];
- const byte * p;
+ uint8_t version = pp->h[0];
+ const uint8_t * p;
unsigned plen;
time_t t;
int rc;
@@ -744,7 +744,7 @@
_digp->pubkey_algo = v->pubkey_algo;
}
- p = ((byte *)v) + sizeof(*v);
+ p = ((uint8_t *)v) + sizeof(*v);
p = pgpPrtPubkeyParams(pp, v->pubkey_algo, p);
rc = 0;
} break;
@@ -763,7 +763,7 @@
_digp->pubkey_algo = v->pubkey_algo;
}
- p = ((byte *)v) + sizeof(*v);
+ p = ((uint8_t *)v) + sizeof(*v);
p = pgpPrtPubkeyParams(pp, v->pubkey_algo, p);
if (!(pp->tag == PGPTAG_PUBLIC_KEY || pp->tag == PGPTAG_PUBLIC_SUBKEY))
p = pgpPrtSeckeyParams(pp, v->pubkey_algo, p);
@@ -795,7 +795,7 @@
int pgpPrtComment(const pgpPkt pp)
{
- const byte * h = pp->h;
+ const uint8_t * h = pp->h;
int i = pp->hlen;
pgpPrtVal("", pgpTagTbl, pp->tag);
@@ -803,11 +803,11 @@
fprintf(stderr, " ");
while (i > 0) {
int j;
- if (*h >= (byte)' ' && *h <= (byte)'z') {
+ if (*h >= (uint8_t)' ' && *h <= (uint8_t)'z') {
j = 0;
- while (j < i && h[j] != (byte)'\0')
+ while (j < i && h[j] != (uint8_t)'\0')
j++;
- while (j < i && h[j] == (byte)'\0')
+ while (j < i && h[j] == (uint8_t)'\0')
j++;
if (_pgp_print && j)
fprintf(stderr, "%.*s", (int)strlen((const char *)h), (const char *)h);
@@ -822,7 +822,7 @@
return 0;
}
-int pgpPktLen(const byte *pkt, size_t pleft, pgpPkt pp)
+int pgpPktLen(const uint8_t *pkt, size_t pleft, pgpPkt pp)
{
unsigned int val = (unsigned int)*pkt;
unsigned int plen;
@@ -852,11 +852,11 @@
return pp->pktlen;
}
-int pgpPubkeyFingerprint(const byte * pkt, size_t pktlen, byte * keyid)
+int pgpPubkeyFingerprint(const uint8_t * pkt, size_t pktlen, uint8_t * keyid)
{
pgpPkt pp = alloca(sizeof(*pp));
int rc = pgpPktLen(pkt, pktlen, pp);
- const byte *se;
+ const uint8_t * se;
int i;
/* Pubkeys only please. */
@@ -868,7 +868,7 @@
default: return -1;
case 3:
{ pgpPktKeyV3 v = (pgpPktKeyV3) (pp->h);
- se = (byte *)(v + 1);
+ se = (uint8_t *)(v + 1);
switch (v->pubkey_algo) {
default: return -1;
case PGPPUBKEYALGO_RSA:
@@ -879,10 +879,10 @@
} break;
case 4:
{ pgpPktKeyV4 v = (pgpPktKeyV4) (pp->h);
- byte * d = NULL;
+ uint8_t * d = NULL;
size_t dlen = 0;
- se = (byte *)(v + 1);
+ se = (uint8_t *)(v + 1);
switch (v->pubkey_algo) {
default: return -1;
case PGPPUBKEYALGO_RSA:
@@ -907,9 +907,9 @@
return rc;
}
-int pgpExtractPubkeyFingerprint(const char * b64pkt, byte * keyid)
+int pgpExtractPubkeyFingerprint(const char * b64pkt, uint8_t * keyid)
{
- const byte * pkt;
+ const uint8_t * pkt;
size_t pktlen;
if (b64decode(b64pkt, (void **)&pkt, &pktlen))
@@ -919,7 +919,7 @@
return 8; /* no. of bytes of pubkey signid */
}
-int pgpPrtPkt(const byte *pkt, size_t pleft)
+int pgpPrtPkt(const uint8_t * pkt, size_t pleft)
{
pgpPkt pp = alloca(sizeof(*pp));
int rc = pgpPktLen(pkt, pleft, pp);
@@ -1190,16 +1190,16 @@
return rc;
}
-static int pgpGrabPkts(const byte * pkts, size_t pktlen,
- /*@out@*/ byte *** pppkts, /*@out@*/ int * pnpkts)
+static int pgpGrabPkts(const uint8_t * pkts, size_t pktlen,
+ /*@out@*/ uint8_t *** pppkts, /*@out@*/ int * pnpkts)
/*@modifies *pppkts, *pnpkts @*/
{
pgpPkt pp = alloca(sizeof(*pp));
- const byte *p;
+ const uint8_t * p;
size_t pleft;
size_t len;
int npkts = 0;
- byte ** ppkts;
+ uint8_t ** ppkts;
for (p = pkts, pleft = pktlen; p < (pkts + pktlen); p += len, pleft -= len) {
if (pgpPktLen(p, pleft, pp) < 0)
@@ -1218,7 +1218,7 @@
if (pgpPktLen(p, pleft, pp) < 0)
return -1;
len = pp->pktlen;
- ppkts[npkts++] = (byte *) p;
+ ppkts[npkts++] = (uint8_t *) p;
}
if (pppkts != NULL)
@@ -1233,7 +1233,7 @@
}
/*@-globstate -incondefs -nullderef @*/ /* _dig annotations are not correct. */
-int pgpPrtPkts(const byte * pkts, size_t pktlen, pgpDig dig, int printing)
+int pgpPrtPkts(const uint8_t * pkts, size_t pktlen, pgpDig dig, int printing)
/*@globals _dig, _digp, _pgp_print @*/
/*@modifies _dig, _digp, *_digp, _pgp_print @*/
{
@@ -1241,7 +1241,7 @@
unsigned int val = (unsigned int)*pkts;
size_t pleft;
int len;
- byte ** ppkts = NULL;
+ uint8_t ** ppkts = NULL;
int npkts;
int i;
@@ -1277,14 +1277,14 @@
}
/*@=globstate =incondefs =nullderef @*/
-pgpArmor pgpReadPkts(const char * fn, const byte ** pkt, size_t * pktlen)
+pgpArmor pgpReadPkts(const char * fn, const uint8_t ** pkt, size_t * pktlen)
{
- byte * b = NULL;
+ uint8_t * b = NULL;
ssize_t blen;
const char * enc = NULL;
const char * crcenc = NULL;
- byte * dec;
- byte * crcdec;
+ uint8_t * dec;
+ uint8_t * crcdec;
size_t declen;
size_t crclen;
uint32_t crcpkt, crc;
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmpgp.h
============================================================================
$ cvs diff -u -r2.63 -r2.64 rpmpgp.h
--- rpm/rpmio/rpmpgp.h 4 Dec 2007 21:02:50 -0000 2.63
+++ rpm/rpmio/rpmpgp.h 4 Dec 2007 23:49:26 -0000 2.64
@@ -13,19 +13,6 @@
#include <string.h>
#include <popt.h>
-#ifdef HAVE_BEECRYPT_API_H
-/* BeeCrypt also has "byte" */
-#include <beecrypt/api.h>
-#endif
-
-#if !defined(_BEECRYPT_API_H)
-/** \ingroup rpmpgp
- */
-/*@-redef@*/
-typedef unsigned char byte;
-/*@=redef@*/
-#endif /* _BEECRYPT_API_H */
-
/** \ingroup rpmpgp
*/
typedef /*@abstract@*/ struct DIGEST_CTX_s * DIGEST_CTX;
@@ -96,20 +83,20 @@
/*@only@*/ /*@null@*/
const char * userid;
/*@only@*/ /*@null@*/
- const byte * hash;
+ const uint8_t * hash;
const char * params[4];
- byte tag;
+ uint8_t tag;
- byte version; /*!< version number. */
- byte time[4]; /*!< time that the key was created. */
- byte pubkey_algo; /*!< public key algorithm. */
-
- byte hash_algo;
- byte sigtype;
- byte hashlen;
- byte signhash16[2];
- byte signid[8];
- byte saved;
+ uint8_t version; /*!< version number. */
+ uint8_t time[4]; /*!< time that the key was created. */
+ uint8_t pubkey_algo; /*!< public key algorithm. */
+
+ uint8_t hash_algo;
+ uint8_t sigtype;
+ uint8_t hashlen;
+ uint8_t signhash16[2];
+ uint8_t signid[8];
+ uint8_t saved;
#define PGPDIG_SAVED_TIME (1 << 0)
#define PGPDIG_SAVED_ID (1 << 1)
@@ -139,7 +126,7 @@
/*@refs@*/
int nrefs; /*!< Reference count. */
- byte ** ppkts;
+ uint8_t ** ppkts;
int npkts;
size_t nbytes; /*!< No. bytes of plain text. */
@@ -243,9 +230,9 @@
* - MPI of Elgamal (Diffie-Hellman) value m * y**k mod p.
*/
typedef struct pgpPktPubkey_s {
- byte version; /*!< version number (generate 3, accept 2). */
- byte keyid[8]; /*!< key ID of the public key for session key. */
- byte algo; /*!< public key algorithm used. */
+ uint8_t version; /*!< version number (generate 3, accept 2). */
+ uint8_t keyid[8]; /*!< key ID of the public key for session key. */
+ uint8_t algo; /*!< public key algorithm used. */
} pgpPktPubkey;
@@ -475,14 +462,14 @@
* - MPI of DSA value s.
*/
typedef struct pgpPktSigV3_s {
- byte version; /*!< version number (3). */
- byte hashlen; /*!< length of following hashed material. MUST be 5. */
- byte sigtype; /*!< signature type. */
- byte time[4]; /*!< 4 byte creation time. */
- byte signid[8]; /*!< key ID of signer. */
- byte pubkey_algo; /*!< public key algorithm. */
- byte hash_algo; /*!< hash algorithm. */
- byte signhash16[2]; /*!< left 16 bits of signed hash value. */
+ uint8_t version; /*!< version number (3). */
+ uint8_t hashlen; /*!< length of following hashed material. MUST be 5. */
+ uint8_t sigtype; /*!< signature type. */
+ uint8_t time[4]; /*!< 4 byte creation time. */
+ uint8_t signid[8]; /*!< key ID of signer. */
+ uint8_t pubkey_algo;/*!< public key algorithm. */
+ uint8_t hash_algo; /*!< hash algorithm. */
+ uint8_t signhash16[2]; /*!< left 16 bits of signed hash value. */
} * pgpPktSigV3;
/** \ingroup rpmpgp
@@ -507,11 +494,11 @@
* - One or more multi-precision integers comprising the signature.
*/
typedef struct pgpPktSigV4_s {
- byte version; /*!< version number (4). */
- byte sigtype; /*!< signature type. */
- byte pubkey_algo; /*!< public key algorithm. */
- byte hash_algo; /*!< hash algorithm. */
- byte hashlen[2]; /*!< length of following hashed material. */
+ uint8_t version; /*!< version number (4). */
+ uint8_t sigtype; /*!< signature type. */
+ uint8_t pubkey_algo;/*!< public key algorithm. */
+ uint8_t hash_algo; /*!< hash algorithm. */
+ uint8_t hashlen[2]; /*!< length of following hashed material. */
} * pgpPktSigV4;
/** \ingroup rpmpgp
@@ -683,9 +670,9 @@
*
*/
typedef struct pgpPktSymkey_s {
- byte version; /*!< version number (4). */
- byte symkey_algo;
- byte s2k[1];
+ uint8_t version; /*!< version number (4). */
+ uint8_t symkey_algo;
+ uint8_t s2k[1];
} pgpPktSymkey;
/** \ingroup rpmpgp
@@ -718,12 +705,12 @@
* pass packet.
*/
typedef struct pgpPktOnepass_s {
- byte version; /*!< version number (3). */
- byte sigtype; /*!< signature type. */
- byte hash_algo; /*!< hash algorithm. */
- byte pubkey_algo; /*!< public key algorithm. */
- byte signid[8]; /*!< key ID of signer. */
- byte nested;
+ uint8_t version; /*!< version number (3). */
+ uint8_t sigtype; /*!< signature type. */
+ uint8_t hash_algo; /*!< hash algorithm. */
+ uint8_t pubkey_algo;/*!< public key algorithm. */
+ uint8_t signid[8]; /*!< key ID of signer. */
+ uint8_t nested;
} * pgpPktOnepass;
/** \ingroup rpmpgp
@@ -799,10 +786,10 @@
*
*/
typedef struct pgpPktKeyV3_s {
- byte version; /*!< version number (3). */
- byte time[4]; /*!< time that the key was created. */
- byte valid[2]; /*!< time in days that this key is valid. */
- byte pubkey_algo; /*!< public key algorithm. */
+ uint8_t version; /*!< version number (3). */
+ uint8_t time[4]; /*!< time that the key was created. */
+ uint8_t valid[2]; /*!< time in days that this key is valid. */
+ uint8_t pubkey_algo;/*!< public key algorithm. */
} * pgpPktKeyV3;
/** \ingroup rpmpgp
@@ -837,9 +824,9 @@
*
*/
typedef struct pgpPktKeyV4_s {
- byte version; /*!< version number (4). */
- byte time[4]; /*!< time that the key was created. */
- byte pubkey_algo; /*!< public key algorithm. */
+ uint8_t version; /*!< version number (4). */
+ uint8_t time[4]; /*!< time that the key was created. */
+ uint8_t pubkey_algo;/*!< public key algorithm. */
} * pgpPktKeyV4;
/** \ingroup rpmpgp
@@ -936,8 +923,8 @@
* blocks.
*/
typedef struct pgpPktCdata_s {
- byte compressalgo;
- byte data[1];
+ uint8_t compressalgo;
+ uint8_t data[1];
} pgpPktCdata;
/** \ingroup rpmpgp
@@ -975,7 +962,7 @@
* session key is incorrect.
*/
typedef struct pgpPktEdata_s {
- byte data[1];
+ uint8_t data[1];
} pgpPktEdata;
/** \ingroup rpmpgp
@@ -1026,9 +1013,9 @@
* the receiving software.
*/
typedef struct pgpPktLdata_s {
- byte format;
- byte filenamelen;
- byte filename[1];
+ uint8_t format;
+ uint8_t filenamelen;
+ uint8_t filename[1];
} pgpPktLdata;
/** \ingroup rpmpgp
@@ -1045,7 +1032,7 @@
* other than local keyring files.
*/
typedef struct pgpPktTrust_s {
- byte flag;
+ uint8_t flag;
} pgpPktTrust;
/** \ingroup rpmpgp
@@ -1059,7 +1046,7 @@
*
*/
typedef struct pgpPktUid_s {
- byte userid[1];
+ uint8_t userid[1];
} pgpPktUid;
/** \ingroup rpmpgp
@@ -1154,7 +1141,7 @@
* @return native-endian integer
*/
/*@unused@*/ static inline
-unsigned int pgpGrab(const byte *s, size_t nbytes)
+unsigned int pgpGrab(const uint8_t * s, size_t nbytes)
/*@*/
{
unsigned int i = 0;
@@ -1171,7 +1158,7 @@
* @return no. of bytes in length prefix
*/
/*@unused@*/ static inline
-int pgpLen(const byte *s, /*@out@*/ unsigned int *lenp)
+int pgpLen(const uint8_t * s, /*@out@*/ unsigned int * lenp)
/*@modifies *lenp @*/
{
if (*s < 192) {
@@ -1192,7 +1179,7 @@
* @return no. of bits
*/
/*@unused@*/ static inline
-unsigned int pgpMpiBits(const byte *p)
+unsigned int pgpMpiBits(const uint8_t * p)
/*@requires maxRead(p) >= 1 @*/
/*@*/
{
@@ -1205,7 +1192,7 @@
* @return no. of bytes
*/
/*@unused@*/ static inline
-unsigned int pgpMpiLen(const byte *p)
+unsigned int pgpMpiLen(const uint8_t * p)
/*@requires maxRead(p) >= 1 @*/
/*@*/
{
@@ -1220,7 +1207,7 @@
* @return target buffer
*/
/*@unused@*/ static inline
-char * pgpHexCvt(/*@returned@*/ char *t, const byte *s, size_t nbytes)
+char * pgpHexCvt(/*@returned@*/ char * t, const uint8_t * s, size_t nbytes)
/*@modifies *t @*/
{
static char hex[] = "0123456789abcdef";
@@ -1242,7 +1229,7 @@
* @return hex formatted string
*/
/*@unused@*/ static inline /*@observer@*/
-char * pgpHexStr(const byte *p, size_t plen)
+char * pgpHexStr(const uint8_t * p, size_t plen)
/*@*/
{
static char prbuf[8*BUFSIZ]; /* XXX ick */
@@ -1258,7 +1245,7 @@
* @return hex formatted string
*/
/*@unused@*/ static inline /*@observer@*/
-const char * pgpMpiStr(const byte *p)
+const char * pgpMpiStr(const uint8_t * p)
/*@requires maxRead(p) >= 3 @*/
/*@*/
{
@@ -1277,7 +1264,7 @@
* @return string value of byte
*/
/*@unused@*/ static inline /*@observer@*/
-const char * pgpValStr(pgpValTbl vs, byte val)
+const char * pgpValStr(pgpValTbl vs, uint8_t val)
/*@*/
{
do {
@@ -1313,7 +1300,7 @@
* @param val byte value to print
*/
/*@-exportlocal@*/
-void pgpPrtVal(const char * pre, pgpValTbl vs, byte val)
+void pgpPrtVal(const char * pre, pgpValTbl vs, uint8_t val)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/;
/*@=exportlocal@*/
@@ -1326,7 +1313,7 @@
* @return 0 on success
*/
/*@-exportlocal@*/
-int pgpPrtSubType(const byte *h, size_t hlen, pgpSigType sigtype)
+int pgpPrtSubType(const uint8_t * h, size_t hlen, pgpSigType sigtype)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/;
/*@=exportlocal@*/
@@ -1382,8 +1369,8 @@
* @return 0 on sucess, else -1
*/
/*@-exportlocal@*/
-int pgpPubkeyFingerprint(const byte * pkt, size_t pktlen,
- /*@out@*/ byte * keyid)
+int pgpPubkeyFingerprint(const uint8_t * pkt, size_t pktlen,
+ /*@out@*/ uint8_t * keyid)
/*@modifies *keyid @*/;
/*@=exportlocal@*/
@@ -1394,7 +1381,7 @@
* @retval keyid[8] public key fingerprint
* @return 8 (no. of bytes) on success, < 0 on error
*/
-int pgpExtractPubkeyFingerprint(const char * b64pkt, /*@out@*/ byte * keyid)
+int pgpExtractPubkeyFingerprint(const char * b64pkt, /*@out@*/ uint8_t * keyid)
/*@modifies *keyid @*/;
/** \ingroup rpmpgp
@@ -1404,7 +1391,7 @@
* @retval pp packet tag/ptr/len
* @return packet length, <0 on error.
*/
-int pgpPktLen(const byte *pkt, size_t pleft, /*@out@*/ pgpPkt pp)
+int pgpPktLen(const uint8_t * pkt, size_t pleft, /*@out@*/ pgpPkt pp)
/*@modifies pp @*/;
/** \ingroup rpmpgp
@@ -1414,7 +1401,7 @@
* @return -1 on error, otherwise this packet length
*/
/*@-exportlocal@*/
-int pgpPrtPkt(const byte *pkt, size_t pleft)
+int pgpPrtPkt(const uint8_t * pkt, size_t pleft)
/*@globals fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/;
/*@=exportlocal@*/
@@ -1427,7 +1414,7 @@
* @param printing should packets be printed?
* @return -1 on error, 0 on success
*/
-int pgpPrtPkts(const byte *pkts, size_t pktlen, pgpDig dig, int printing)
+int pgpPrtPkts(const uint8_t * pkts, size_t pktlen, pgpDig dig, int printing)
/*@globals fileSystem, internalState @*/
/*@modifies dig, fileSystem, internalState @*/;
@@ -1439,7 +1426,7 @@
* @return type of armor found
*/
pgpArmor pgpReadPkts(const char * fn,
- /*@out@*/ const byte ** pkt, /*@out@*/ size_t * pktlen)
+ /*@out@*/ const uint8_t ** pkt, /*@out@*/ size_t * pktlen)
/*@globals h_errno, fileSystem, internalState @*/
/*@modifies *pkt, *pktlen, fileSystem, internalState @*/;
@@ -1632,7 +1619,7 @@
* @return 1 if an OpenPGP packet, 0 otherwise
*/
/*@unused@*/ static inline
-int pgpIsPkt(const byte * p)
+int pgpIsPkt(const uint8_t * p)
/*@*/
{
unsigned int val = (unsigned int) *p++;
@@ -1692,7 +1679,7 @@
* @return crc of buffer
*/
/*@unused@*/ static inline
-unsigned int pgpCRC(const byte *octets, size_t len)
+unsigned int pgpCRC(const uint8_t * octets, size_t len)
/*@*/
{
unsigned int crc = CRC24_INIT;
@@ -1768,7 +1755,7 @@
/**
*/
typedef int (*pgpImplMpiItem_t) (const char * pre, pgpDig dig, int itemno,
- const byte * p, /*@null@*/ const byte * pend)
+ const uint8_t * p, /*@null@*/ const uint8_t * pend)
/*@globals fileSystem @*/
/*@modifies dig, fileSystem @*/;
@@ -1847,7 +1834,7 @@
*/
/*@unused@*/ static inline
int pgpImplMpiItem(const char * pre, pgpDig dig, int itemno,
- const byte * p, /*@null@*/ const byte * pend)
+ const uint8_t * p, /*@null@*/ const uint8_t * pend)
/*@modifies dig @*/
{
return (*pgpImplVecs->_pgpMpiItem) (pre, dig, itemno, p, pend);
@@ .
Received on Wed Dec 5 00:49:27 2007