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__)
996 #define PGPARMOR_ERROR PGPARMOR_ERR_NO_BEGIN_PGP
1032 #if defined(_RPMPGP_INTERNAL)
1080 size_t nb = (nbytes <=
sizeof(
i) ? nbytes :
sizeof(i));
1082 i = (i << 8) | *s++;
1097 *lenp = (
unsigned int) *s++;
1100 *lenp = (
unsigned int) ((((
unsigned)s[0]) - 192) << 8) + (
unsigned)s[1] + 192;
1118 return (
unsigned int) ((p[0] << 8) | p[1]);
1145 static char hex[] =
"0123456789abcdef";
1146 while (nbytes-- > 0) {
1148 i = (
unsigned int) *s++;
1149 *t++ = hex[ (i >> 4) & 0xf ];
1150 *t++ = hex[ (
i ) & 0xf ];
1167 static char prbuf[8*BUFSIZ];
1184 static char prbuf[8*BUFSIZ];
1203 if (vs->
val == (
int)val)
1205 }
while ((++vs)->val != -1);
1221 size_t vlen = strlen(vs->
str);
1222 if (vlen <= (
size_t)(se-s) && !strncmp(s, vs->
str, vlen))
1224 }
while ((++vs)->
val != -1);
1247 #if defined(_RPMPGP_INTERNAL)
1260 #if defined(_RPMPGP_INTERNAL)
1284 #if defined(_RPMPGP_INTERNAL)
1295 #if defined(_RPMPGP_INTERNAL)
1308 #if defined(_RPMPGP_INTERNAL)
1348 #if defined(_RPMPGP_INTERNAL)
1446 #define pgpDigUnlink(_dig) \
1447 ((pgpDig)rpmioUnlinkPoolItem((rpmioItem)(_dig), __FUNCTION__, __FILE__, __LINE__))
1457 #define pgpDigLink(_dig) \
1458 ((pgpDig)rpmioLinkPoolItem((rpmioItem)(_dig), __FUNCTION__, __FILE__, __LINE__))
1468 #define pgpDigFree(_dig) \
1469 ((pgpDig)rpmioFreePoolItem((rpmioItem)(_dig), __FUNCTION__, __FILE__, __LINE__))
1577 int (*findPubkey) (
void *ts,
void *dig),
1599 unsigned int val = (
unsigned int) *p++;
1608 tag = (
pgpTag)(val & 0x3f);
1610 tag = (
pgpTag)((val >> 2) & 0xf);
1647 #define CRC24_INIT 0xb704ce
1648 #define CRC24_POLY 0x1864cfb
1664 crc ^= (*octets++) << 16;
1665 for (i = 0; i < 8; i++) {
1667 if (crc & 0x1000000)
1671 return crc & 0xffffff;
1718 typedef void * (*pgpImplFree_t) (
void * impl)
1723 typedef void * (*pgpImplInit_t) (
void)
1799 ? (*pgpImplVecs->
_pgpErrChk) (dig, msg, rc, expected)
1897 return (*pgpImplVecs->
_pgpFree) (impl);
1906 return (*pgpImplVecs->
_pgpInit) ();
static unsigned int pgpMpiBits(const rpmuint8_t *p)
Return no.
void pgpHexCvt(t, md5sum, md5len)
const rpmuint8_t * pgpPrtPubkeyParams(pgpDig dig, const pgpPkt pp, pgpPubkeyAlgo pubkey_algo, const rpmuint8_t *p)
pgpImplVecs_t * pgpImplVecs
struct pgpPktLdata_s pgpPktLdata
5.8.
void pgpPrtVal(const char *pre, pgpValTbl vs, rpmuint8_t val)
Print an OpenPGP value.
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 pgpPktSigV4_s * pgpPktSigV4
5.2.3.
struct pgpPktTrust_s pgpPktTrust
5.10.
int(* pgpImplSign_t)(pgpDig dig)
void *(* pgpImplFree_t)(void *impl)
struct pgpPktPubkey_s pgpPktPubkey
5.1.
int pgpPktLen(const rpmuint8_t *pkt, size_t pleft, pgpPkt pp)
static int pgpImplAvailableDigest(pgpDig dig, int algo)
int pgpExtractPubkeyFingerprint(const char *b64pkt, rpmuint8_t *keyid)
Extract OpenPGP public key fingerprint from base64 encoded packet.
int(* pgpImplErrChk_t)(pgpDig dig, const char *msg, int rc, unsigned expected)
pgpImplAvailable_t _pgpAvailableCipher
struct pgpPktKeyV3_s * pgpPktKeyV3
5.5.1.
int pgpPrtPkt(const rpmuint8_t *pkt, size_t pleft)
Return lenth of a OpenPGP packet.
enum pgpSymkeyAlgo_e pgpSymkeyAlgo
9.2.
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 pgpPktCdata_s pgpPktCdata
5.6.
pgpImplSet_t _pgpSetECDSA
int pgpFindPubkey(pgpDig dig)
Call find pubkey vector.
struct pgpPktKeyV4_s * pgpPktKeyV4
The version 4 format is similar to the version 3 format except for the absence of a validity period...
enum pgpCompressAlgo_e pgpCompressAlgo
9.3.
static int pgpImplGenerate(pgpDig dig)
void pgpDigClean(pgpDig dig)
Release (malloc'd) data from container.
pgpImplMpiItem_t _pgpMpiItem
#define pgpDigUnlink(_dig)
enum pgpArmorKey_e pgpArmorKey
static int pgpImplSign(pgpDig dig)
static int pgpImplAvailableCipher(pgpDig dig, int algo)
static int pgpImplSetELG(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
static int pgpImplSetDSA(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
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.
pgpDig pgpDigNew(pgpVSFlags vsflags, pgpPubkeyAlgo pubkey_algo)
Create a container for parsed OpenPGP packates.
static unsigned int pgpCRC(const rpmuint8_t *octets, size_t len)
Return CRC of a buffer.
pgpImplAvailable_t _pgpAvailableDigest
struct pgpValTbl_s pgpTagTbl[]
static void * pgpImplFree(void *impl)
struct pgpPktSymkey_s pgpPktSymkey
5.3.
static void * pgpImplInit(void)
pgpVSFlags pgpDigVSFlags
Disabler bits(s) for signature/digest checking.
struct pgpValTbl_s pgpHashTbl[]
Hash (string, value) pairs.
void *(* pgpImplInit_t)(void)
static char * pgpHexStr(const rpmuint8_t *p, size_t plen)
Return hex formatted representation of bytes.
int pgpPrtSigParams(pgpDig dig, const pgpPkt pp, pgpPubkeyAlgo pubkey_algo, pgpSigType sigtype, const rpmuint8_t *p)
enum pgpHashAlgo_e pgpHashAlgo
9.4.
int(* pgpImplAvailable_t)(pgpDig dig, int algo)
struct pgpPktEdata_s pgpPktEdata
5.7.
void * pgpStatsAccumulator(pgpDig dig, int opx)
Return pgpDig container accumulator structure.
pgpDigParams pgpGetSignature(pgpDig dig)
Return OpenPGP signature parameters.
enum pgpVSFlags_e pgpVSFlags
Bit(s) to control digest and signature verification.
int pgpPrtPkts(const rpmuint8_t *pkts, size_t pktlen, pgpDig dig, int printing)
Print/parse a OpenPGP packet(s).
union pgpPktKey_u pgpPktKey
5.5.3.
struct pgpValTbl_s * pgpValTbl
struct pgpValTbl_s pgpArmorTbl[]
Armor (string, value) pairs.
static int pgpImplSetECDSA(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
enum pgpSubType_e pgpSubType
5.2.3.1.
static int pgpImplErrChk(pgpDig dig, const char *msg, int rc, unsigned expected)
pgpImplAvailable_t _pgpAvailablePubkey
static const char * pgpMpiStr(const rpmuint8_t *p)
Return hex formatted representation of a multiprecision integer.
rpmuint32_t pgpGetSigtype(pgpDig dig)
Get signature tag type.
pgpImplErrChk_t _pgpErrChk
pgpImplVerify_t _pgpVerify
char * pgpArmorWrap(rpmuint8_t atype, const unsigned char *s, size_t ns)
Wrap a OpenPGP packets in ascii armor for transport.
Cumulative statistics for an operation.
struct pgpPktUid_s pgpPktUid
5.11.
static unsigned int pgpLen(const rpmuint8_t *s, unsigned int *lenp)
Return length of an OpenPGP packet.
rpmuint32_t pgpGetSigtag(pgpDig dig)
Get signature tag.
int rpmbcExportSignature(pgpDig dig, DIGEST_CTX ctx)
static int pgpImplSetRSA(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
struct pgpPktSigV3_s * pgpPktSigV3
5.2.2.
void(* pgpImplClean_t)(void *impl)
int(* pgpImplMpiItem_t)(const char *pre, pgpDig dig, int itemno, const rpmuint8_t *p, const rpmuint8_t *pend)
int pgpPrtSubType(const rpmuint8_t *h, size_t hlen, pgpSigType sigtype)
int pgpPrtComment(const pgpPkt pp)
struct pgpValTbl_s pgpArmorKeyTbl[]
Armor key (string, value) pairs.
static void pgpImplClean(void *impl)
static int pgpIsPkt(const rpmuint8_t *p, pgpTag *tagp)
Is buffer at beginning of an OpenPGP packet?
static unsigned int pgpMpiLen(const rpmuint8_t *p)
Return no.
int(* pgpImplGenerate_t)(pgpDig dig)
int pgpSetFindPubkey(pgpDig dig, int(*findPubkey)(void *ts, void *dig), void *_ts)
Set find pubkey vector.
struct pgpValTbl_s pgpSubTypeTbl[]
Subtype (string, value) pairs.
const void * pgpGetSig(pgpDig dig)
Get signature tag data, i.e.
int pgpPrtUserID(const pgpPkt pp)
static int pgpImplVerify(pgpDig dig)
struct pgpDigParams_s * pgpDigParams
struct pgpValTbl_s pgpSymkeyTbl[]
Symmetric key (string, value) pairs.
static const char * pgpValStr(pgpValTbl vs, rpmuint8_t val)
Return string representation of am OpenPGP value.
pgpHashAlgo pgpHashAlgoStringToNumber(const char *name, size_t name_len)
Convert a hash algorithm "foo" to the internal PGPHASHALGO_FOO number.
static void
Print copy of spec file, filling in Group/Description/Summary from specspo.
int pgpSetSig(pgpDig dig, rpmuint32_t sigtag, rpmuint32_t sigtype, const void *sig, rpmuint32_t siglen)
Set signature tag info, i.e.
rpmuint32_t pgpGetSiglen(pgpDig dig)
Get signature tag data length, i.e.
enum pgpSigType_e pgpSigType
5.2.1.
static PyObject *unsigned char * pkt
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.
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
int rpmbcExportPubkey(pgpDig dig)
union pgpPktSig_u * pgpPktSig
5.2.
int(* pgpImplVerify_t)(pgpDig dig)
static int pgpValTok(pgpValTbl vs, const char *s, const char *se)
Return value of an OpenPGP string.
pgpArmor pgpArmorUnwrap(rpmiob iob, rpmuint8_t **pkt, size_t *pktlen)
Parse armored OpenPGP packets from an iob.
pgpImplGenerate_t _pgpGenerate
int(* pgpImplSet_t)(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
The version 4 format is similar to the version 3 format except for the absence of a validity period...
int pgpPrtSig(const pgpPkt pp)
pgpDigParams pgpGetPubkey(pgpDig dig)
Return OpenPGP pubkey parameters.
struct pgpValTbl_s pgpCompressionTbl[]
Compression (string, value) pairs.
struct pgpValTbl_s pgpPubkeyTbl[]
int pgpPrtKey(const pgpPkt pp)
struct pgpPktOnepass_s * pgpPktOnepass
5.4.
struct pgpValTbl_s pgpSigTypeTbl[]