18 #if defined(_RPMPGP_INTERNAL) 27 struct pgpDigParams_s {
47 #define PGPDIG_SAVED_TIME (1 << 0) 48 #define PGPDIG_SAVED_ID (1 << 1) 57 struct pgpDigParams_s signature;
58 struct pgpDigParams_s pubkey;
61 const char * pubkey_algoN;
63 const char * hash_algoN;
77 int (*findPubkey) (
void * _ts,
void * _dig)
105 #if defined(__LCLINT__) 997 #define PGPARMOR_ERROR PGPARMOR_ERR_NO_BEGIN_PGP 1033 #if defined(_RPMPGP_INTERNAL) 1052 unsigned int pktlen;
1081 size_t nb = (nbytes <=
sizeof(i) ? nbytes :
sizeof(i));
1083 i = (i << 8) | *s++;
1098 *lenp = (
unsigned int) *s++;
1101 *lenp = (
unsigned int) ((((
unsigned)s[0]) - 192) << 8) + (unsigned)s[1] + 192;
1119 return (
unsigned int) ((p[0] << 8) | p[1]);
1146 static char hex[] =
"0123456789abcdef";
1147 while (nbytes-- > 0) {
1149 i = (
unsigned int) *s++;
1150 *t++ = hex[ (i >> 4) & 0xf ];
1151 *t++ = hex[ (i ) & 0xf ];
1168 static char prbuf[8*BUFSIZ];
1185 static char prbuf[8*BUFSIZ];
1187 sprintf(t,
"[%4u]: ",
pgpGrab(p, 2));
1204 if (vs->
val == (
int)val)
1206 }
while ((++vs)->val != -1);
1222 size_t vlen = strlen(vs->
str);
1223 if (vlen <= (
size_t)(se-s) && !strncmp(s, vs->
str, vlen))
1225 }
while ((++vs)->val != -1);
1248 #if defined(_RPMPGP_INTERNAL) 1261 #if defined(_RPMPGP_INTERNAL) 1285 #if defined(_RPMPGP_INTERNAL) 1296 #if defined(_RPMPGP_INTERNAL) 1309 #if defined(_RPMPGP_INTERNAL) 1349 #if defined(_RPMPGP_INTERNAL) 1447 #define pgpDigUnlink(_dig) \ 1448 ((pgpDig)rpmioUnlinkPoolItem((rpmioItem)(_dig), __FUNCTION__, __FILE__, __LINE__)) 1458 #define pgpDigLink(_dig) \ 1459 ((pgpDig)rpmioLinkPoolItem((rpmioItem)(_dig), __FUNCTION__, __FILE__, __LINE__)) 1469 #define pgpDigFree(_dig) \ 1470 ((pgpDig)rpmioFreePoolItem((rpmioItem)(_dig), __FUNCTION__, __FILE__, __LINE__)) 1578 int (*findPubkey) (
void *ts,
void *dig),
1600 unsigned int val = (
unsigned int) *p++;
1609 tag = (
pgpTag)(val & 0x3f);
1611 tag = (
pgpTag)((val >> 2) & 0xf);
1648 #define CRC24_INIT 0xb704ce 1649 #define CRC24_POLY 0x1864cfb 1665 crc ^= (*octets++) << 16;
1666 for (i = 0; i < 8; i++) {
1668 if (crc & 0x1000000)
1672 return crc & 0xffffff;
1719 typedef void * (*pgpImplFree_t) (
void * impl)
1724 typedef void * (*pgpImplInit_t) (void)
1763 return (*pgpImplVecs->
_pgpSetRSA) (ctx, dig, sigp);
1772 return (*pgpImplVecs->
_pgpSetDSA) (ctx, dig, sigp);
1781 return (*pgpImplVecs->
_pgpSetELG) (ctx, dig, sigp);
1800 ? (*pgpImplVecs->
_pgpErrChk) (dig, msg, rc, expected)
1877 return (*pgpImplVecs->
_pgpMpiItem) (pre, dig, itemno, p, pend);
1898 return (*pgpImplVecs->
_pgpFree) (impl);
1907 return (*pgpImplVecs->
_pgpInit) ();
static int pgpValTok(pgpValTbl vs, const char *s, const char *se)
Return value of an OpenPGP string.
int(* pgpImplSet_t)(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
int pgpSetSig(pgpDig dig, rpmuint32_t sigtag, rpmuint32_t sigtype, const void *sig, rpmuint32_t siglen)
Set signature tag info, i.e.
const rpmuint8_t * pgpPrtPubkeyParams(pgpDig dig, const pgpPkt pp, pgpPubkeyAlgo pubkey_algo, const rpmuint8_t *p)
int rpmbcExportSignature(pgpDig dig, DIGEST_CTX ctx)
int(* pgpImplVerify_t)(pgpDig dig)
static const char * pgpValStr(pgpValTbl vs, rpmuint8_t val)
Return string representation of am OpenPGP value.
static unsigned int pgpCRC(const rpmuint8_t *octets, size_t len)
Return CRC of a buffer.
int(* pgpImplMpiItem_t)(const char *pre, pgpDig dig, int itemno, const rpmuint8_t *p, const rpmuint8_t *pend)
void(* pgpImplClean_t)(void *impl)
struct pgpPktPubkey_s pgpPktPubkey
5.1.
struct pgpValTbl_s pgpArmorTbl[]
Armor (string, value) pairs.
int pgpPktLen(const rpmuint8_t *pkt, size_t pleft, pgpPkt pp)
static int pgpImplAvailableDigest(pgpDig dig, int algo)
const void * pgpGetSig(const pgpDig dig)
Get signature tag data, i.e.
enum pgpCompressAlgo_e pgpCompressAlgo
9.3.
pgpImplAvailable_t _pgpAvailableCipher
enum pgpSubType_e pgpSubType
5.2.3.1.
struct pgpDigParams_s * pgpDigParams
static unsigned int pgpLen(const rpmuint8_t *s, unsigned int *lenp)
Return length of an OpenPGP packet.
static unsigned int pgpGrab(const rpmuint8_t *s, size_t nbytes)
Return (native-endian) integer from big-endian representation.
enum pgpHashAlgo_e pgpHashAlgo
9.4.
struct pgpValTbl_s pgpCompressionTbl[]
Compression (string, value) pairs.
pgpImplSet_t _pgpSetECDSA
static rpmVSFlags vsflags
union pgpPktKey_u pgpPktKey
5.5.3.
int pgpGrabPkts(const rpmuint8_t *pkts, size_t pktlen, rpmuint8_t ***pppkts, int *pnpkts)
Return array of packet pointers.
enum pgpSigType_e pgpSigType
5.2.1.
static int pgpImplGenerate(pgpDig dig)
int rpmbcExportPubkey(pgpDig dig)
pgpDig pgpDigNew(pgpVSFlags vsflags, pgpPubkeyAlgo pubkey_algo)
Create a container for parsed OpenPGP packates.
char * pgpArmorWrap(rpmuint8_t atype, const unsigned char *s, size_t ns)
Wrap a OpenPGP packets in ascii armor for transport.
pgpImplMpiItem_t _pgpMpiItem
#define pgpDigUnlink(_dig)
struct pgpValTbl_s pgpArmorKeyTbl[]
Armor key (string, value) pairs.
static int pgpImplSign(pgpDig dig)
static int pgpImplAvailableCipher(pgpDig dig, int algo)
struct pgpValTbl_s pgpSubTypeTbl[]
Subtype (string, value) pairs.
static int pgpImplSetELG(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
static int pgpImplSetDSA(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
struct pgpPktTrust_s pgpPktTrust
5.10.
struct pgpPktEdata_s pgpPktEdata
5.7.
static int pgpIsPkt(const rpmuint8_t *p, pgpTag *tagp)
Is buffer at beginning of an OpenPGP packet?
pgpHashAlgo pgpHashAlgoStringToNumber(const char *name, size_t name_len)
Convert a hash algorithm "foo" to the internal PGPHASHALGO_FOO number.
pgpDigParams pgpGetPubkey(const pgpDig dig)
Return OpenPGP pubkey parameters.
pgpImplAvailable_t _pgpAvailableDigest
static void * pgpImplFree(void *impl)
static void * pgpImplInit(void)
int(* pgpImplErrChk_t)(pgpDig dig, const char *msg, int rc, unsigned expected)
void *(* pgpImplInit_t)(void)
int pgpExtractPubkeyFingerprint(const char *b64pkt, rpmuint8_t *keyid)
Extract OpenPGP public key fingerprint from base64 encoded packet.
static int crc(FD_t fd, uint32_t *cval, uint32_t *clen)
struct pgpPktSigV4_s * pgpPktSigV4
5.2.3.
struct pgpPktLdata_s pgpPktLdata
5.8.
int pgpPrtSigParams(pgpDig dig, const pgpPkt pp, pgpPubkeyAlgo pubkey_algo, pgpSigType sigtype, const rpmuint8_t *p)
struct pgpValTbl_s pgpSigTypeTbl[]
unsigned char rpmuint8_t
Private int typedefs to avoid C99 portability issues.
int pgpPrtPkt(const rpmuint8_t *pkt, size_t pleft)
Return lenth of a OpenPGP packet.
rpmuint32_t pgpGetSigtype(const pgpDig dig)
Get signature tag type.
static const char * pgpMpiStr(const rpmuint8_t *p)
Return hex formatted representation of a multiprecision integer.
void pgpDigClean(pgpDig dig)
Release (malloc'd) data from container.
struct pgpPktUid_s pgpPktUid
5.11.
struct pgpValTbl_s pgpSymkeyTbl[]
Symmetric key (string, value) pairs.
static unsigned int pgpMpiBits(const rpmuint8_t *p)
Return no.
static char * pgpHexCvt(char *t, const rpmuint8_t *s, size_t nbytes)
Convert to hex.
enum pgpVSFlags_e pgpVSFlags
Bit(s) to control digest and signature verification.
pgpArmor pgpReadPkts(const char *fn, rpmuint8_t **pkt, size_t *pktlen)
Parse armored OpenPGP packets from a file.
int pgpPubkeyFingerprint(const rpmuint8_t *pkt, size_t pktlen, rpmuint8_t *keyid)
Print/parse an OpenPGP subtype packet.
void * pgpStatsAccumulator(pgpDig dig, int opx)
Return pgpDig container accumulator structure.
enum pgpArmorKey_e pgpArmorKey
struct pgpValTbl_s pgpPubkeyTbl[]
struct pgpPktCdata_s pgpPktCdata
5.6.
static int pgpImplSetECDSA(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
static int pgpImplErrChk(pgpDig dig, const char *msg, int rc, unsigned expected)
pgpImplAvailable_t _pgpAvailablePubkey
struct pgpPktKeyV4_s * pgpPktKeyV4
The version 4 format is similar to the version 3 format except for the absence of a validity period...
pgpVSFlags pgpDigVSFlags
Disabler bits(s) for signature/digest checking.
pgpImplErrChk_t _pgpErrChk
pgpImplVerify_t _pgpVerify
int pgpPrtPkts(const rpmuint8_t *pkts, size_t pktlen, pgpDig dig, int printing)
Print/parse a OpenPGP packet(s).
pgpImplVecs_t * pgpImplVecs
Cumulative statistics for an operation.
int pgpFindPubkey(pgpDig dig)
Call find pubkey vector.
union pgpPktSig_u * pgpPktSig
5.2.
static int pgpImplSetRSA(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
int(* pgpImplSign_t)(pgpDig dig)
int(* pgpImplGenerate_t)(pgpDig dig)
rpmuint32_t pgpGetSiglen(const pgpDig dig)
Get signature tag data length, i.e.
enum pgpPubkeyAlgo_e pgpPubkeyAlgo
9.1.
static unsigned int pgpMpiLen(const rpmuint8_t *p)
Return no.
int pgpPrtSubType(const rpmuint8_t *h, size_t hlen, pgpSigType sigtype)
int pgpPrtComment(const pgpPkt pp)
static void pgpImplClean(void *impl)
struct pgpPktSigV3_s * pgpPktSigV3
5.2.2.
int pgpPrtUserID(const pgpPkt pp)
static int pgpImplVerify(pgpDig dig)
enum pgpSymkeyAlgo_e pgpSymkeyAlgo
9.2.
const struct pgpValTbl_s * pgpValTbl
rpmuint32_t pgpGetSigtag(const pgpDig dig)
Get signature tag.
int pgpSetFindPubkey(pgpDig dig, int(*findPubkey)(void *ts, void *dig), void *_ts)
Set find pubkey vector.
struct pgpPktSymkey_s pgpPktSymkey
5.3.
void pgpPrtVal(const char *pre, pgpValTbl vs, rpmuint8_t val)
Print an OpenPGP value.
struct pgpValTbl_s pgpTagTbl[]
static int pgpImplMpiItem(const char *pre, pgpDig dig, int itemno, const rpmuint8_t *p, const rpmuint8_t *pend)
static int pgpImplAvailablePubkey(pgpDig dig, int algo)
struct pgpImplVecs_s pgpImplVecs_t
pgpArmor pgpArmorUnwrap(rpmiob iob, rpmuint8_t **pkt, size_t *pktlen)
Parse armored OpenPGP packets from an iob.
static char * pgpHexStr(const rpmuint8_t *p, size_t plen)
Return hex formatted representation of bytes.
int(* pgpImplAvailable_t)(pgpDig dig, int algo)
struct pgpValTbl_s pgpHashTbl[]
Hash (string, value) pairs.
pgpDigParams pgpGetSignature(const pgpDig dig)
Return OpenPGP signature parameters.
struct pgpPktKeyV3_s * pgpPktKeyV3
5.5.1.
pgpImplGenerate_t _pgpGenerate
The version 4 format is similar to the version 3 format except for the absence of a validity period...
int pgpPrtSig(const pgpPkt pp)
void *(* pgpImplFree_t)(void *impl)
struct pgpPktOnepass_s * pgpPktOnepass
5.4.
int pgpPrtKey(const pgpPkt pp)