diff options
-rw-r--r-- | build/files.c | 4 | ||||
-rw-r--r-- | lib/formats.c | 2 | ||||
-rw-r--r-- | lib/rpmrc.c | 2 | ||||
-rw-r--r-- | lib/signature.c | 16 | ||||
-rw-r--r-- | rpmdb/rpmdb.c | 8 | ||||
-rw-r--r-- | rpmio/digest.c | 2 | ||||
-rw-r--r-- | rpmio/digest.h | 22 | ||||
-rw-r--r-- | rpmio/rpmio.c | 4 | ||||
-rw-r--r-- | rpmio/rpmio_internal.h | 2 | ||||
-rw-r--r-- | rpmio/rpmpgp.c | 80 | ||||
-rw-r--r-- | rpmio/rpmpgp.h | 126 | ||||
-rw-r--r-- | tools/debugedit.c | 2 |
12 files changed, 134 insertions, 136 deletions
diff --git a/build/files.c b/build/files.c index 90c546bc7..d62cb9401 100644 --- a/build/files.c +++ b/build/files.c @@ -1628,7 +1628,7 @@ static int processMetadataFile(Package pkg, FileList fl, const char * fileURL, 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; @@ -1648,7 +1648,7 @@ static int processMetadataFile(Package pkg, FileList fl, const char * fileURL, goto exit; 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; } diff --git a/lib/formats.c b/lib/formats.c index 40cfc8a45..d1773cfb3 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -352,7 +352,7 @@ static char * pgpsigFormat(int32_t type, const void * data, if (type != RPM_BIN_TYPE) { val = xstrdup(_("(not a blob)")); } else { - unsigned char * pkt = (byte *) data; + unsigned char * pkt = (uint8_t *) data; unsigned int pktlen = 0; unsigned int v = *pkt; pgpTag tag = 0; diff --git a/lib/rpmrc.c b/lib/rpmrc.c index fcb9c77cb..aa78519c1 100644 --- a/lib/rpmrc.c +++ b/lib/rpmrc.c @@ -698,7 +698,7 @@ static int doReadRC( FD_t fd, const char * urlfn) static int rpmPlatform(const char * platform) { char *cpu = NULL, *vendor = NULL, *os = NULL, *gnu = NULL; - byte * b = NULL; + uint8_t * b = NULL; ssize_t blen = 0; int init_platform = 0; char * p, * pe; diff --git a/lib/signature.c b/lib/signature.c index 4f83e8bde..5cd1ba304 100644 --- a/lib/signature.c +++ b/lib/signature.c @@ -307,7 +307,7 @@ exit: int rpmWriteSignature(FD_t fd, Header sigh) { - static byte buf[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + static uint8_t buf[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; int sigSize, pad; int rc; @@ -346,7 +346,7 @@ Header rpmFreeSignature(Header sigh) * @return 0 on success, 1 on failure */ static int makePGPSignature(const char * file, int32_t * sigTagp, - byte ** pktp, int32_t * pktlenp, + uint8_t ** pktp, int32_t * pktlenp, const char * passPhrase) { char * sigfile = alloca(1024); @@ -477,7 +477,7 @@ static int makePGPSignature(const char * file, int32_t * sigTagp, * @return 0 on success, 1 on failure */ static int makeGPGSignature(const char * file, int32_t * sigTagp, - byte ** pktp, int32_t * pktlenp, + uint8_t ** pktp, int32_t * pktlenp, const char * passPhrase) { char * sigfile = alloca(strlen(file)+sizeof(".sig")); @@ -616,7 +616,7 @@ static int makeHDRSignature(Header sigh, const char * file, int32_t sigTag, { Header h = NULL; FD_t fd = NULL; - byte * pkt; + uint8_t * pkt; int32_t pktlen; const char * fn = NULL; const char * SHA1 = NULL; @@ -717,7 +717,7 @@ int rpmAddSignature(Header sigh, const char * file, int32_t sigTag, const char * passPhrase) { struct stat st; - byte * pkt; + uint8_t * pkt; int32_t pktlen; int ret = -1; /* assume failure. */ @@ -966,7 +966,7 @@ verifyMD5Signature(const rpmts ts, char * t, int32_t siglen = rpmtsSiglen(ts); pgpDig dig = rpmtsDig(ts); rpmRC res; - byte * md5sum = NULL; + uint8_t * md5sum = NULL; size_t md5len = 0; *t = '\0'; @@ -1178,7 +1178,7 @@ verifyRSASignature(rpmts ts, char * t, #ifdef NOTYET /* XXX not for binary/text signatures as in packages. */ if (!(sigp->sigtype == PGPSIGTYPE_BINARY || sigp->sigtype == PGP_SIGTYPE_TEXT)) { int nb = dig->nbytes + sigp->hashlen; - byte trailer[6]; + uint8_t trailer[6]; nb = htonl(nb); trailer[0] = 0x4; trailer[1] = 0xff; @@ -1278,7 +1278,7 @@ verifyDSASignature(rpmts ts, char * t, if (sigp->version == 4) { int nb = sigp->hashlen; - byte trailer[6]; + uint8_t trailer[6]; nb = htonl(nb); trailer[0] = sigp->version; trailer[1] = 0xff; diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index a58d986f6..3bfeafa82 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -2530,7 +2530,7 @@ if (dbiByteSwapped(dbi) == 1) for (i = 0; i < rpmcnt; i++) { dbiIndexSet set; int stringvalued; - byte bin[32]; + uint8_t bin[32]; switch (dbi->dbi_rpmtag) { case RPMTAG_FILEMD5S: @@ -2570,7 +2570,7 @@ if (dbiByteSwapped(dbi) == 1) /* Convert from hex to binary. */ if (dbi->dbi_rpmtag == RPMTAG_FILEMD5S) { const char * s; - byte * t; + uint8_t * t; s = rpmvals[i]; t = bin; @@ -2923,8 +2923,8 @@ data->size = 0; for (i = 0; i < rpmcnt; i++) { dbiIndexSet set; int stringvalued; - byte bin[32]; - byte * t; + uint8_t bin[32]; + uint8_t * t; /* * Include the tagNum in all indices. rpm-3.0.4 and earlier diff --git a/rpmio/digest.c b/rpmio/digest.c index 3e9231616..10ed6d138 100644 --- a/rpmio/digest.c +++ b/rpmio/digest.c @@ -144,7 +144,7 @@ DPRINTF((stderr, "*** Final(%p,%p,%p,%d) hashctx %p digest %p\n", ctx, datap, le } else { if (lenp) *lenp = (2*digestlen) + 1; if (datap) { - const byte * s = (const byte *) digest; + const uint8_t * s = (const uint8_t *) digest; static const char hex[] = "0123456789abcdef"; *datap = t = xmalloc((2*digestlen) + 1); diff --git a/rpmio/digest.h b/rpmio/digest.h index 1519baeb6..018a6d59a 100644 --- a/rpmio/digest.h +++ b/rpmio/digest.h @@ -14,20 +14,20 @@ */ struct pgpDigParams_s { const char * userid; - 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. */ + uint8_t version; /*!< version number. */ + uint8_t time[4]; /*!< time that the key was created. */ + uint8_t pubkey_algo; /*!< public key algorithm. */ - byte hash_algo; - byte sigtype; - byte hashlen; - byte signhash16[2]; - byte signid[8]; - byte saved; + 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) diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c index 8cf969810..bf6bc8c3c 100644 --- a/rpmio/rpmio.c +++ b/rpmio/rpmio.c @@ -1696,11 +1696,11 @@ rpmop fdOp(FD_t fd, fdOpX opx) return op; } -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; diff --git a/rpmio/rpmio_internal.h b/rpmio/rpmio_internal.h index 43d08da8a..1d8322561 100644 --- a/rpmio/rpmio_internal.h +++ b/rpmio/rpmio_internal.h @@ -544,7 +544,7 @@ assert(dig->sha1ctx == NULL); * @return 0 on success */ int rpmioSlurp(const char * fn, - byte ** bp, ssize_t * blenp); + uint8_t ** bp, ssize_t * blenp); #ifdef __cplusplus } diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c index 1949b0b4d..a188a99dc 100644 --- a/rpmio/rpmpgp.c +++ b/rpmio/rpmpgp.c @@ -201,7 +201,7 @@ static void pgpPrtStr(const char *pre, const char *s) fprintf(stderr, " %s", s); } -static void pgpPrtHex(const char *pre, const byte *p, unsigned int plen) +static void pgpPrtHex(const char *pre, const uint8_t *p, unsigned int plen) { if (!_print) return; if (pre && *pre) @@ -209,7 +209,7 @@ static void pgpPrtHex(const char *pre, const byte *p, unsigned int plen) 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) { if (!_print) return; if (pre && *pre) @@ -220,7 +220,7 @@ void pgpPrtVal(const char * pre, pgpValTbl vs, byte val) /** */ static -const char * pgpMpiHex(const byte *p) +const char * pgpMpiHex(const uint8_t *p) { static char prbuf[2048]; char *t = prbuf; @@ -232,7 +232,7 @@ const char * pgpMpiHex(const byte *p) * @return 0 on success */ static int pgpMpiSet(const char * pre, int lbits, - void *dest, const byte * p, const byte * pend) + void *dest, const uint8_t * p, const uint8_t * pend) { unsigned int mbits = pgpMpiBits(p); unsigned int nbits; @@ -263,7 +263,7 @@ fprintf(stderr, "*** %s %s\n", pre, pgpHexStr(dest, nbytes)); /** * @return NULL on error */ -static SECItem *pgpMpiItem(PRArenaPool *arena, SECItem *item, const byte *p) +static SECItem *pgpMpiItem(PRArenaPool *arena, SECItem *item, const uint8_t *p) { unsigned int nbytes = pgpMpiLen(p)-2; @@ -322,9 +322,9 @@ static SECKEYPublicKey *pgpNewDSAKey(void) return pgpNewPublicKey(dsaKey); } -int pgpPrtSubType(const byte *h, unsigned int hlen, pgpSigType sigtype) +int pgpPrtSubType(const uint8_t *h, unsigned int hlen, pgpSigType sigtype) { - const byte *p = h; + const uint8_t *p = h; unsigned plen; int i; @@ -430,10 +430,10 @@ static const char * pgpSigDSA[] = { #define DSA_SUBPRIME_LEN 20 #endif -static int pgpPrtSigParams(pgpTag tag, byte pubkey_algo, byte sigtype, - const byte *p, const byte *h, unsigned int hlen) +static int pgpPrtSigParams(pgpTag tag, uint8_t pubkey_algo, uint8_t sigtype, + const uint8_t *p, const uint8_t *h, unsigned int hlen) { - const byte * pend = h + hlen; + const uint8_t * pend = h + hlen; int i; SECItem dsaraw; unsigned char dsabuf[2*DSA_SUBPRIME_LEN]; @@ -501,10 +501,10 @@ static int pgpPrtSigParams(pgpTag tag, byte pubkey_algo, byte sigtype, return 0; } -int pgpPrtSig(pgpTag tag, const byte *h, unsigned int hlen) +int pgpPrtSig(pgpTag tag, const uint8_t *h, unsigned int hlen) { - byte version = h[0]; - byte * p; + uint8_t version = h[0]; + uint8_t * p; unsigned plen; int rc; @@ -542,7 +542,7 @@ int pgpPrtSig(pgpTag tag, const byte *h, unsigned int hlen) memcpy(_digp->signhash16, v->signhash16, sizeof(_digp->signhash16)); } - p = ((byte *)v) + sizeof(*v); + p = ((uint8_t *)v) + sizeof(*v); rc = pgpPrtSigParams(tag, v->pubkey_algo, v->sigtype, p, h, hlen); } break; case 4: @@ -651,8 +651,8 @@ static const char * pgpSecretELGAMAL[] = { }; #endif -static const byte * pgpPrtPubkeyParams(byte pubkey_algo, - const byte *p, const byte *h, unsigned int hlen) +static const uint8_t * pgpPrtPubkeyParams(uint8_t pubkey_algo, + const uint8_t *p, const uint8_t *h, unsigned int hlen) { int i; @@ -717,8 +717,8 @@ static const byte * pgpPrtPubkeyParams(byte pubkey_algo, return p; } -static const byte * pgpPrtSeckeyParams(byte pubkey_algo, - const byte *p, const byte *h, unsigned int hlen) +static const uint8_t * pgpPrtSeckeyParams(uint8_t pubkey_algo, + const uint8_t *p, const uint8_t *h, unsigned int hlen) { int i; @@ -788,10 +788,10 @@ static const byte * pgpPrtSeckeyParams(byte pubkey_algo, return p; } -int pgpPrtKey(pgpTag tag, const byte *h, unsigned int hlen) +int pgpPrtKey(pgpTag tag, const uint8_t *h, unsigned int hlen) { - byte version = *h; - const byte * p; + uint8_t version = *h; + const uint8_t * p; unsigned plen; time_t t; int rc; @@ -815,7 +815,7 @@ int pgpPrtKey(pgpTag tag, const byte *h, unsigned int hlen) _digp->pubkey_algo = v->pubkey_algo; } - p = ((byte *)v) + sizeof(*v); + p = ((uint8_t *)v) + sizeof(*v); p = pgpPrtPubkeyParams(v->pubkey_algo, p, h, hlen); rc = 0; } break; @@ -834,7 +834,7 @@ int pgpPrtKey(pgpTag tag, const byte *h, unsigned int hlen) _digp->pubkey_algo = v->pubkey_algo; } - p = ((byte *)v) + sizeof(*v); + p = ((uint8_t *)v) + sizeof(*v); p = pgpPrtPubkeyParams(v->pubkey_algo, p, h, hlen); if (!(tag == PGPTAG_PUBLIC_KEY || tag == PGPTAG_PUBLIC_SUBKEY)) p = pgpPrtSeckeyParams(v->pubkey_algo, p, h, hlen); @@ -847,7 +847,7 @@ int pgpPrtKey(pgpTag tag, const byte *h, unsigned int hlen) return rc; } -int pgpPrtUserID(pgpTag tag, const byte *h, unsigned int hlen) +int pgpPrtUserID(pgpTag tag, const uint8_t *h, unsigned int hlen) { pgpPrtVal("", pgpTagTbl, tag); if (_print) @@ -861,7 +861,7 @@ int pgpPrtUserID(pgpTag tag, const byte *h, unsigned int hlen) return 0; } -int pgpPrtComment(pgpTag tag, const byte *h, unsigned int hlen) +int pgpPrtComment(pgpTag tag, const uint8_t *h, unsigned int hlen) { int i = hlen; @@ -887,12 +887,12 @@ int pgpPrtComment(pgpTag tag, const byte *h, unsigned int hlen) return 0; } -int pgpPubkeyFingerprint(const byte * pkt, unsigned int pktlen, - byte * keyid) +int pgpPubkeyFingerprint(const uint8_t * pkt, unsigned int pktlen, + uint8_t * keyid) { - const byte *s = pkt; + const uint8_t *s = pkt; DIGEST_CTX ctx; - byte version; + uint8_t version; int rc = -1; /* assume failure. */ if (pkt[0] != 0x99) @@ -916,7 +916,7 @@ int pgpPubkeyFingerprint(const byte * pkt, unsigned int pktlen, } break; case 4: { pgpPktKeyV4 v = (pgpPktKeyV4) (pkt + 3); - byte * SHA1 = NULL; + uint8_t * SHA1 = NULL; int i; s += sizeof(pkt[0]) + sizeof(pkt[1]) + sizeof(pkt[2]) + sizeof(*v); @@ -945,9 +945,9 @@ int pgpPubkeyFingerprint(const byte * pkt, unsigned int pktlen, 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)) @@ -957,13 +957,13 @@ int pgpExtractPubkeyFingerprint(const char * b64pkt, byte * keyid) return 8; /* no. of bytes of pubkey signid */ } -int pgpPrtPkt(const byte *pkt, unsigned int pleft) +int pgpPrtPkt(const uint8_t *pkt, unsigned int pleft) { unsigned int val = *pkt; unsigned int pktlen; pgpTag tag; unsigned int plen; - const byte *h; + const uint8_t *h; unsigned int hlen = 0; int rc = 0; @@ -1117,10 +1117,10 @@ pgpDig pgpFreeDig(pgpDig dig) return dig; } -int pgpPrtPkts(const byte * pkts, unsigned int pktlen, pgpDig dig, int printing) +int pgpPrtPkts(const uint8_t * pkts, unsigned int pktlen, pgpDig dig, int printing) { unsigned int val = *pkts; - const byte *p; + const uint8_t *p; unsigned int pleft; int len; @@ -1143,14 +1143,14 @@ int pgpPrtPkts(const byte * pkts, unsigned int pktlen, pgpDig dig, int printing) return 0; } -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; diff --git a/rpmio/rpmpgp.h b/rpmio/rpmpgp.h index 629ad56ce..84b0198f2 100644 --- a/rpmio/rpmpgp.h +++ b/rpmio/rpmpgp.h @@ -18,8 +18,6 @@ extern "C" { #endif -typedef unsigned char byte; - /** */ typedef struct DIGEST_CTX_s * DIGEST_CTX; @@ -111,9 +109,9 @@ extern struct pgpValTbl_s pgpTagTbl[]; * - 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; @@ -317,14 +315,14 @@ extern struct pgpValTbl_s pgpHashTbl[]; * - 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; /** @@ -349,11 +347,11 @@ typedef struct pgpPktSigV3_s { * - 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; /** @@ -522,9 +520,9 @@ typedef union pgpPktSig_u { * */ 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; /** @@ -557,12 +555,12 @@ typedef struct pgpPktSymkey_s { * 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; /** @@ -638,10 +636,10 @@ typedef struct pgpPktOnepass_s { * */ 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; /** @@ -676,9 +674,9 @@ typedef struct pgpPktKeyV3_s { * */ 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; /** @@ -775,8 +773,8 @@ typedef union pgpPktKey_u { * blocks. */ typedef struct pgpPktCdata_s { - byte compressalgo; - byte data[1]; + uint8_t compressalgo; + uint8_t data[1]; } pgpPktCdata; /* @@ -814,7 +812,7 @@ typedef struct pgpPktCdata_s { * session key is incorrect. */ typedef struct pgpPktEdata_s { - byte data[1]; + uint8_t data[1]; } pgpPktEdata; /* @@ -865,9 +863,9 @@ typedef struct pgpPktEdata_s { * 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; /* @@ -884,7 +882,7 @@ typedef struct pgpPktLdata_s { * other than local keyring files. */ typedef struct pgpPktTrust_s { - byte flag; + uint8_t flag; } pgpPktTrust; /* @@ -898,7 +896,7 @@ typedef struct pgpPktTrust_s { * */ typedef struct pgpPktUid_s { - byte userid[1]; + uint8_t userid[1]; } pgpPktUid; /** @@ -973,7 +971,7 @@ typedef enum rpmDigestFlags_e { * @return native-endian integer */ static inline -unsigned int pgpGrab(const byte *s, int nbytes) +unsigned int pgpGrab(const uint8_t *s, int nbytes) { unsigned int i = 0; int nb = (nbytes <= sizeof(i) ? nbytes : sizeof(i)); @@ -989,7 +987,7 @@ unsigned int pgpGrab(const byte *s, int nbytes) * @return no. of bytes in length prefix */ static inline -int pgpLen(const byte *s, unsigned int *lenp) +int pgpLen(const uint8_t *s, unsigned int *lenp) { if (*s < 192) { (*lenp) = *s++; @@ -1009,7 +1007,7 @@ int pgpLen(const byte *s, unsigned int *lenp) * @return no. of bits */ static inline -unsigned int pgpMpiBits(const byte *p) +unsigned int pgpMpiBits(const uint8_t *p) { return ((p[0] << 8) | p[1]); } @@ -1020,7 +1018,7 @@ unsigned int pgpMpiBits(const byte *p) * @return no. of bytes */ static inline -unsigned int pgpMpiLen(const byte *p) +unsigned int pgpMpiLen(const uint8_t *p) { return (2 + ((pgpMpiBits(p)+7)>>3)); } @@ -1033,7 +1031,7 @@ unsigned int pgpMpiLen(const byte *p) * @return target buffer */ static inline -char * pgpHexCvt(char *t, const byte *s, int nbytes) +char * pgpHexCvt(char *t, const uint8_t *s, int nbytes) { static char hex[] = "0123456789abcdef"; while (nbytes-- > 0) { @@ -1054,7 +1052,7 @@ char * pgpHexCvt(char *t, const byte *s, int nbytes) * @return hex formatted string */ static inline -char * pgpHexStr(const byte *p, unsigned int plen) +char * pgpHexStr(const uint8_t *p, unsigned int plen) { static char prbuf[8*BUFSIZ]; /* XXX ick */ char *t = prbuf; @@ -1069,7 +1067,7 @@ char * pgpHexStr(const byte *p, unsigned int plen) * @return hex formatted string */ static inline -const char * pgpMpiStr(const byte *p) +const char * pgpMpiStr(const uint8_t *p) { static char prbuf[8*BUFSIZ]; /* XXX ick */ char *t = prbuf; @@ -1086,7 +1084,7 @@ const char * pgpMpiStr(const byte *p) * @return string value of byte */ static inline -const char * pgpValStr(pgpValTbl vs, byte val) +const char * pgpValStr(pgpValTbl vs, uint8_t val) { do { if (vs->val == val) @@ -1119,7 +1117,7 @@ int pgpValTok(pgpValTbl vs, const char * s, const char * se) * @param vs table of (string,value) pairs * @param val byte value to print */ -void pgpPrtVal(const char * pre, pgpValTbl vs, byte val); +void pgpPrtVal(const char * pre, pgpValTbl vs, uint8_t val); /** * Print/parse an OpenPGP subtype packet. @@ -1128,7 +1126,7 @@ void pgpPrtVal(const char * pre, pgpValTbl vs, byte val); * @param sigtype signature type * @return 0 on success */ -int pgpPrtSubType(const byte *h, unsigned int hlen, pgpSigType sigtype); +int pgpPrtSubType(const uint8_t *h, unsigned int hlen, pgpSigType sigtype); /** * Print/parse an OpenPGP signature packet. @@ -1137,7 +1135,7 @@ int pgpPrtSubType(const byte *h, unsigned int hlen, pgpSigType sigtype); * @param hlen packet length (no. of bytes) * @return 0 on success */ -int pgpPrtSig(pgpTag tag, const byte *h, unsigned int hlen); +int pgpPrtSig(pgpTag tag, const uint8_t *h, unsigned int hlen); /** * Print/parse an OpenPGP key packet. @@ -1146,7 +1144,7 @@ int pgpPrtSig(pgpTag tag, const byte *h, unsigned int hlen); * @param hlen packet length (no. of bytes) * @return 0 on success */ -int pgpPrtKey(pgpTag tag, const byte *h, unsigned int hlen); +int pgpPrtKey(pgpTag tag, const uint8_t *h, unsigned int hlen); /** * Print/parse an OpenPGP userid packet. @@ -1155,7 +1153,7 @@ int pgpPrtKey(pgpTag tag, const byte *h, unsigned int hlen); * @param hlen packet length (no. of bytes) * @return 0 on success */ -int pgpPrtUserID(pgpTag tag, const byte *h, unsigned int hlen); +int pgpPrtUserID(pgpTag tag, const uint8_t *h, unsigned int hlen); /** * Print/parse an OpenPGP comment packet. @@ -1164,7 +1162,7 @@ int pgpPrtUserID(pgpTag tag, const byte *h, unsigned int hlen); * @param hlen packet length (no. of bytes) * @return 0 on success */ -int pgpPrtComment(pgpTag tag, const byte *h, unsigned int hlen); +int pgpPrtComment(pgpTag tag, const uint8_t *h, unsigned int hlen); /** * Calculate OpenPGP public key fingerprint. @@ -1174,8 +1172,8 @@ int pgpPrtComment(pgpTag tag, const byte *h, unsigned int hlen); * @retval keyid publick key fingerprint * @return 0 on sucess, else -1 */ -int pgpPubkeyFingerprint(const byte * pkt, unsigned int pktlen, - byte * keyid); +int pgpPubkeyFingerprint(const uint8_t * pkt, unsigned int pktlen, + uint8_t * keyid); /** * Extract OpenPGP public key fingerprint from base64 encoded packet. @@ -1184,7 +1182,7 @@ int pgpPubkeyFingerprint(const byte * pkt, unsigned int pktlen, * @retval keyid[8] public key fingerprint * @return 8 (no. of bytes) on success, < 0 on error */ -int pgpExtractPubkeyFingerprint(const char * b64pkt, byte * keyid); +int pgpExtractPubkeyFingerprint(const char * b64pkt, uint8_t * keyid); /** @@ -1193,7 +1191,7 @@ int pgpExtractPubkeyFingerprint(const char * b64pkt, byte * keyid); * @param pleft no. bytes remaining * @return -1 on error, otherwise this packet length */ -int pgpPrtPkt(const byte *pkt, unsigned int pleft); +int pgpPrtPkt(const uint8_t *pkt, unsigned int pleft); /** * Print/parse a OpenPGP packet(s). @@ -1203,7 +1201,7 @@ int pgpPrtPkt(const byte *pkt, unsigned int pleft); * @param printing should packets be printed? * @return -1 on error, 0 on success */ -int pgpPrtPkts(const byte *pkts, unsigned int pktlen, pgpDig dig, int printing); +int pgpPrtPkts(const uint8_t *pkts, unsigned int pktlen, pgpDig dig, int printing); /** * Parse armored OpenPGP packets from a file. @@ -1213,7 +1211,7 @@ int pgpPrtPkts(const byte *pkts, unsigned int pktlen, pgpDig dig, int printing); * @return type of armor found */ pgpArmor pgpReadPkts(const char * fn, - const byte ** pkt, size_t * pktlen); + const uint8_t ** pkt, size_t * pktlen); /** * Wrap a OpenPGP packets in ascii armor for transport. @@ -1249,7 +1247,7 @@ pgpDig pgpFreeDig(pgpDig dig); * @return 1 if an OpenPGP packet, 0 otherwise */ static inline -int pgpIsPkt(const byte * p) +int pgpIsPkt(const uint8_t * p) { unsigned int val = *p++; pgpTag tag; @@ -1308,7 +1306,7 @@ int pgpIsPkt(const byte * p) * @return crc of buffer */ 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; int i; diff --git a/tools/debugedit.c b/tools/debugedit.c index d187f24fb..cf8fb1f24 100644 --- a/tools/debugedit.c +++ b/tools/debugedit.c @@ -1418,7 +1418,7 @@ handle_build_id (DSO *dso, Elf_Data *build_id, /* Now format the build ID bits in hex to print out. */ { - const byte * id = (byte *)build_id->d_buf + build_id_offset; + const uint8_t * id = (uint8_t *)build_id->d_buf + build_id_offset; char hex[build_id_size * 2 + 1]; pgpHexCvt(hex, id, build_id_size); puts (hex); |