rpm  5.4.15
rpmns.c
Go to the documentation of this file.
1 
4 #include "system.h"
5 
6 #define _RPMIOB_INTERNAL /* XXX rpmiobSlurp */
7 #include <rpmiotypes.h>
8 #include <rpmio.h>
9 #define _RPMHKP_INTERNAL
10 #include <rpmhkp.h>
11 #include <rpmmacro.h>
12 #include <rpmcb.h>
13 
14 #define _RPMPGP_INTERNAL
15 #include <rpmpgp.h>
16 
17 #include <rpmtypes.h>
18 #include <rpmtag.h>
19 #define _RPMEVR_INTERNAL
20 #include <rpmevr.h>
21 #define _RPMNS_INTERNAL
22 #include <rpmns.h>
23 #include <rpmdb.h>
24 
25 #include <rpmps.h>
26 #define _RPMTS_INTERNAL /* XXX ts->hkp */
27 #include <rpmts.h>
28 
29 #include "debug.h"
30 
31 /*@access rpmts @*/
32 /*@access pgpDigParams @*/
33 /*@access rpmiob @*/
34 
35 #ifdef __cplusplus
36 GENfree(rpmuint8_t **)
37 #endif /* __cplusplus */
38 
39 /*@unchecked@*/
40 #ifdef DEBUGGING
41 int _rpmns_debug = -1;
42 #define SPEW(_list) if (_rpmns_debug) fprintf _list
43 #else
45 #define SPEW(_list)
46 #endif
47 
48 /*@unchecked@*/ /*@observer@*/ /*@relnull@*/
49 const char *_rpmns_N_at_A = ".";
50 
51 /*@-nullassign@*/
52 /*@unchecked@*/ /*@observer@*/
53 static const char *rpmnsArches[] = {
54  "i386", "i486", "i586", "i686", "athlon", "pentium3", "pentium4",
55  "x86_64", "amd64", "ia32e",
56  "alpha", "alphaev5", "alphaev56", "alphapca56", "alphaev6", "alphaev67",
57  "sparc", "sun4", "sun4m", "sun4c", "sun4d", "sparcv8",
58  "sparcv9", "sparcv9b", "sparcv9v", "sparcv9v2",
59  "sparc64", "sun4u", "sparc64v",
60  "mips", "mipsel", "IP",
61  "ppc", "ppciseries", "ppcpseries",
62  "ppc64", "ppc64iseries", "ppc64pseries",
63  "m68k",
64  "rs6000",
65  "ia64",
66  "armv3l", "armv4b", "armv4l",
67  "armv5teb", "armv5tel", "armv5tejl",
68  "armv6l",
69  "s390", "i370", "s390x",
70  "sh", "sh3", "sh4", "sh4a", "xtensa",
71  "noarch", "fat",
72  NULL,
73 };
74 /*@=nullassign@*/
75 
76 nsType rpmnsArch(const char * str)
77 {
79  const char ** av;
80 
81 #if defined(RPM_VENDOR_WINDRIVER)
82  const char * known_arch = rpmExpand("%{?_known_arch}", NULL);
83  const char *p, *pe, *t;
84  for (p = pe = known_arch ; rc == RPMNS_TYPE_UNKNOWN && pe && *pe ; ) {
85  while (*p && xisspace(*p)) p++;
86  pe = p ; while (*pe && !xisspace(*pe)) pe++;
87  if (p == pe)
88  break;
89  t = strndup(p, (pe - p));
90  p = pe;
91  if (!strcmp(str, t))
92  rc = RPMNS_TYPE_ARCH;
93  t = _free(t);
94  }
95  known_arch = _free(known_arch);
96 #endif
97 
98  if (rc == RPMNS_TYPE_UNKNOWN)
99  for (av = rpmnsArches; *av != NULL; av++) {
100  if (strcmp(str, *av))
101  continue;
102  rc = RPMNS_TYPE_ARCH;
103  break;
104  }
105 
106  return rc;
107 }
108 
112 /*@unchecked@*/ /*@observer@*/
113 #define _ENTRY(_s, _type) { #_s, sizeof(#_s)-1, _type }
114 static struct _rpmnsProbes_s {
115 /*@observer@*/ /*@relnull@*/
116  const char * NS;
117  size_t NSlen;
119 } rpmnsProbes[] = {
138  _ENTRY(config, RPMNS_TYPE_CONFIG),
139  _ENTRY(cpuinfo, RPMNS_TYPE_CPUINFO),
140  _ENTRY(digest, RPMNS_TYPE_DIGEST),
141  _ENTRY(diskspace, RPMNS_TYPE_DISKSPACE),
142  _ENTRY(dpkg, RPMNS_TYPE_DPKG),
143  _ENTRY(envvar, RPMNS_TYPE_ENVVAR),
144  _ENTRY(executable, RPMNS_TYPE_ACCESS),
145  _ENTRY(exists, RPMNS_TYPE_ACCESS),
146  _ENTRY(getconf, RPMNS_TYPE_GETCONF),
147  _ENTRY(gnupg, RPMNS_TYPE_GNUPG),
148  _ENTRY(group, RPMNS_TYPE_GROUP),
149  _ENTRY(macro, RPMNS_TYPE_MACRO),
150  _ENTRY(mounted, RPMNS_TYPE_MOUNTED),
157  _ENTRY(readable, RPMNS_TYPE_ACCESS),
158  _ENTRY(rpmlib, RPMNS_TYPE_RPMLIB),
159  _ENTRY(running, RPMNS_TYPE_RUNNING),
163  _ENTRY(sanitycheck, RPMNS_TYPE_SANITY),
165  _ENTRY(signature, RPMNS_TYPE_SIGNATURE),
166  _ENTRY(soname, RPMNS_TYPE_SONAME),
167  _ENTRY(uname, RPMNS_TYPE_UNAME),
169  _ENTRY(vcheck, RPMNS_TYPE_VCHECK),
170  _ENTRY(verify, RPMNS_TYPE_VERIFY),
171  _ENTRY(writable, RPMNS_TYPE_ACCESS),
172 };
173 #undef _ENTRY
174 static size_t rpmnsProbesCount = sizeof(rpmnsProbes)/sizeof(rpmnsProbes[0]);
175 
176 nsType rpmnsProbe(const char * s, size_t slen)
177 {
178  const char * se = strchr(s, ')');
179  size_t l, u;
180 
181  /* XXX Don't bother if string cannot be "NS(N).A" */
182  if (se == NULL || (slen = (se - s)) < sizeof("ABC()")-1)
183  return RPMNS_TYPE_UNKNOWN;
184 
185  l = 0;
186  u = rpmnsProbesCount;
187  while (l < u) {
188  size_t i = (l + u)/2;
189  struct _rpmnsProbes_s * av = rpmnsProbes + i;
190  size_t NSlen = (slen > av->NSlen) ? av->NSlen : slen;
191  int rc = strncmp(s, av->NS, NSlen);
192 
193  if (rc == 0)
194  return (s[NSlen] == '(' ? rpmnsProbes[i].Type : RPMNS_TYPE_UNKNOWN);
195  else if (rc < 0)
196  u = i;
197  else if (rc > 0)
198  l = i + 1;
199  }
200  return RPMNS_TYPE_UNKNOWN;
201 }
202 
203 nsType rpmnsClassify(const char * s, size_t slen)
204 {
205  const char * se;
206  nsType Type;
207 
208  if (slen == 0) slen = strlen(s);
209  if (*s == '!') {
210  s++;
211  slen--;
212  }
213  if (*s == '/')
214  return RPMNS_TYPE_PATH;
215  se = s + slen;
216  if (s[0] == '%' && s[1] == '{' && se[-1] == '}')
217  return RPMNS_TYPE_FUNCTION;
218  if ((se - s) > 3 && se[-3] == '.' && se[-2] == 's' && se[-1] == 'o')
219  return RPMNS_TYPE_DSO;
220  Type = rpmnsProbe(s, slen);
221  if (Type != RPMNS_TYPE_UNKNOWN)
222  return Type;
223  for (se = s; *se != '\0'; se++) {
224  if (se[0] == '(' || se[--slen] == ')')
225  return RPMNS_TYPE_NAMESPACE;
226  if (se[0] == '.' && se[1] == 's' && se[2] == 'o')
227  return RPMNS_TYPE_DSO;
228  if (se[0] == '.' && xisdigit((int)se[-1]) && xisdigit((int)se[1]))
229  return RPMNS_TYPE_VERSION;
230  if (_rpmns_N_at_A && _rpmns_N_at_A[0]) {
231  if (se[0] == _rpmns_N_at_A[0] && rpmnsArch(se+1))
232  return RPMNS_TYPE_ARCH;
233  }
234 /*@-globstate@*/
235  if (se[0] == '.')
236  return RPMNS_TYPE_COMPOUND;
237  }
238  return RPMNS_TYPE_STRING;
239 /*@=globstate@*/
240 }
241 
242 int rpmnsParse(const char * s, rpmns ns)
243 {
244  char * t = rpmExpand(s, NULL);
245  size_t tlen = strlen(t);
246 
247  ns->Flags = (evrFlags) 0;
248  ns->str = t;
249  ns->Type = rpmnsClassify(t, tlen);
250 
251  switch (ns->Type) {
252  case RPMNS_TYPE_ARCH:
253  ns->NS = NULL;
254  ns->N = ns->str;
255  if (ns->N[0] == '!')
256  ns->N++;
257  if ((t = strrchr(t, _rpmns_N_at_A[0])) != NULL)
258  *t++ = '\0';
259  ns->A = t;
260  break;
261  case RPMNS_TYPE_RPMLIB:
262  case RPMNS_TYPE_CPUINFO:
263  case RPMNS_TYPE_GETCONF:
264  case RPMNS_TYPE_UNAME:
265  case RPMNS_TYPE_SONAME:
266  case RPMNS_TYPE_ACCESS:
267  case RPMNS_TYPE_USER:
268  case RPMNS_TYPE_GROUP:
269  case RPMNS_TYPE_MOUNTED:
271  case RPMNS_TYPE_DIGEST:
272  case RPMNS_TYPE_GNUPG:
273  case RPMNS_TYPE_MACRO:
274  case RPMNS_TYPE_ENVVAR:
275  case RPMNS_TYPE_RUNNING:
276  case RPMNS_TYPE_SANITY:
277  case RPMNS_TYPE_VCHECK:
279  case RPMNS_TYPE_VERIFY:
280  ns->NS = ns->str;
281  if (ns->NS[0] == '!')
282  ns->NS++;
283  if ((t = strchr(t, '(')) != NULL) {
284  *t++ = '\0';
285  ns->N = t;
286  t[strlen(t)-1] = '\0';
287  } else
288  ns->N = NULL;
289  ns->A = NULL;
290  break;
291  case RPMNS_TYPE_UNKNOWN:
292  case RPMNS_TYPE_STRING:
293  case RPMNS_TYPE_PATH:
294  case RPMNS_TYPE_DSO:
295  case RPMNS_TYPE_FUNCTION:
296  case RPMNS_TYPE_VERSION:
297  case RPMNS_TYPE_COMPOUND:
299  case RPMNS_TYPE_TAG:
300  case RPMNS_TYPE_CONFIG:
301  default:
302  ns->NS = NULL;
303  ns->N = ns->str;
304  if (ns->N[0] == '!')
305  ns->N++;
306  ns->A = NULL;
307  break;
308  }
309  return 0;
310 }
311 
317 static inline unsigned char nibble(char c)
318  /*@*/
319 {
320  if (c >= '0' && c <= '9')
321  return (unsigned char)(c - '0');
322  if (c >= 'A' && c <= 'F')
323  return (unsigned char)((int)(c - 'A') + 10);
324  if (c >= 'a' && c <= 'f')
325  return (unsigned char)((int)(c - 'a') + 10);
326  return '\0';
327 }
328 
329 rpmRC rpmnsProbeSignature(void * _ts, const char * fn, const char * sigfn,
330  const char * pubfn, const char * pubid,
331  /*@unused@*/ int flags)
332 {
333  rpmts ts = (rpmts) _ts;
334  pgpDig dig = rpmtsDig(ts);
335  pgpDigParams sigp = pgpGetSignature(dig);
336  pgpDigParams pubp = pgpGetPubkey(dig);
337  rpmuint8_t * sigpkt = NULL;
338  size_t sigpktlen = 0;
339  DIGEST_CTX ctx = NULL;
340  rpmRC rc = RPMRC_FAIL; /* assume failure */
341  int xx;
342 rpmhkp hkp = NULL;
343 pgpPkt pp = (pgpPkt) alloca(sizeof(*pp));
344 size_t pleft;
345 int validate = 1;
346 
347 SPEW((stderr, "==> check(%s, %s, %s, %s)\n", fn,
348  (sigfn ? sigfn : "(null)"),
349  (pubfn ? pubfn : "(null)"),
350  (pubid ? pubid : "(null)")));
351 
352  /* Choose signature location: clearsign from fn if sigfn is NULL */
353 assert(fn && *fn);
354  if (!(sigfn && *sigfn))
355  sigfn = fn;
356 
357  /* Load the signature from the file. */
358  { const char * _sigfn = rpmExpand(sigfn, NULL);
359  xx = pgpReadPkts(_sigfn, &sigpkt, &sigpktlen);
360  if (xx != PGPARMOR_SIGNATURE) {
361 SPEW((stderr, "==> pgpReadPkts(%s) SIG %p[%u] ret %d\n", _sigfn, sigpkt, (unsigned)sigpktlen, xx));
362  _sigfn = _free(_sigfn);
363  goto exit;
364  }
365  _sigfn = _free(_sigfn);
366  }
367 
368  pleft = sigpktlen;
369  xx = pgpPktLen(sigpkt, pleft, pp);
370  xx = rpmhkpLoadSignature(NULL, dig, pp);
371  if (xx) goto exit;
372 
373  if (sigp->version != (rpmuint8_t)3 && sigp->version != (rpmuint8_t)4) {
374 SPEW((stderr, "==> unverifiable V%u\n", (unsigned)sigp->version));
375  goto exit;
376  }
377 
378  if (ts->hkp == NULL)
379  ts->hkp = rpmhkpNew(NULL, 0);
380  hkp = rpmhkpLink(ts->hkp);
381 
382  /* Load the pubkey. Use pubfn if specified, otherwise rpmdb keyring. */
383  if (pubfn && *pubfn) {
384  const char * _pubfn = rpmExpand(pubfn, NULL);
385 /*@-type@*/
386 hkp->pkt = _free(hkp->pkt); /* XXX memleaks */
387 hkp->pktlen = 0;
388  xx = pgpReadPkts(_pubfn, &hkp->pkt, &hkp->pktlen);
389 /*@=type@*/
390 
391  if (xx != PGPARMOR_PUBKEY) {
392 SPEW((stderr, "==> pgpReadPkts(%s) PUB %p[%u] rc %d\n", _pubfn, hkp->pkt, (unsigned)hkp->pktlen, xx));
393  _pubfn = _free(_pubfn);
394  goto exit;
395  }
396  _pubfn = _free(_pubfn);
397 
398  /* Split the result into packet array. */
399 hkp->pkts = _free(hkp->pkts); /* XXX memleaks */
400 hkp->npkts = 0;
401  xx = pgpGrabPkts(hkp->pkt, hkp->pktlen, &hkp->pkts, &hkp->npkts);
402 
403 #ifdef DYING
404 _rpmhkpDumpDig(__FUNCTION__, dig, NULL);
405 #endif
406 
407  if (!xx)
408  (void) pgpPubkeyFingerprint(hkp->pkt, hkp->pktlen, hkp->keyid);
409  memcpy(pubp->signid, hkp->keyid, sizeof(pubp->signid));/* XXX useless */
410 
411  /* Validate pubkey self-signatures (if any). */
412  /* XXX TODO: only validate once, then cache using rpmku */
413  /* XXX need at least 3 packets to validate a pubkey */
414  if (validate && hkp->npkts >= 3) {
415 #ifdef DYING
416 pgpPrtPkts(hkp->pkt, hkp->pktlen, NULL, 1);
417 #endif
418  xx = rpmhkpValidate(hkp, NULL);
419  switch (xx) {
420  case RPMRC_OK:
421  break;
422  case RPMRC_NOTFOUND:
423  case RPMRC_FAIL: /* XXX remap to NOTFOUND? */
424  case RPMRC_NOTTRUSTED:
425  case RPMRC_NOKEY:
426  default:
427 SPEW((stderr, "\t<-- rpmhkpValidate() rc %d\n", xx));
428  rc = (rpmRC)xx;
429  goto exit;
430  }
431  }
432 
433  /* Retrieve parameters from pubkey/subkey packet(s). */
434  xx = rpmhkpFindKey(hkp, dig, sigp->signid, sigp->pubkey_algo);
435  if (xx) {
436 SPEW((stderr, "\t<-- rpmhkpFindKey() rc %d\n", xx));
437  goto exit;
438  }
439 
440  } else {
441  rc = (rpmRC)pgpFindPubkey(dig);
442  if (rc != RPMRC_OK) {
443 SPEW((stderr, "\t<-- pgpFindPubkey() rc %d\n", rc));
444  goto exit;
445  }
446  }
447 
448  /* Is this the requested pubkey? */
449  if (pubid && *pubid) {
450  size_t ns = strlen(pubid);
451  const char * s;
452  char * t;
453  size_t i;
454 
455  /* At least 8 hex digits please. */
456  for (i = 0, s = pubid; *s && isxdigit(*s); s++, i++)
457  {};
458  if (!(*s == '\0' && i > 8 && (i%2) == 0)) {
459 SPEW((stderr, "==> invalid pubid: %s\n", pubid));
460  goto exit;
461  }
462 
463  /* Truncate to key id size. */
464  s = pubid;
465  if (ns > 16) {
466  s += (ns - 16);
467  ns = 16;
468  }
469  ns >>= 1;
470  t = (char *) memset(alloca(ns), 0, ns);
471  for (i = 0; i < ns; i++)
472  t[i] = (char)((nibble(s[2*i]) << 4) | nibble(s[2*i+1]));
473 
474  /* Compare the pubkey id. */
475  s = (const char *)pubp->signid;
476  xx = memcmp(t, s + (8 - ns), ns);
477 
478 #ifdef DYING
479  /* XXX HACK: V4 RSA key id's are wonky atm. */
480  if (pubp->pubkey_algo == (rpmuint8_t)PGPPUBKEYALGO_RSA)
481  xx = 0;
482 #endif
483 
484  if (xx) {
485 SPEW((stderr, "==> mismatched: pubkey id (%08x %08x) != %s\n",
486 pgpGrab(pubp->signid, 4), pgpGrab(pubp->signid+4, 4), pubid));
487  goto exit;
488  }
489  }
490 
491  /* Do the parameters match the signature? */
492  if (!(sigp->pubkey_algo == pubp->pubkey_algo
493 #ifdef NOTYET
494  && sigp->hash_algo == pubp->hash_algo
495 #endif
496  && !memcmp(sigp->signid, pubp->signid, sizeof(sigp->signid)) ) ) {
497 
498  SPEW((stderr, "==> mismatch between signature and pubkey\n"));
499  SPEW((stderr, "\tpubkey_algo: %u %u\n",
500  (unsigned)sigp->pubkey_algo, (unsigned)pubp->pubkey_algo));
501  SPEW((stderr, "\tsignid: %08X %08X %08X %08X\n",
502  pgpGrab(sigp->signid, 4), pgpGrab(sigp->signid+4, 4),
503  pgpGrab(pubp->signid, 4), pgpGrab(pubp->signid+4, 4)));
504  goto exit;
505  }
506 
507  /* Compute the message digest. */
508  ctx = rpmDigestInit((pgpHashAlgo)sigp->hash_algo, RPMDIGEST_NONE);
509 
510  {
511  static const char clrtxt[] = "-----BEGIN PGP SIGNED MESSAGE-----";
512  static const char sigtxt[] = "-----BEGIN PGP SIGNATURE-----";
513  const char * _fn = rpmExpand(fn, NULL);
514  rpmiob iob = NULL;
515  int _rc = rpmiobSlurp(_fn, &iob);
516 
517  if (!(_rc == 0 && iob != NULL)) {
518 SPEW((stderr, "==> rpmiobSlurp(%s) MSG rc %d\n", _fn, _rc));
519  iob = rpmiobFree(iob);
520  _fn = _free(_fn);
521  goto exit;
522  }
523  _fn = _free(_fn);
524 
525  /* XXX clearsign sig is PGPSIGTYPE_TEXT not PGPSIGTYPE_BINARY. */
526  if (!strncmp((char *)iob->b, clrtxt, strlen(clrtxt))) {
527  const char * be = (char *) (iob->b + iob->blen);
528  const char * t;
529 
530  /* Skip to '\n\n' start-of-plaintext */
531  t = (char *) iob->b;
532  while (t && t < be && *t != '\n')
533  t = strchr(t, '\n') + 1;
534  if (!(t && t < be))
535  goto exit;
536  t++;
537 
538  /* Clearsign digest rtrims " \t\r\n", inserts "\r\n" inter-lines. */
539  while (t < be) {
540  const char * teol;
541  const char * te;
542  if (strncmp(t, "- ", 2) == 0)
543  t += 2;
544  if ((teol = te = strchr(t, '\n')) == NULL)
545  break;
546  while (te > t && strchr(" \t\r\n", te[-1]))
547  te--;
548  xx = rpmDigestUpdate(ctx, t, (te - t));
549  if (!strncmp((t = teol + 1), sigtxt, strlen(sigtxt)))
550  break;
551  xx = rpmDigestUpdate(ctx, "\r\n", sizeof("\r\n")-1);
552  }
553  } else
554  xx = rpmDigestUpdate(ctx, iob->b, iob->blen);
555 
556  iob = rpmiobFree(iob);
557  }
558 
559  if (sigp->hash != NULL)
560  xx = rpmDigestUpdate(ctx, sigp->hash, sigp->hashlen);
561 
562  if (sigp->version == (rpmuint8_t)4) {
563  rpmuint8_t trailer[6];
564  trailer[0] = sigp->version;
565  trailer[1] = (rpmuint8_t)0xff;
566  trailer[2] = (sigp->hashlen >> 24) & 0xff;
567  trailer[3] = (sigp->hashlen >> 16) & 0xff;
568  trailer[4] = (sigp->hashlen >> 8) & 0xff;
569  trailer[5] = (sigp->hashlen ) & 0xff;
570  xx = rpmDigestUpdate(ctx, trailer, sizeof(trailer));
571  }
572 
573  /* Load the message digest. */
574  switch(sigp->pubkey_algo) {
575  default:
576  rc = RPMRC_FAIL;
577  break;
578  case PGPPUBKEYALGO_RSA:
579  rc = (pgpImplSetRSA(ctx, dig, sigp) ? RPMRC_FAIL : RPMRC_OK);
580  break;
581  case PGPPUBKEYALGO_DSA:
582  rc = (pgpImplSetDSA(ctx, dig, sigp) ? RPMRC_FAIL : RPMRC_OK);
583  break;
584  case PGPPUBKEYALGO_ECDSA:
585  rc = (pgpImplSetECDSA(ctx, dig, sigp) ? RPMRC_FAIL : RPMRC_OK);
586  break;
587  }
588  if (rc != RPMRC_OK) {
589 SPEW((stderr, "==> can't load pubkey_algo(%u)\n", (unsigned)sigp->pubkey_algo));
590  goto exit;
591  }
592 
593  /* Verify the signature. */
594  switch(sigp->pubkey_algo) {
595  default:
596  rc = RPMRC_FAIL;
597  break;
598  case PGPPUBKEYALGO_RSA:
599  case PGPPUBKEYALGO_DSA:
600  case PGPPUBKEYALGO_ECDSA:
601  rc = (pgpImplVerify(dig) ? RPMRC_OK : RPMRC_FAIL);
602  break;
603  }
604 
605 exit:
606  sigpkt = _free(sigpkt);
607  (void) rpmhkpFree(hkp);
608  hkp = NULL;
609 /*@-nullstate@*/
610  rpmtsCleanDig(ts);
611 /*@=nullstate@*/
612 
613 SPEW((stderr, "============================ verify: %s\n",
614  (rc == RPMRC_OK ? "OK" :
615  (rc == RPMRC_NOKEY ? "NOKEY" :
616  "FAIL"))));
617 
618  return rc;
619 }
static unsigned char nibble(char c)
Convert hex to binary nibble.
Definition: rpmns.c:317
void _rpmhkpDumpDig(const char *msg, pgpDig dig, FILE *fp)
Definition: rpmhkp.c:1164
pgpDigParams pgpGetPubkey(pgpDig dig)
Return OpenPGP pubkey parameters.
Definition: rpmpgp.c:1397
int _rpmns_debug
Definition: rpmns.c:44
int rpmhkpFindKey(rpmhkp hkp, pgpDig dig, const rpmuint8_t *signid, rpmuint8_t pubkey_algo)
Definition: rpmhkp.c:404
rpmRC rpmhkpValidate(rpmhkp hkp, const char *keyname)
Retrieve/Validate binding and certification signatures on a pubkey.
Definition: rpmhkp.c:901
enum nsType_e nsType
Dependency types.
const char bson_timestamp_t * ts
Definition: bson.h:1004
int pgpPktLen(const rpmuint8_t *pkt, size_t pleft, pgpPkt pp)
Definition: rpmpgp.c:999
OpenPGP constants and structures from RFC-2440.
struct pgpDigParams_s * pgpDigParams
Definition: rpmiotypes.h:101
DIGEST_CTX rpmDigestInit(pgpHashAlgo hashalgo, rpmDigestFlags flags)
Initialize digest context.
Definition: digest.c:247
#define _ENTRY(_s, _type)
Dependency probe table (must be sorted).
Definition: rpmns.c:113
static unsigned int pgpGrab(const rpmuint8_t *s, size_t nbytes)
Return (native-endian) integer from big-endian representation.
Definition: rpmpgp.h:1036
enum pgpHashAlgo_e pgpHashAlgo
9.4.
rpmhkp rpmhkpNew(const rpmuint8_t *keyid, uint32_t flags)
Create a new hkp handle.
Definition: rpmhkp.c:112
Structure(s) and routine(s) used for classifying and parsing names.
nsType Type
Definition: rpmns.c:118
nsType rpmnsProbe(const char *s, size_t slen)
Is string a known probe namespace?
Definition: rpmns.c:176
static struct _rpmnsProbes_s rpmnsProbes[]
rpmiob rpmiobFree(rpmiob iob)
Destroy a I/O buffer instance.
rpmhkp rpmhkpFree(rpmhkp hkp)
Destroy a hkp handle.
static int pgpImplSetDSA(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
Definition: rpmpgp.h:1785
int rpmiobSlurp(const char *fn, rpmiob *iobp)
Definition: rpmiob.c:129
enum evrFlags_e evrFlags
Dependency Attributes.
size_t NSlen
Definition: rpmns.c:117
char * alloca()
const char * str
Definition: bson.h:593
pgpArmor pgpReadPkts(const char *fn, rpmuint8_t **pkt, size_t *pktlen)
Parse armored OpenPGP packets from a file.
Definition: rpmpgp.c:1739
void rpmtsCleanDig(rpmts ts)
Free signature verification data.
Definition: pkgio.c:456
int rpmDigestUpdate(DIGEST_CTX ctx, const void *data, size_t len)
Update context with next plain text buffer.
Definition: digest.c:986
rpmRC rpmnsProbeSignature(void *_ts, const char *fn, const char *sigfn, const char *pubfn, const char *pubid, int flags)
Verify OpenPGP signature on a file.
Definition: rpmns.c:329
struct rpmns_s * rpmns
Definition: rpmns.h:22
int pgpFindPubkey(pgpDig dig)
Call find pubkey vector.
Definition: rpmpgp.c:1464
Structures and prototypes used for an "rpmps" problem set.
static const char * rpmnsArches[]
Definition: rpmns.c:53
unsigned char rpmuint8_t
Private int typedefs to avoid C99 portability issues.
Definition: rpmiotypes.h:26
nsType rpmnsArch(const char *str)
Is string a known arch suffix?
Definition: rpmns.c:76
#define SPEW(_list)
Definition: rpmns.c:45
const char * NS
Definition: rpmns.c:116
static int xisspace(int c)
Definition: rpmiotypes.h:555
struct pgpPkt_s * pgpPkt
Definition: rpmiotypes.h:93
pgpDigParams pgpGetSignature(pgpDig dig)
Return OpenPGP signature parameters.
Definition: rpmpgp.c:1392
Digest private data.
Definition: digest.c:130
const char const char * user
Definition: mongo.h:828
struct pgpDig_s * pgpDig
Definition: rpmiotypes.h:97
static int pgpImplSetECDSA(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
Definition: rpmpgp.h:1803
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
Definition: macro.c:3238
const char const bson int mongo_write_concern int flags
Definition: mongo.h:485
static int pgpImplSetRSA(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
Definition: rpmpgp.h:1776
int pgpGrabPkts(const rpmuint8_t *pkts, size_t pktlen, rpmuint8_t ***pppkts, int *pnpkts)
Return array of packet pointers.
Definition: rpmpgp.c:1472
enum rpmRC_e rpmRC
RPM return codes.
rpmhkp rpmhkpLink(rpmhkp hkp)
Reference a hkp handle instance.
const char const int i
Definition: bson.h:778
static int xisdigit(int c)
Definition: rpmiotypes.h:546
static void set(char *t, NODE *ip)
Definition: rpmmtree.c:1408
int pgpPubkeyFingerprint(const rpmuint8_t *pkt, size_t pktlen, rpmuint8_t *keyid)
Print/parse an OpenPGP subtype packet.
Definition: rpmpgp.c:1029
nsType rpmnsClassify(const char *s, size_t slen)
Classify a string as a dependency type.
Definition: rpmns.c:203
struct rpmts_s * rpmts
The RPM Transaction Set.
Definition: rpmtypes.h:14
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
Definition: rpmiotypes.h:756
struct rpmiob_s * rpmiob
Definition: rpmiotypes.h:60
Structures and prototypes used for an "rpmts" transaction set.
static int pgpImplVerify(pgpDig dig)
Definition: rpmpgp.h:1856
Structure(s) and routine(s) used for EVR parsing and comparison.
int rpmnsParse(const char *s, rpmns ns)
Expand and split NS(N).A string into namespace, name and arch components.
Definition: rpmns.c:242
int pgpPrtPkts(const rpmuint8_t *pkts, size_t pktlen, pgpDig dig, int printing)
Print/parse a OpenPGP packet(s).
Definition: rpmpgp.c:1518
struct rpmhkp_s * rpmhkp
Definition: rpmhkp.h:11
Access RPM indices using Berkeley DB interface(s).
pgpDig rpmtsDig(rpmts ts)
Get OpenPGP packet parameters, i.e.
Definition: pkgio.c:441
static size_t rpmnsProbesCount
Definition: rpmns.c:174
int rpmhkpLoadSignature(rpmhkp hkp, pgpDig dig, pgpPkt pp)
Definition: rpmhkp.c:461
const char * _rpmns_N_at_A
Definition: rpmns.c:49
const char * ns
Definition: mongo.h:326