rpm  5.4.10
Macros | Functions | Variables
rpmchecksig.c File Reference

Verify the signature of a package. More...

#include "system.h"
#include <rpmio_internal.h>
#include <poptIO.h>
#include <rpmbc.h>
#include <rpmhkp.h>
#include <rpmtag.h>
#include <rpmtypes.h>
#include <rpmevr.h>
#include <rpmdb.h>
#include <rpmtxn.h>
#include <rpmxar.h>
#include <pkgio.h>
#include "signature.h"
#include <rpmts.h>
#include "rpmgi.h"
#include <rpmversion.h>
#include <rpmcli.h>
#include "debug.h"
Include dependency graph for rpmchecksig.c:

Go to the source code of this file.

Macros

#define _RPMHKP_INTERNAL   /* XXX internal prototypes. */
 
#define _RPMEVR_INTERNAL   /* XXX RPMSENSE_KEYRING */
 
#define _RPMDB_INTERNAL   /* XXX db_txn */
 
#define _RPMTS_INTERNAL   /* XXX ts->hkp */
 

Functions

static int manageFile (FD_t *fdp, const char **fnp, int flags, int rc)
 
static int copyFile (FD_t *sfdp, const char **sfnp, FD_t *tfdp, const char **tfnp)
 Copy header+payload, calculating digest(s) on the fly. More...
 
static int getSignid (Header sigh, rpmSigTag sigtag, unsigned char *signid)
 Retrieve signer fingerprint from an OpenPGP signature tag. More...
 
static int rpmReSign (rpmts ts, QVA_t qva, const char **argv)
 Create/modify elements in signature header. More...
 
rpmRC rpmcliImportPubkey (const rpmts ts, const unsigned char *pkt, ssize_t pktlen)
 Import public key packet(s). More...
 
static int rpmcliImportPubkeys (const rpmts ts, QVA_t qva, const char **argv)
 Import public key(s). More...
 
static rpmRC readFile (FD_t fd, const char *fn)
 
int rpmVerifySignatures (QVA_t qva, rpmts ts, void *_fd, const char *fn)
 Check package and header signatures. More...
 
int rpmcliSign (rpmts ts, QVA_t qva, const char **argv)
 Create/Modify/Check elements from signature header. More...
 

Variables

int _print_pkts = 0
 

Detailed Description

Verify the signature of a package.

Definition in file rpmchecksig.c.

Macro Definition Documentation

§ _RPMDB_INTERNAL

#define _RPMDB_INTERNAL   /* XXX db_txn */

Definition at line 19 of file rpmchecksig.c.

§ _RPMEVR_INTERNAL

#define _RPMEVR_INTERNAL   /* XXX RPMSENSE_KEYRING */

Definition at line 17 of file rpmchecksig.c.

§ _RPMHKP_INTERNAL

#define _RPMHKP_INTERNAL   /* XXX internal prototypes. */

Definition at line 12 of file rpmchecksig.c.

§ _RPMTS_INTERNAL

#define _RPMTS_INTERNAL   /* XXX ts->hkp */

Definition at line 26 of file rpmchecksig.c.

Function Documentation

§ copyFile()

static int copyFile ( FD_t sfdp,
const char **  sfnp,
FD_t tfdp,
const char **  tfnp 
)
static

Copy header+payload, calculating digest(s) on the fly.

Definition at line 110 of file rpmchecksig.c.

References _, Fflush(), Fread(), Fstrerror(), Fwrite(), manageFile(), rpmlog(), and RPMLOG_ERR.

Referenced by rpmReSign().

§ getSignid()

static int getSignid ( Header  sigh,
rpmSigTag  sigtag,
unsigned char *  signid 
)
static

Retrieve signer fingerprint from an OpenPGP signature tag.

Parameters
sighsignature header
sigtagsignature tag
Return values
signidsigner fingerprint
Returns
0 on success

Definition at line 159 of file rpmchecksig.c.

References _free(), alloca(), _HE_s::c, headerGet(), _HE_s::p, pgpDigFree(), pgpDigNew(), pgpPktLen(), PGPPUBKEYALGO_UNKNOWN, rpmDataType_u::ptr, RPMVSF_DEFAULT, _HE_s::tag, and rpmDataType_u::ui8p.

Referenced by rpmReSign().

§ manageFile()

static int manageFile ( FD_t fdp,
const char **  fnp,
int  flags,
int  rc 
)
static

Definition at line 51 of file rpmchecksig.c.

References _, Fclose(), fdFree(), fdLink(), Ferror(), Fopen(), Fstrerror(), rpmlog(), RPMLOG_ERR, and rpmTempFile().

Referenced by copyFile(), and rpmReSign().

§ readFile()

static rpmRC readFile ( FD_t  fd,
const char *  fn 
)
static

§ rpmcliImportPubkey()

rpmRC rpmcliImportPubkey ( const rpmts  ts,
const unsigned char *  pkt,
ssize_t  pktlen 
)

§ rpmcliImportPubkeys()

static int rpmcliImportPubkeys ( const rpmts  ts,
QVA_t  qva,
const char **  argv 
)
static

Import public key(s).

Todo:
Implicit –update policy for gpg-pubkey headers.
Parameters
tstransaction set
qvamode flags and parameters
argvarray of pubkey file names (NULL terminated)
Returns
0 on success

Definition at line 866 of file rpmchecksig.c.

References _, _free(), PGPARMOR_PUBKEY, pgpReadPkts(), rpmcliImportPubkey(), rpmExpand(), rpmlog(), RPMLOG_ERR, RPMRC_OK, and rpmtsClean().

Referenced by rpmcliSign().

§ rpmcliSign()

int rpmcliSign ( rpmts  ts,
QVA_t  qva,
const char **  argv 
)

§ rpmReSign()

static int rpmReSign ( rpmts  ts,
QVA_t  qva,
const char **  argv 
)
static

§ rpmVerifySignatures()

int rpmVerifySignatures ( QVA_t  qva,
rpmts  ts,
void *  _fd,
const char *  fn 
)

Variable Documentation

§ _print_pkts

int _print_pkts = 0

Definition at line 47 of file rpmchecksig.c.