rpm  5.4.15
rpmpgp.h
Go to the documentation of this file.
1 #ifndef H_RPMPGP
2 #define H_RPMPGP
3 
13 #include <string.h>
14 #include <popt.h>
15 #include <rpmiotypes.h>
16 #include <yarn.h>
17 
18 #if defined(_RPMPGP_INTERNAL)
19 #include <rpmsw.h>
20 
21 /*@unchecked@*/
22 extern int _pgp_error_count;
23 
27 struct pgpDigParams_s {
28 /*@only@*/ /*@null@*/
29  const char * userid;
30 /*@dependent@*/ /*@null@*/
31  const rpmuint8_t * hash;
32  rpmuint8_t tag;
33 
34  rpmuint8_t version;
35  rpmuint8_t time[4];
36  rpmuint8_t pubkey_algo;
38  rpmuint8_t hash_algo;
39  rpmuint8_t sigtype;
40  size_t hashlen;
41  rpmuint8_t signhash16[2];
42  rpmuint8_t signid[8];
43  rpmuint8_t expire[4];
44  rpmuint8_t keyexpire[4];
46  rpmuint8_t saved;
47 #define PGPDIG_SAVED_TIME (1 << 0)
48 #define PGPDIG_SAVED_ID (1 << 1)
49 
50 };
51 
55 struct pgpDig_s {
56  struct rpmioItem_s _item;
57  struct pgpDigParams_s signature;
58  struct pgpDigParams_s pubkey;
59 
60 /*@observer@*/ /*@null@*/
61  const char * build_sign;
62 /*@observer@*/ /*@null@*/
63  const char * pubkey_algoN;
64 /*@observer@*/ /*@null@*/
65  const char * hash_algoN;
66 
67  rpmuint32_t sigtag;
68  rpmuint32_t sigtype;
69 /*@relnull@*/
70  const void * sig;
71  size_t siglen;
72  const void * pub;
73  size_t publen;
76  struct rpmop_s dops;
77  struct rpmop_s sops;
79  int (*findPubkey) (void * _ts, /*@null@*/ void * _dig)
80  /*@modifies *_ts, *_dig @*/;
81 /*@null@*/
82  void * _ts;
84  rpmuint8_t ** ppkts;
85  int npkts;
86  size_t nbytes;
88 /*@only@*/ /*@null@*/
89  DIGEST_CTX hsha;
90 /*@only@*/ /*@null@*/
91  DIGEST_CTX hdsa;
92 /*@only@*/ /*@null@*/
93  void * sha1;
94  size_t sha1len;
96 /*@only@*/ /*@null@*/
97  DIGEST_CTX hecdsa;
99 /*@only@*/ /*@null@*/
100  DIGEST_CTX md5ctx;
101 /*@only@*/ /*@null@*/
102  DIGEST_CTX hrsa;
103 /*@only@*/ /*@null@*/
104  void * md5;
105  size_t md5len;
107 /*@owned@*/ /*@relnull@*/
108  void * impl;
110 #if defined(__LCLINT__)
111 /*@refs@*/
112  int nrefs;
113 #endif
114 };
115 #endif /* _RPMPGP_INTERNAL */
116 
119 typedef const struct pgpValTbl_s {
120  int val;
121 /*@observer@*/
122  const char * str;
123 } * pgpValTbl;
124 
132 typedef enum pgpTag_e {
151  PGPTAG_MDC = 19,
156 } pgpTag;
157 
160 /*@observer@*/ /*@unchecked@*/ /*@unused@*/
161 extern struct pgpValTbl_s pgpTagTbl[];
162 
197 typedef struct pgpPktPubkey_s {
201 } pgpPktPubkey;
202 
209 /*@-typeuse@*/
210 typedef enum pgpSigType_e {
230 } pgpSigType;
231 /*@=typeuse@*/
232 
235 /*@observer@*/ /*@unchecked@*/ /*@unused@*/
236 extern struct pgpValTbl_s pgpSigTypeTbl[];
237 
261 /*@-typeuse@*/
262 typedef enum pgpPubkeyAlgo_e {
273 } pgpPubkeyAlgo;
274 /*@=typeuse@*/
275 
278 /*@observer@*/ /*@unchecked@*/ /*@unused@*/
279 extern struct pgpValTbl_s pgpPubkeyTbl[];
280 
284 /*@observer@*/ /*@unchecked@*/ /*@unused@*/
285 extern struct pgpValTbl_s pgpSymkeyTbl[];
286 
302 /*@-typeuse@*/
303 typedef enum pgpCompressAlgo_e {
309 /*@=typeuse@*/
310 
314 /*@observer@*/ /*@unchecked@*/ /*@unused@*/
315 extern struct pgpValTbl_s pgpCompressionTbl[];
316 
320 /*@observer@*/ /*@unchecked@*/ /*@unused@*/
321 extern struct pgpValTbl_s pgpHashTbl[];
322 
344 typedef struct pgpPktSigV3_s {
353 } * pgpPktSigV3;
354 
376 typedef struct pgpPktSigV4_s {
382 } * pgpPktSigV4;
383 
462 /*@-typeuse@*/
463 typedef enum pgpSubType_e {
503 } pgpSubType;
504 /*@=typeuse@*/
505 
509 /*@observer@*/ /*@unchecked@*/ /*@unused@*/
510 extern struct pgpValTbl_s pgpSubTypeTbl[];
511 
532 typedef union pgpPktSig_u {
535 } * pgpPktSig;
536 
565 typedef struct pgpPktSymkey_s {
569 } pgpPktSymkey;
570 
600 typedef struct pgpPktOnepass_s {
607 } * pgpPktOnepass;
608 
681 typedef struct pgpPktKeyV3_s {
686 } * pgpPktKeyV3;
687 
719 typedef struct pgpPktKeyV4_s {
723 } * pgpPktKeyV4;
724 
789 typedef union pgpPktKey_u {
792 } pgpPktKey;
793 
818 typedef struct pgpPktCdata_s {
821 } pgpPktCdata;
822 
857 typedef struct pgpPktEdata_s {
859 } pgpPktEdata;
860 
877 /*
878  * 5.9. Literal Data Packet (Tag 11)
879  *
880  * A Literal Data packet contains the body of a message; data that is
881  * not to be further interpreted.
882  *
883  * The body of this packet consists of:
884  * - A one-octet field that describes how the data is formatted.
885  *
886  * If it is a 'b' (0x62), then the literal packet contains binary data.
887  * If it is a 't' (0x74), then it contains text data, and thus may need
888  * line ends converted to local form, or other text-mode changes. RFC
889  * 1991 also defined a value of 'l' as a 'local' mode for machine-local
890  * conversions. This use is now deprecated.
891  * - File name as a string (one-octet length, followed by file name),
892  * if the encrypted data should be saved as a file.
893  *
894  * If the special name "_CONSOLE" is used, the message is considered to
895  * be "for your eyes only". This advises that the message data is
896  * unusually sensitive, and the receiving program should process it more
897  * carefully, perhaps avoiding storing the received data to disk, for
898  * example.
899  * - A four-octet number that indicates the modification date of the
900  * file, or the creation time of the packet, or a zero that
901  * indicates the present time.
902  * - The remainder of the packet is literal data.
903  *
904  * Text data is stored with <CR><LF> text endings (i.e. network-normal
905  * line endings). These should be converted to native line endings by
906  * the receiving software.
907  */
908 typedef struct pgpPktLdata_s {
912 } pgpPktLdata;
913 
927 typedef struct pgpPktTrust_s {
929 } pgpPktTrust;
930 
941 typedef struct pgpPktUid_s {
943 } pgpPktUid;
944 
947 /*@-typeuse@*/
948 typedef enum pgpArmor_e {
956 #define PGPARMOR_ERROR PGPARMOR_ERR_NO_BEGIN_PGP
965 } pgpArmor;
966 /*@=typeuse@*/
967 
971 /*@observer@*/ /*@unchecked@*/ /*@unused@*/
972 extern struct pgpValTbl_s pgpArmorTbl[];
973 
976 /*@-typeuse@*/
977 typedef enum pgpArmorKey_e {
983 } pgpArmorKey;
984 /*@=typeuse@*/
985 
989 /*@observer@*/ /*@unchecked@*/ /*@unused@*/
990 extern struct pgpValTbl_s pgpArmorKeyTbl[];
991 
992 #if defined(_RPMPGP_INTERNAL)
993 
995 union pgpPktPre_u {
996  pgpPktPubkey pubkey;
997  pgpPktSig sig;
998  pgpPktSymkey symkey;
999  pgpPktOnepass onepass;
1000  pgpPktKey key;
1001  pgpPktCdata cdata;
1002  pgpPktEdata edata;
1004  pgpPktLdata ldata;
1005  pgpPktTrust tdata;
1006  pgpPktUid uid;
1007 };
1008 
1009 struct pgpPkt_s {
1010  pgpTag tag;
1011  unsigned int pktlen;
1012  union {
1013  const rpmuint8_t * h;
1014  const pgpPktKeyV3 j;
1015  const pgpPktKeyV4 k;
1016  const pgpPktSigV3 r;
1017  const pgpPktSigV4 s;
1018  const pgpPktUid * u;
1019  } u;
1020  unsigned int hlen;
1021 };
1022 #endif /* _RPMPGP_INTERNAL */
1023 
1024 /*@-fcnuse@*/
1025 #ifdef __cplusplus
1026 extern "C" {
1027 #endif
1028 
1035 /*@unused@*/ static inline
1036 unsigned int pgpGrab(const rpmuint8_t * s, size_t nbytes)
1037  /*@*/
1038 {
1039  unsigned int i = 0;
1040  size_t nb = (nbytes <= sizeof(i) ? nbytes : sizeof(i));
1041  while (nb--)
1042  i = (i << 8) | *s++;
1043  return i;
1044 }
1045 
1052 /*@unused@*/ static inline
1053 unsigned int pgpLen(const rpmuint8_t * s, /*@out@*/ unsigned int * lenp)
1054  /*@modifies *lenp @*/
1055 {
1056  if (*s < (rpmuint8_t)192) {
1057  *lenp = (unsigned int) *s++;
1058  return 1;
1059  } else if (*s < (rpmuint8_t)255) {
1060  *lenp = (unsigned int) ((((unsigned)s[0]) - 192) << 8) + (unsigned)s[1] + 192;
1061  return 2;
1062  } else {
1063  *lenp = pgpGrab(s+1, 4);
1064  return 5;
1065  }
1066 }
1067 
1073 /*@unused@*/ static inline
1074 unsigned int pgpMpiBits(const rpmuint8_t * p)
1075  /*@requires maxRead(p) >= 1 @*/
1076  /*@*/
1077 {
1078  return (unsigned int) ((p[0] << 8) | p[1]);
1079 }
1080 
1086 /*@unused@*/ static inline
1087 unsigned int pgpMpiLen(const rpmuint8_t * p)
1088  /*@requires maxRead(p) >= 1 @*/
1089  /*@*/
1090 {
1091  return (2 + ((pgpMpiBits(p)+7) >> 3));
1092 }
1093 
1101 /*@unused@*/ static inline
1102 char * pgpHexCvt(/*@returned@*/ char * t, const rpmuint8_t * s, size_t nbytes)
1103  /*@modifies *t @*/
1104 {
1105  static char hex[] = "0123456789abcdef";
1106  while (nbytes-- > 0) {
1107  unsigned int i;
1108  i = (unsigned int) *s++;
1109  *t++ = hex[ (i >> 4) & 0xf ];
1110  *t++ = hex[ (i ) & 0xf ];
1111  }
1112  *t = '\0';
1113  return t;
1114 }
1115 
1123 /*@unused@*/ static inline /*@observer@*/
1124 char * pgpHexStr(const rpmuint8_t * p, size_t plen)
1125  /*@*/
1126 {
1127  static char prbuf[8*BUFSIZ]; /* XXX ick */
1128  char *t = prbuf;
1129  t = pgpHexCvt(t, p, plen);
1130  return prbuf;
1131 }
1132 
1139 /*@unused@*/ static inline /*@observer@*/
1140 const char * pgpMpiStr(const rpmuint8_t * p)
1141  /*@requires maxRead(p) >= 3 @*/
1142  /*@*/
1143 {
1144  static char prbuf[8*BUFSIZ]; /* XXX ick */
1145  char *t = prbuf;
1146  sprintf(t, "[%4u]: ", pgpGrab(p, 2));
1147  t += strlen(t);
1148  t = pgpHexCvt(t, p+2, pgpMpiLen(p)-2);
1149  return prbuf;
1150 }
1151 
1158 /*@unused@*/ static inline /*@observer@*/
1159 const char * pgpValStr(pgpValTbl vs, rpmuint8_t val)
1160  /*@*/
1161 {
1162  do {
1163  if (vs->val == (int)val)
1164  break;
1165  } while ((++vs)->val != -1);
1166  return vs->str;
1167 }
1168 
1169 /*@unused@*/ static inline /*@observer@*/
1170 const char * _pgpTag2Name(uint32_t tag)
1171  /*@*/
1172 {
1173  return pgpValStr(pgpTagTbl, (rpmuint8_t)tag);
1174 }
1175 
1176 /*@unused@*/ static inline /*@observer@*/
1177 const char * _pgpSigType2Name(uint32_t sigtype)
1178  /*@*/
1179 {
1180  return pgpValStr(pgpSigTypeTbl, (rpmuint8_t)sigtype);
1181 }
1182 
1183 /*@unused@*/ static inline /*@observer@*/
1184 const char * _pgpHashAlgo2Name(uint32_t algo)
1185  /*@*/
1186 {
1187  return pgpValStr(pgpHashTbl, (rpmuint8_t)algo);
1188 }
1189 
1190 /*@unused@*/ static inline /*@observer@*/
1191 const char * _pgpPubkeyAlgo2Name(uint32_t algo)
1192  /*@*/
1193 {
1194  return pgpValStr(pgpPubkeyTbl, (rpmuint8_t)algo);
1195 }
1196 
1203 /*@unused@*/ static inline /*@observer@*/
1205  /*@*/
1206 {
1207  do {
1208  if (!strcasecmp(str, vs->str))
1209  break;
1210  } while ((++vs)->val != -1);
1211  return (vs->val != -1 ? vs->val : 0);
1212 }
1213 
1221 /*@unused@*/ static inline
1222 int pgpValTok(pgpValTbl vs, const char * s, const char * se)
1223  /*@*/
1224 {
1225  do {
1226  size_t vlen = strlen(vs->str);
1227  if (vlen <= (size_t)(se-s) && !strncmp(s, vs->str, vlen))
1228  break;
1229  } while ((++vs)->val != -1);
1230  return vs->val;
1231 }
1232 
1239 /*@-exportlocal@*/
1240 void pgpPrtVal(const char * pre, pgpValTbl vs, rpmuint8_t val)
1241  /*@globals fileSystem @*/
1242  /*@modifies fileSystem @*/;
1243 /*@=exportlocal@*/
1244 
1252 #if defined(_RPMPGP_INTERNAL)
1253 /*@-exportlocal@*/
1254 int pgpPrtSubType(const rpmuint8_t * h, size_t hlen, pgpSigType sigtype)
1255  /*@globals fileSystem @*/
1256  /*@modifies fileSystem @*/;
1257 /*@=exportlocal@*/
1258 #endif
1259 
1265 #if defined(_RPMPGP_INTERNAL)
1266 /*@-exportlocal@*/
1267 int pgpPrtSig(const pgpPkt pp)
1268  /*@globals fileSystem, internalState @*/
1269  /*@modifies fileSystem, internalState @*/;
1270 
1271 int pgpPrtSigParams(pgpDig dig, const pgpPkt pp, pgpPubkeyAlgo pubkey_algo,
1272  pgpSigType sigtype, const rpmuint8_t * p)
1273  /*@globals fileSystem @*/
1274  /*@modifies fileSystem @*/;
1275 
1276 const rpmuint8_t * pgpPrtPubkeyParams(pgpDig dig, const pgpPkt pp,
1277  pgpPubkeyAlgo pubkey_algo, /*@returned@*/ const rpmuint8_t * p)
1278  /*@globals fileSystem, internalState @*/
1279  /*@modifies fileSystem, internalState @*/;
1280 
1281 /*@=exportlocal@*/
1282 #endif
1283 
1289 #if defined(_RPMPGP_INTERNAL)
1290 int pgpPrtKey(const pgpPkt pp)
1291  /*@globals fileSystem, internalState @*/
1292  /*@modifies fileSystem, internalState @*/;
1293 #endif
1294 
1300 #if defined(_RPMPGP_INTERNAL)
1301 /*@-exportlocal@*/
1302 int pgpPrtUserID(const pgpPkt pp)
1303  /*@globals fileSystem, internalState @*/
1304  /*@modifies fileSystem, internalState @*/;
1305 /*@=exportlocal@*/
1306 #endif
1307 
1313 #if defined(_RPMPGP_INTERNAL)
1314 /*@-exportlocal@*/
1315 int pgpPrtComment(const pgpPkt pp)
1316  /*@globals fileSystem @*/
1317  /*@modifies fileSystem @*/;
1318 /*@=exportlocal@*/
1319 #endif
1320 
1329 /*@-exportlocal@*/
1330 int pgpPubkeyFingerprint(const rpmuint8_t * pkt, size_t pktlen,
1331  /*@out@*/ rpmuint8_t * keyid)
1332  /*@modifies *keyid @*/;
1333 /*@=exportlocal@*/
1334 
1342 int pgpExtractPubkeyFingerprint(const char * b64pkt,
1343  /*@out@*/ rpmuint8_t * keyid)
1344  /*@modifies *keyid @*/;
1345 
1353 #if defined(_RPMPGP_INTERNAL)
1354 int pgpPktLen(const rpmuint8_t * pkt, size_t pleft, /*@out@*/ pgpPkt pp)
1355  /*@modifies pp @*/;
1356 #endif
1357 
1364 /*@-exportlocal@*/
1365 int pgpPrtPkt(const rpmuint8_t * pkt, size_t pleft)
1366  /*@globals fileSystem, internalState @*/
1367  /*@modifies fileSystem, internalState @*/;
1368 /*@=exportlocal@*/
1369 
1378 int pgpGrabPkts(const rpmuint8_t * pkts, size_t pktlen,
1379  /*@out@*/ rpmuint8_t *** pppkts, /*@out@*/ int * pnpkts)
1380  /*@modifies *pppkts, *pnpkts @*/;
1381 
1390 int pgpPrtPkts(const rpmuint8_t * pkts, size_t pktlen, pgpDig dig, int printing)
1391  /*@globals fileSystem, internalState @*/
1392  /*@modifies dig, fileSystem, internalState @*/;
1393 
1402  /*@out@*/ rpmuint8_t ** pkt, /*@out@*/ size_t * pktlen)
1403  /*@globals h_errno, fileSystem, internalState @*/
1404  /*@modifies *pkt, *pktlen, fileSystem, internalState @*/;
1405 
1413 pgpArmor pgpReadPkts(const char * fn,
1414  /*@out@*/ rpmuint8_t ** pkt, /*@out@*/ size_t * pktlen)
1415  /*@globals h_errno, fileSystem, internalState @*/
1416  /*@modifies *pkt, *pktlen, fileSystem, internalState @*/;
1417 
1425 char * pgpArmorWrap(rpmuint8_t atype, const unsigned char * s, size_t ns)
1426  /*@*/;
1427 
1434 pgpHashAlgo pgpHashAlgoStringToNumber(const char *name, size_t name_len)
1435  /*@*/;
1436 
1440 /*@unchecked@*/
1441 extern pgpVSFlags pgpDigVSFlags;
1442 
1448 /*@unused@*/ /*@null@*/
1449 pgpDig pgpDigUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ pgpDig dig)
1450  /*@modifies dig @*/;
1451 #define pgpDigUnlink(_dig) \
1452  ((pgpDig)rpmioUnlinkPoolItem((rpmioItem)(_dig), __FUNCTION__, __FILE__, __LINE__))
1453 
1459 /*@unused@*/ /*@newref@*/ /*@null@*/
1460 pgpDig pgpDigLink (/*@null@*/ pgpDig dig)
1461  /*@modifies dig @*/;
1462 #define pgpDigLink(_dig) \
1463  ((pgpDig)rpmioLinkPoolItem((rpmioItem)(_dig), __FUNCTION__, __FILE__, __LINE__))
1464 
1470 /*@unused@*/ /*@null@*/
1471 pgpDig pgpDigFree(/*@killref@*/ /*@only@*/ /*@null@*/ pgpDig dig)
1472  /*@modifies dig @*/;
1473 #define pgpDigFree(_dig) \
1474  ((pgpDig)rpmioFreePoolItem((rpmioItem)(_dig), __FUNCTION__, __FILE__, __LINE__))
1475 
1483 /*@relnull@*/
1485  /*@globals fileSystem @*/
1486  /*@modifies fileSystem @*/;
1487 
1492 void pgpDigClean(/*@null@*/ pgpDig dig)
1493  /*@modifies dig @*/;
1494 
1495 const char * pgpHashAlgo2Name(uint32_t algo)
1496  /*@*/;
1497 const char * pgpPubkeyAlgo2Name(uint32_t algo)
1498  /*@*/;
1499 rpmuint8_t pgpHashName2Algo(const char * name)
1500  /*@*/;
1501 rpmuint8_t pgpPubkeyName2Algo(const char * name)
1502  /*@*/;
1503 int pgpDigSetAlgos(pgpDig dig)
1504  /*@*/;
1505 int pgpExportPubkey(pgpDig dig)
1506  /*@*/;
1507 int pgpExportSignature(pgpDig dig, /*@only@*/ DIGEST_CTX ctx)
1508  /*@*/;
1509 
1515 /*@exposed@*/
1516 pgpDigParams pgpGetPubkey(const pgpDig dig)
1517  /*@*/;
1518 
1524 /*@exposed@*/
1526  /*@*/;
1527 
1533 rpmuint32_t pgpGetSigtag(const pgpDig dig)
1534  /*@*/;
1535 
1541 rpmuint32_t pgpGetSigtype(const pgpDig dig)
1542  /*@*/;
1543 
1549 /*@observer@*/ /*@null@*/
1550 extern const void * pgpGetSig(const pgpDig dig)
1551  /*@*/;
1552 
1558 rpmuint32_t pgpGetSiglen(const pgpDig dig)
1559  /*@*/;
1560 
1570 int pgpSetSig(pgpDig dig,
1571  rpmuint32_t sigtag, rpmuint32_t sigtype,
1572  /*@kept@*/ /*@null@*/ const void * sig, rpmuint32_t siglen)
1573  /*@modifies dig @*/;
1574 
1581 /*@null@*/
1582 void * pgpStatsAccumulator(pgpDig dig, int opx)
1583  /*@*/;
1584 
1592 int pgpSetFindPubkey(pgpDig dig,
1593  /*@null@*/ int (*findPubkey) (void *ts, /*@null@*/ void *dig),
1594  /*@exposed@*/ /*@null@*/ void * _ts)
1595  /*@modifies dig @*/;
1596 
1602 int pgpFindPubkey(pgpDig dig)
1603  /*@modifies dig @*/;
1604 
1611 /*@unused@*/ static inline
1612 int pgpIsPkt(const rpmuint8_t * p, /*@null@*/ pgpTag * tagp)
1613  /*@modifies *tagp @*/
1614 {
1615  unsigned int val = (unsigned int) *p++;
1616  pgpTag tag;
1617  int rc;
1618 
1619  /* XXX can't deal with these. */
1620  if (!(val & 0x80))
1621  return 0;
1622 
1623  if (val & 0x40)
1624  tag = (pgpTag)(val & 0x3f);
1625  else
1626  tag = (pgpTag)((val >> 2) & 0xf);
1627 
1628  switch (tag) {
1629  case PGPTAG_MARKER:
1632  case PGPTAG_PUBLIC_KEY:
1633  case PGPTAG_SECRET_KEY:
1635  case PGPTAG_SIGNATURE:
1636  case PGPTAG_COMMENT:
1637  case PGPTAG_COMMENT_OLD:
1638  case PGPTAG_LITERAL_DATA:
1640  case PGPTAG_SYMMETRIC_DATA:
1641  rc = 1;
1642  break;
1643  case PGPTAG_PUBLIC_SUBKEY:
1644  case PGPTAG_SECRET_SUBKEY:
1645  case PGPTAG_USER_ID:
1646  case PGPTAG_RESERVED:
1647  case PGPTAG_TRUST:
1648  case PGPTAG_PHOTOID:
1649  case PGPTAG_ENCRYPTED_MDC:
1650  case PGPTAG_MDC:
1651  case PGPTAG_PRIVATE_60:
1652  case PGPTAG_PRIVATE_62:
1653  case PGPTAG_CONTROL:
1654  default:
1655  rc = 0;
1656  break;
1657  }
1658  if (tagp != NULL)
1659  *tagp = tag;
1660  return rc;
1661 }
1662 
1663 #define CRC24_INIT 0xb704ce
1664 #define CRC24_POLY 0x1864cfb
1665 
1672 /*@unused@*/ static inline
1673 unsigned int pgpCRC(const rpmuint8_t * octets, size_t len)
1674  /*@*/
1675 {
1676  unsigned int crc = CRC24_INIT;
1677  int i;
1678 
1679  while (len--) {
1680  crc ^= (*octets++) << 16;
1681  for (i = 0; i < 8; i++) {
1682  crc <<= 1;
1683  if (crc & 0x1000000)
1684  crc ^= CRC24_POLY;
1685  }
1686  }
1687  return crc & 0xffffff;
1688 }
1689 
1692 typedef int (*pgpImplSet_t) (/*@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
1693  /*@modifies ctx, dig @*/;
1694 
1697 typedef int (*pgpImplErrChk_t) (pgpDig dig, const char * msg, int rc, unsigned expected)
1698  /*@*/;
1699 
1702 typedef int (*pgpImplAvailable_t) (pgpDig dig, int algo)
1703  /*@*/;
1704 
1707 typedef int (*pgpImplGenerate_t) (pgpDig dig)
1708  /*@*/;
1709 
1712 typedef int (*pgpImplSign_t) (pgpDig dig)
1713  /*@*/;
1714 
1717 typedef int (*pgpImplVerify_t) (pgpDig dig)
1718  /*@*/;
1719 
1722 typedef int (*pgpImplMpiItem_t) (const char * pre, pgpDig dig, int itemno,
1723  const rpmuint8_t * p, /*@null@*/ const rpmuint8_t * pend)
1724  /*@globals fileSystem @*/
1725  /*@modifies dig, fileSystem @*/;
1726 
1729 typedef void (*pgpImplClean_t) (void * impl)
1730  /*@modifies impl @*/;
1731 
1734 typedef void * (*pgpImplFree_t) (/*@only@*/ void * impl)
1735  /*@modifies impl @*/;
1736 
1739 typedef void * (*pgpImplInit_t) (void)
1740  /*@*/;
1741 
1742 
1745 typedef struct pgpImplVecs_s {
1746  const char * _pgpNV;
1751 
1756 
1760 
1765 } pgpImplVecs_t;
1766 
1769 /*@unchecked@*/
1770 extern pgpImplVecs_t * pgpImplVecs;
1771 
1772 /*@-mustmod@*/
1775 /*@unused@*/ static inline
1776 int pgpImplSetRSA(/*@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
1777  /*@modifies ctx, dig @*/
1778 {
1779  return (*pgpImplVecs->_pgpSetRSA) (ctx, dig, sigp);
1780 }
1781 
1784 /*@unused@*/ static inline
1785 int pgpImplSetDSA(/*@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
1786  /*@modifies ctx, dig @*/
1787 {
1788  return (*pgpImplVecs->_pgpSetDSA) (ctx, dig, sigp);
1789 }
1790 
1793 /*@unused@*/ static inline
1794 int pgpImplSetELG(/*@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
1795  /*@modifies ctx, dig @*/
1796 {
1797  return (*pgpImplVecs->_pgpSetELG) (ctx, dig, sigp);
1798 }
1799 
1802 /*@unused@*/ static inline
1803 int pgpImplSetECDSA(/*@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
1804  /*@modifies ctx, dig @*/
1805 {
1806  return (*pgpImplVecs->_pgpSetECDSA) (ctx, dig, sigp);
1807 }
1808 
1811 /*@unused@*/ static inline
1812 int pgpImplErrChk(pgpDig dig, const char * msg, int rc, unsigned expected)
1813  /*@*/
1814 {
1815  return (pgpImplVecs->_pgpErrChk
1816  ? (*pgpImplVecs->_pgpErrChk) (dig, msg, rc, expected)
1817  : rc);
1818 }
1819 
1822 /*@unused@*/ static inline
1823 int pgpImplAvailableCipher(pgpDig dig, int algo)
1824  /*@*/
1825 {
1826  return (pgpImplVecs->_pgpAvailableCipher
1827  ? (*pgpImplVecs->_pgpAvailableCipher) (dig, algo)
1828  : 0);
1829 }
1830 
1833 /*@unused@*/ static inline
1834 int pgpImplAvailableDigest(pgpDig dig, int algo)
1835  /*@*/
1836 {
1837  return (pgpImplVecs->_pgpAvailableDigest
1838  ? (*pgpImplVecs->_pgpAvailableDigest) (dig, algo)
1839  : 0);
1840 }
1841 
1844 /*@unused@*/ static inline
1845 int pgpImplAvailablePubkey(pgpDig dig, int algo)
1846  /*@*/
1847 {
1848  return (pgpImplVecs->_pgpAvailablePubkey
1849  ? (*pgpImplVecs->_pgpAvailablePubkey) (dig, algo)
1850  : 0);
1851 }
1852 
1855 /*@unused@*/ static inline
1857  /*@*/
1858 {
1859  return (pgpImplVecs->_pgpVerify
1860  ? (*pgpImplVecs->_pgpVerify) (dig)
1861  : 0);
1862 }
1863 
1866 /*@unused@*/ static inline
1868  /*@*/
1869 {
1870  return (pgpImplVecs->_pgpSign
1871  ? (*pgpImplVecs->_pgpSign) (dig)
1872  : 0);
1873 }
1874 
1877 /*@unused@*/ static inline
1879  /*@*/
1880 {
1881  return (pgpImplVecs->_pgpGenerate
1882  ? (*pgpImplVecs->_pgpGenerate) (dig)
1883  : 0);
1884 }
1885 
1888 /*@unused@*/ static inline
1889 int pgpImplMpiItem(const char * pre, pgpDig dig, int itemno,
1890  const rpmuint8_t * p, /*@null@*/ const rpmuint8_t * pend)
1891  /*@modifies dig @*/
1892 {
1893  return (*pgpImplVecs->_pgpMpiItem) (pre, dig, itemno, p, pend);
1894 }
1895 
1898 /*@unused@*/ static inline
1899 void pgpImplClean(void * impl)
1900  /*@modifies impl @*/
1901 {
1902 /*@-noeffectuncon@*/
1903  (*pgpImplVecs->_pgpClean) (impl);
1904 /*@=noeffectuncon@*/
1905 }
1906 
1909 /*@unused@*/ static inline
1910 /*@null@*/
1911 void * pgpImplFree(/*@only@*/ void * impl)
1912  /*@modifies impl @*/
1913 {
1914  return (*pgpImplVecs->_pgpFree) (impl);
1915 }
1916 
1919 /*@unused@*/ static inline
1920 void * pgpImplInit(void)
1921  /*@*/
1922 {
1923  return (*pgpImplVecs->_pgpInit) ();
1924 }
1925 /*@=mustmod@*/
1926 
1927 
1928 #ifdef __cplusplus
1929 }
1930 #endif
1931 /*@=fcnuse@*/
1932 
1933 #endif /* H_RPMPGP */
rpmuint8_t pubkey_algo
Definition: rpmpgp.h:722
rpmuint8_t userid[1]
Definition: rpmpgp.h:942
static int pgpValTok(pgpValTbl vs, const char *s, const char *se)
Return value of an OpenPGP string.
Definition: rpmpgp.h:1222
struct pgpPktSigV3_s v3
Definition: rpmpgp.h:533
int pgpSetSig(pgpDig dig, rpmuint32_t sigtag, rpmuint32_t sigtype, const void *sig, rpmuint32_t siglen)
Set signature tag info, i.e.
Definition: rpmpgp.c:1422
rpmuint8_t sigtype
Definition: rpmpgp.h:378
5.5.1.
Definition: rpmpgp.h:681
const rpmuint8_t * pgpPrtPubkeyParams(pgpDig dig, const pgpPkt pp, pgpPubkeyAlgo pubkey_algo, const rpmuint8_t *p)
Definition: rpmpgp.c:715
5.7.
Definition: rpmpgp.h:857
rpmuint8_t data[1]
Definition: rpmpgp.h:858
rpmuint8_t hash_algo
Definition: rpmpgp.h:380
static const char * pgpValStr(pgpValTbl vs, rpmuint8_t val)
Return string representation of an OpenPGP value.
Definition: rpmpgp.h:1159
int(* pgpImplSign_t)(pgpDig dig)
Definition: rpmpgp.h:1712
static unsigned int pgpCRC(const rpmuint8_t *octets, size_t len)
Return CRC of a buffer.
Definition: rpmpgp.h:1673
const char const char size_t len
Definition: bson.h:823
pgpPubkeyAlgo_e
9.1.
Definition: rpmpgp.h:262
const char bson_timestamp_t * ts
Definition: bson.h:1004
void *(* pgpImplFree_t)(void *impl)
Definition: rpmpgp.h:1734
rpmuint8_t compressalgo
Definition: rpmpgp.h:819
rpmuint8_t format
Definition: rpmpgp.h:909
struct pgpPktPubkey_s pgpPktPubkey
5.1.
struct pgpValTbl_s pgpArmorTbl[]
Armor (string, value) pairs.
Definition: rpmpgp.c:244
int pgpPktLen(const rpmuint8_t *pkt, size_t pleft, pgpPkt pp)
Definition: rpmpgp.c:999
static int pgpImplAvailableDigest(pgpDig dig, int algo)
Definition: rpmpgp.h:1834
int(* pgpImplErrChk_t)(pgpDig dig, const char *msg, int rc, unsigned expected)
Definition: rpmpgp.h:1697
const void * pgpGetSig(const pgpDig dig)
Get signature tag data, i.e.
Definition: rpmpgp.c:1412
enum pgpCompressAlgo_e pgpCompressAlgo
9.3.
pgpCompressAlgo_e
9.3.
Definition: rpmpgp.h:303
pgpImplAvailable_t _pgpAvailableCipher
Definition: rpmpgp.h:1753
static const char * _pgpTag2Name(uint32_t tag)
Definition: rpmpgp.h:1170
enum pgpSubType_e pgpSubType
5.2.3.1.
5.6.
Definition: rpmpgp.h:818
struct pgpDigParams_s * pgpDigParams
Definition: rpmiotypes.h:101
static unsigned int pgpLen(const rpmuint8_t *s, unsigned int *lenp)
Return length of an OpenPGP packet.
Definition: rpmpgp.h:1053
5.11.
Definition: rpmpgp.h:941
static unsigned int pgpGrab(const rpmuint8_t *s, size_t nbytes)
Return (native-endian) integer from big-endian representation.
Definition: rpmpgp.h:1036
const char int time
Definition: bson.h:1005
enum pgpHashAlgo_e pgpHashAlgo
9.4.
struct pgpValTbl_s pgpCompressionTbl[]
Compression (string, value) pairs.
Definition: rpmpgp.c:148
rpmuint8_t pgpHashName2Algo(const char *name)
Definition: rpmpgp.c:1198
pgpSigType_e
5.2.1.
Definition: rpmpgp.h:210
pgpImplSet_t _pgpSetECDSA
Definition: rpmpgp.h:1750
static rpmVSFlags vsflags
Definition: rpmcache.c:547
#define CRC24_POLY
Definition: rpmpgp.h:1664
union pgpPktKey_u pgpPktKey
5.5.3.
rpmuint8_t data[1]
Definition: rpmpgp.h:820
int pgpGrabPkts(const rpmuint8_t *pkts, size_t pktlen, rpmuint8_t ***pppkts, int *pnpkts)
Return array of packet pointers.
Definition: rpmpgp.c:1472
5.2.3.
Definition: rpmpgp.h:376
const char * pgpPubkeyAlgo2Name(uint32_t algo)
Definition: rpmpgp.c:1193
enum pgpSigType_e pgpSigType
5.2.1.
#define pgpDigLink(_dig)
Definition: rpmpgp.h:1462
rpmuint8_t pubkey_algo
Definition: rpmpgp.h:379
static int pgpImplGenerate(pgpDig dig)
Definition: rpmpgp.h:1878
pgpDig pgpDigNew(pgpVSFlags vsflags, pgpPubkeyAlgo pubkey_algo)
Create a container for parsed OpenPGP packates.
Definition: rpmpgp.c:1314
char * pgpArmorWrap(rpmuint8_t atype, const unsigned char *s, size_t ns)
Wrap a OpenPGP packets in ascii armor for transport.
Definition: rpmpgp.c:1749
pgpImplMpiItem_t _pgpMpiItem
Definition: rpmpgp.h:1761
rpmuint8_t keyid[8]
Definition: rpmpgp.h:199
#define pgpDigUnlink(_dig)
Definition: rpmpgp.h:1451
pgpImplClean_t _pgpClean
Definition: rpmpgp.h:1762
struct pgpValTbl_s pgpArmorKeyTbl[]
Armor key (string, value) pairs.
Definition: rpmpgp.c:255
static int pgpImplSign(pgpDig dig)
Definition: rpmpgp.h:1867
rpmuint8_t pgpPubkeyName2Algo(const char *name)
Definition: rpmpgp.c:1203
static int pgpImplAvailableCipher(pgpDig dig, int algo)
Definition: rpmpgp.h:1823
struct pgpValTbl_s pgpSubTypeTbl[]
Subtype (string, value) pairs.
Definition: rpmpgp.c:178
static int pgpImplSetELG(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
Definition: rpmpgp.h:1794
static int pgpImplSetDSA(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
Definition: rpmpgp.h:1785
5.2.2.
Definition: rpmpgp.h:344
5.5.3.
Definition: rpmpgp.h:789
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?
Definition: rpmpgp.h:1612
rpmuint8_t hashlen
Definition: rpmpgp.h:346
pgpHashAlgo pgpHashAlgoStringToNumber(const char *name, size_t name_len)
Convert a hash algorithm "foo" to the internal PGPHASHALGO_FOO number.
Definition: rpmpgp.c:1805
const char * str
Definition: bson.h:593
pgpDigParams pgpGetPubkey(const pgpDig dig)
Return OpenPGP pubkey parameters.
Definition: rpmpgp.c:1397
pgpImplAvailable_t _pgpAvailableDigest
Definition: rpmpgp.h:1754
static void * pgpImplFree(void *impl)
Definition: rpmpgp.h:1911
static void * pgpImplInit(void)
Definition: rpmpgp.h:1920
unsigned int rpmuint32_t
Definition: rpmiotypes.h:28
rpmuint8_t algo
Definition: rpmpgp.h:200
int pgpExtractPubkeyFingerprint(const char *b64pkt, rpmuint8_t *keyid)
Extract OpenPGP public key fingerprint from base64 encoded packet.
Definition: rpmpgp.c:1077
static int crc(FD_t fd, uint32_t *cval, uint32_t *clen)
Definition: rpmmtree.c:515
rpmuint8_t symkey_algo
Definition: rpmpgp.h:567
struct pgpPktSigV4_s * pgpPktSigV4
5.2.3.
rpmuint8_t filename[1]
Definition: rpmpgp.h:911
void *(* pgpImplInit_t)(void)
Definition: rpmpgp.h:1739
static const char * _pgpPubkeyAlgo2Name(uint32_t algo)
Definition: rpmpgp.h:1191
struct pgpPktLdata_s pgpPktLdata
5.8.
int pgpPrtSigParams(pgpDig dig, const pgpPkt pp, pgpPubkeyAlgo pubkey_algo, pgpSigType sigtype, const rpmuint8_t *p)
Definition: rpmpgp.c:449
pgpSubType_e
5.2.3.1.
Definition: rpmpgp.h:463
struct pgpValTbl_s pgpSigTypeTbl[]
Definition: rpmpgp.c:97
const char * pgpHashAlgo2Name(uint32_t algo)
Definition: rpmpgp.c:1188
rpmuint8_t version
Definition: rpmpgp.h:720
unsigned char rpmuint8_t
Private int typedefs to avoid C99 portability issues.
Definition: rpmiotypes.h:26
int pgpPrtPkt(const rpmuint8_t *pkt, size_t pleft)
Return lenth of a OpenPGP packet.
Definition: rpmpgp.c:1089
int(* pgpImplAvailable_t)(pgpDig dig, int algo)
Definition: rpmpgp.h:1702
rpmuint8_t filenamelen
Definition: rpmpgp.h:910
rpmuint8_t flag
Definition: rpmpgp.h:928
rpmuint32_t pgpGetSigtype(const pgpDig dig)
Get signature tag type.
Definition: rpmpgp.c:1407
static const char * pgpMpiStr(const rpmuint8_t *p)
Return hex formatted representation of a multiprecision integer.
Definition: rpmpgp.h:1140
void pgpDigClean(pgpDig dig)
Release (malloc'd) data from container.
Definition: rpmpgp.c:1155
struct pgpPktUid_s pgpPktUid
5.11.
struct pgpValTbl_s pgpSymkeyTbl[]
Symmetric key (string, value) pairs.
Definition: rpmpgp.c:129
static unsigned int pgpMpiBits(const rpmuint8_t *p)
Return no.
Definition: rpmpgp.h:1074
static char * pgpHexCvt(char *t, const rpmuint8_t *s, size_t nbytes)
Convert to hex.
Definition: rpmpgp.h:1102
enum pgpVSFlags_e pgpVSFlags
Bit(s) to control digest and signature verification.
struct pgpPkt_s * pgpPkt
Definition: rpmiotypes.h:93
rpmuint8_t pubkey_algo
Definition: rpmpgp.h:604
int _pgp_error_count
Definition: rpmpgp.c:48
static unsigned int hash(const char *str)
Definition: set.c:1346
rpmuint8_t valid[2]
Definition: rpmpgp.h:684
pgpArmor pgpReadPkts(const char *fn, rpmuint8_t **pkt, size_t *pktlen)
Parse armored OpenPGP packets from a file.
Definition: rpmpgp.c:1739
int pgpPubkeyFingerprint(const rpmuint8_t *pkt, size_t pktlen, rpmuint8_t *keyid)
Print/parse an OpenPGP subtype packet.
Definition: rpmpgp.c:1029
void * pgpStatsAccumulator(pgpDig dig, int opx)
Return pgpDig container accumulator structure.
Definition: rpmpgp.c:1436
Digest private data.
Definition: digest.c:130
enum pgpArmorKey_e pgpArmorKey
rpmuint8_t signid[8]
Definition: rpmpgp.h:605
struct pgpValTbl_s pgpPubkeyTbl[]
Definition: rpmpgp.c:116
pgpImplSet_t _pgpSetRSA
Definition: rpmpgp.h:1747
rpmuint8_t version
Definition: rpmpgp.h:198
struct pgpPktCdata_s pgpPktCdata
5.6.
struct pgpDig_s * pgpDig
Definition: rpmiotypes.h:97
static int pgpImplSetECDSA(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
Definition: rpmpgp.h:1803
rpmuint8_t sigtype
Definition: rpmpgp.h:347
rpmuint8_t version
Definition: rpmpgp.h:345
static rpmuint8_t pgpStrVal(pgpValTbl vs, const char *str)
Return byte value of an OpenPGP string.
Definition: rpmpgp.h:1204
rpmuint8_t time[4]
Definition: rpmpgp.h:683
static int pgpImplErrChk(pgpDig dig, const char *msg, int rc, unsigned expected)
Definition: rpmpgp.h:1812
rpmuint8_t nested
Definition: rpmpgp.h:606
pgpImplAvailable_t _pgpAvailablePubkey
Definition: rpmpgp.h:1755
struct pgpPktKeyV4_s * pgpPktKeyV4
The version 4 format is similar to the version 3 format except for the absence of a validity period...
int pgpDigSetAlgos(pgpDig dig)
Definition: rpmpgp.c:1208
pgpImplSet_t _pgpSetDSA
Definition: rpmpgp.h:1748
rpmuint8_t sigtype
Definition: rpmpgp.h:602
pgpVSFlags pgpDigVSFlags
Disabler bits(s) for signature/digest checking.
Definition: rpmpgp.c:1153
pgpImplErrChk_t _pgpErrChk
Definition: rpmpgp.h:1752
pgpImplInit_t _pgpInit
Definition: rpmpgp.h:1764
pgpImplVerify_t _pgpVerify
Definition: rpmpgp.h:1757
int pgpPrtPkts(const rpmuint8_t *pkts, size_t pktlen, pgpDig dig, int printing)
Print/parse a OpenPGP packet(s).
Definition: rpmpgp.c:1518
pgpImplVecs_t * pgpImplVecs
Definition: rpmpgp.c:51
Cumulative statistics for an operation.
Definition: rpmsw.h:39
int pgpFindPubkey(pgpDig dig)
Call find pubkey vector.
Definition: rpmpgp.c:1464
pgpImplSet_t _pgpSetELG
Definition: rpmpgp.h:1749
union pgpPktSig_u * pgpPktSig
5.2.
static int pgpImplSetRSA(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
Definition: rpmpgp.h:1776
static const char * _pgpHashAlgo2Name(uint32_t algo)
Definition: rpmpgp.h:1184
void(* pgpImplClean_t)(void *impl)
Definition: rpmpgp.h:1729
int(* pgpImplMpiItem_t)(const char *pre, pgpDig dig, int itemno, const rpmuint8_t *p, const rpmuint8_t *pend)
Definition: rpmpgp.h:1722
rpmuint32_t pgpGetSiglen(const pgpDig dig)
Get signature tag data length, i.e.
Definition: rpmpgp.c:1417
enum pgpPubkeyAlgo_e pgpPubkeyAlgo
9.1.
rpmuint8_t time[4]
Definition: rpmpgp.h:721
rpmuint8_t hash_algo
Definition: rpmpgp.h:603
static unsigned int pgpMpiLen(const rpmuint8_t *p)
Return no.
Definition: rpmpgp.h:1087
pgpImplFree_t _pgpFree
Definition: rpmpgp.h:1763
int pgpPrtSubType(const rpmuint8_t *h, size_t hlen, pgpSigType sigtype)
Definition: rpmpgp.c:312
const char const int i
Definition: bson.h:778
int pgpPrtComment(const pgpPkt pp)
Definition: rpmpgp.c:970
const char const bson * key
Definition: mongo.h:717
static void pgpImplClean(void *impl)
Definition: rpmpgp.h:1899
int(* pgpImplGenerate_t)(pgpDig dig)
Definition: rpmpgp.h:1707
const char * str
Definition: rpmpgp.h:122
struct pgpPktKeyV4_s v4
Definition: rpmpgp.h:791
struct pgpPktSigV3_s * pgpPktSigV3
5.2.2.
struct rpmiob_s * rpmiob
Definition: rpmiotypes.h:60
5.2.
Definition: rpmpgp.h:532
struct pgpPktSigV4_s v4
Definition: rpmpgp.h:534
int pgpPrtUserID(const pgpPkt pp)
Definition: rpmpgp.c:953
static int pgpImplVerify(pgpDig dig)
Definition: rpmpgp.h:1856
rpmuint8_t version
Definition: rpmpgp.h:566
rpmuint8_t signhash16[2]
Definition: rpmpgp.h:352
rpmuint8_t time[4]
Definition: rpmpgp.h:348
enum pgpArmor_e pgpArmor
const char * _pgpNV
Definition: rpmpgp.h:1746
enum pgpTag_e pgpTag
4.3.
const struct pgpValTbl_s * pgpValTbl
rpmuint32_t pgpGetSigtag(const pgpDig dig)
Get signature tag.
Definition: rpmpgp.c:1402
int pgpSetFindPubkey(pgpDig dig, int(*findPubkey)(void *ts, void *dig), void *_ts)
Set find pubkey vector.
Definition: rpmpgp.c:1450
struct pgpPktSymkey_s pgpPktSymkey
5.3.
int val
Definition: rpmpgp.h:120
rpmuint8_t version
Definition: rpmpgp.h:377
rpmuint8_t version
Definition: rpmpgp.h:601
static const char * _pgpSigType2Name(uint32_t sigtype)
Definition: rpmpgp.h:1177
pgpImplSign_t _pgpSign
Definition: rpmpgp.h:1758
pgpArmorKey_e
Definition: rpmpgp.h:977
struct pgpPktKeyV3_s v3
Definition: rpmpgp.h:790
void pgpPrtVal(const char *pre, pgpValTbl vs, rpmuint8_t val)
Print an OpenPGP value.
Definition: rpmpgp.c:302
static const char * name
struct pgpValTbl_s pgpTagTbl[]
Definition: rpmpgp.c:218
5.8.
Definition: rpmpgp.h:908
rpmuint8_t version
Definition: rpmpgp.h:682
#define pgpDigFree(_dig)
Definition: rpmpgp.h:1473
rpmuint8_t pubkey_algo
Definition: rpmpgp.h:350
#define CRC24_INIT
Definition: rpmpgp.h:1663
rpmuint8_t hash_algo
Definition: rpmpgp.h:351
static int pgpImplMpiItem(const char *pre, pgpDig dig, int itemno, const rpmuint8_t *p, const rpmuint8_t *pend)
Definition: rpmpgp.h:1889
static int pgpImplAvailablePubkey(pgpDig dig, int algo)
Definition: rpmpgp.h:1845
struct pgpImplVecs_s pgpImplVecs_t
pgpArmor pgpArmorUnwrap(rpmiob iob, rpmuint8_t **pkt, size_t *pktlen)
Parse armored OpenPGP packets from an iob.
Definition: rpmpgp.c:1564
int pgpExportPubkey(pgpDig dig)
Definition: rpmpgp.c:1338
static char * pgpHexStr(const rpmuint8_t *p, size_t plen)
Return hex formatted representation of bytes.
Definition: rpmpgp.h:1124
rpmuint8_t hashlen[2]
Definition: rpmpgp.h:381
int(* pgpImplVerify_t)(pgpDig dig)
Definition: rpmpgp.h:1717
rpmuint8_t pubkey_algo
Definition: rpmpgp.h:685
struct pgpValTbl_s pgpHashTbl[]
Hash (string, value) pairs.
Definition: rpmpgp.c:156
pgpDigParams pgpGetSignature(const pgpDig dig)
Return OpenPGP signature parameters.
Definition: rpmpgp.c:1392
int pgpExportSignature(pgpDig dig, DIGEST_CTX ctx)
Definition: rpmpgp.c:1365
struct pgpPktKeyV3_s * pgpPktKeyV3
5.5.1.
pgpImplGenerate_t _pgpGenerate
Definition: rpmpgp.h:1759
int(* pgpImplSet_t)(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
Definition: rpmpgp.h:1692
The version 4 format is similar to the version 3 format except for the absence of a validity period...
Definition: rpmpgp.h:719
5.10.
Definition: rpmpgp.h:927
int pgpPrtSig(const pgpPkt pp)
Definition: rpmpgp.c:525
struct pgpPktOnepass_s * pgpPktOnepass
5.4.
rpmuint8_t signid[8]
Definition: rpmpgp.h:349
int pgpPrtKey(const pgpPkt pp)
Definition: rpmpgp.c:892
rpmuint8_t s2k[1]
Definition: rpmpgp.h:568
pgpTag_e
4.3.
Definition: rpmpgp.h:132
int j
Definition: mongo.h:438
pgpArmor_e
Definition: rpmpgp.h:948
const char * ns
Definition: mongo.h:326